/* ==========================================================================
   SISTEMA DE DISEÑO & ESTILOS - INVENTARIO 360°
   ========================================================================== */

/* Variables de Temas (Claro por defecto) */
:root {
  --font-family: 'Poppins', sans-serif;
  
  /* Paleta Light Mode */
  --bg-primary: #f4f6f9;
  --bg-secondary: #ffffff;
  --bg-sidebar: #ffffff;
  --text-sidebar: #1e293b;
  --text-sidebar-muted: #64748b;
  --text-sidebar-accent: #018C8C;
  --border-sidebar: #e2e8f0;
  --sidebar-hover-bg: #f1f5f9;
  --sidebar-hover-text: #018C8C;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  /* Colores de Marca */
  --primary: #018C8C;
  --primary-hover: #017373;
  --primary-light: #e6f4f4;
  --accent: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --success-hover: #059669;
  
  /* Sombras y Bordes */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-dropdown: 0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* Paleta Dark Mode (Se activa agregando .dark-mode al body) */
body.dark-mode {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-sidebar: #0f172a;
  --text-sidebar: #f8fafc;
  --text-sidebar-muted: #94a3b8;
  --text-sidebar-accent: #38bdf8;
  --border-sidebar: rgba(255, 255, 255, 0.1);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-hover-text: #ffffff;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --primary-light: #0d2e2e;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3);
}

/* Reset de Estilos */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Elementos Comunes y Tipografía */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Utilidades de Scroll */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
body.dark-mode ::-webkit-scrollbar-thumb {
  background: #475569;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   VISTA DE LOGIN (PANTALLA DE INICIO)
   ========================================================================== */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #018c8c 50%, #0f172a 100%);
  background-size: 200% 200%;
  animation: gradientBG 15s ease infinite;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before,
.login-wrapper::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
}
.login-wrapper::before {
  width: 400px;
  height: 400px;
  background: rgba(1, 140, 140, 0.4);
  top: -100px;
  left: -100px;
}
.login-wrapper::after {
  width: 300px;
  height: 300px;
  background: rgba(15, 23, 42, 0.6);
  bottom: -50px;
  right: -50px;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-card {
  background: rgba(255, 255, 255, 255);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 40px;
  border-radius: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
  animation: slideIn 0.5s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.login-card h2, .login-card p, .login-card label {
  color: #000000;
}

.login-card input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.login-card input::placeholder {
  color: rgba(102, 102, 102, 0.6);
}

.login-card input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

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

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  max-width: 250px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 15px auto;
}

.login-header h2 {
  font-size: 1.8rem;
  margin-bottom: 5px;
  color: var(--text-main);
}

.login-header p {
  font-size: 0.85rem;
}

/* ==========================================================================
   DISEÑO DE CONTENEDOR PRINCIPAL Y MENÚ LATERAL (SIDEBAR)
   ========================================================================== */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-sidebar);
  z-index: 100;
  flex-shrink: 0;
}

/* Logo de la Empresa en Sidebar */
.sidebar-logo-container {
  padding: 20px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border-sidebar);
}
.sidebar-logo {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

/* Información del Usuario (Parte Superior) */
.sidebar-user-panel {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.user-avatar-container {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary);
  background: #f1f5f9;
}

.user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  flex-grow: 1;
  overflow: hidden;
}

.user-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-sidebar);
}

.user-info span {
  font-size: 0.75rem;
  color: var(--text-sidebar-accent);
  text-transform: uppercase;
  font-weight: 500;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-sidebar-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.logout-btn:hover {
  color: var(--danger);
  background-color: rgba(239, 68, 68, 0.1);
}

/* Navegación de Botones de Acceso */
.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-sidebar-muted);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}

.nav-item.active {
  background-color: var(--primary);
  color: #ffffff;
}

/* Footer del Sidebar: Switch Modo Oscuro */
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-sidebar);
}

.theme-switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-label {
  font-size: 0.85rem;
  color: var(--text-sidebar-muted);
  font-weight: 500;
}

/* Switch Estilo iOS */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

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

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

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

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

/* ==========================================================================
   ÁREA DE CONTENIDO Y CABECERA (HEADER REDISTRIBUIDO)
   ========================================================================== */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.main-header {
  height: 80px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Cabecera Izquierda: Logo e Identidad */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 68px;
  width: auto;
}

.app-title {
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Cabecera Central: Relojes Globales */
.header-center {
  display: flex;
  gap: 30px;
}

.clock-card {
  background-color: #f1f5f9;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  text-align: center;
  min-width: 160px;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal);
}

body.dark-mode .clock-card {
  background-color: #334155;
}

.clock-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #018C8C;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.flag-icon {
  width: 21px;
  height: 14px;
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  display: inline-block;
  flex-shrink: 0;
}

.clock-time {
  font-size: 1.15rem;
  font-weight: 700;
  color: #000000; /* Obligatorio: la hora en negro */
  margin: 1px 0;
}

body.dark-mode .clock-time {
  color: #000000; /* Obligatorio: mantener negro o fondo claro. En nuestro diseño, la tarjeta mantiene el fondo claro en modo oscuro pero con buen contraste */
}

/* Si es necesario garantizar la lectura de hora en negro en modo oscuro, el badge de reloj mantiene fondos legibles */
body.dark-mode .clock-card {
  background-color: #cbd5e1; /* En modo oscuro es gris claro para garantizar legibilidad de la hora en negro */
}

.clock-date {
  font-size: 0.7rem;
  color: #475569;
  font-weight: 500;
}

/* Cabecera Derecha: Panel de Resumen (Con Hover Dropdown) */
.header-right {
  position: relative;
}

.summary-widget {
  display: flex;
  background-color: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  gap: 20px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.summary-widget:hover {
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}

.summary-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Reglas de Capas: Z-Index Máximo y Colores de Listas Desplegables */
.summary-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background-color: #ffffff !important; /* Obligatorio: fondo blanco */
  color: #000000 !important; /* Obligatorio: tipografía negra */
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  border: 1px solid #cbd5e1;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-fast);
  z-index: 1000; /* Z-Index Máximo absoluto */
}

.summary-widget:hover .summary-dropdown,
.summary-dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.dropdown-header h5 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #018c8c;
}

.dropdown-section h6 {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.dropdown-section ul {
  list-style: none;
}

.dropdown-section li {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px dashed #f1f5f9;
}

.dropdown-section li:last-child {
  border-bottom: none;
}

.dropdown-section li span.val {
  font-weight: 600;
  color: #000;
}

.border-top {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  margin-top: 10px;
}

/* ==========================================================================
   MAQUETACIÓN DE MÓDULOS DE CONTENIDO
   ========================================================================== */
.modules-container {
  flex-grow: 1;
  padding: 30px;
  overflow-y: auto;
  position: relative;
}

.app-module {
  animation: fadeIn 0.4s ease;
  height: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.module-header {
  margin-bottom: 24px;
}

.module-header h2 {
  font-size: 1.6rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.module-header p {
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

/* Tarjetas (Cards) */
.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: visible;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(0,0,0,0.01);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h5 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin: 0;
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Formularios y Controles */
.form-group {
  margin-bottom: 16px;
  width: 100%;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  background-color: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 140, 140, 0.15);
}

.readonly-input {
  background-color: var(--bg-primary) !important;
  cursor: not-allowed;
}

/* Controles de Selección Múltiple - Listas Desplegables de Fondo Blanco y Texto Negro */
.custom-select-multi {
  height: 90px;
  background-color: #ffffff !important; /* Obligatorio: fondo blanco */
  color: #000000 !important; /* Obligatorio: texto negro */
  font-family: var(--font-family);
  font-size: 0.8rem;
  border: 1px solid #cbd5e1 !important;
}

.custom-select-multi option {
  padding: 4px 8px;
  background-color: #ffffff !important;
  color: #000000 !important;
}

.custom-select-multi option:checked {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
}

/* Filas de Formularios */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.form-row .form-group {
  flex: 1;
}

.form-row-3col {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.form-row-3col .form-group {
  flex: 1;
}

.form-row-3col.align-items-end {
  align-items: flex-end;
}

.flex-2 {
  flex: 2 !important;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 18px 0 10px 0;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

/* Contenedores deshabilitados informativos */
.disabled-row {
  opacity: 0.75;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

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

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

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

body.dark-mode .btn-secondary {
  background-color: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

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

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

.btn-block {
  display: flex;
  width: 100%;
}

.btn-outline-primary {
  background-color: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline-primary:hover {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-outline-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

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

.btn-group-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-link-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Grillas */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

.grid-3-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-card.full-width {
  grid-column: span 2;
}

.max-w-600 {
  max-w: 600px;
}

/* Tablas de Datos */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.table th,
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  background-color: rgba(0,0,0,0.02);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0,0,0,0.015);
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255,255,255,0.015);
}

.table-hover tbody tr:hover {
  background-color: rgba(0,0,0,0.03) !important;
}

body.dark-mode .table-hover tbody tr:hover {
  background-color: rgba(255,255,255,0.03) !important;
}

/* Badges e Iconos */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-teal {
  background-color: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

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

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

/* Input Icon Wrapper */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.input-icon-wrapper input {
  padding-left: 40px;
}

/* Alertas */
.error-alert {
  background-color: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.alert-info {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
}

body.dark-mode .alert-info {
  background-color: #172554;
  border-color: #1e3a8a;
  color: #93c5fd;
}

.alert-info i {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
}

/* List Groups */
.list-group {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-group-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Estilo Foto Upload */
.photo-upload-wrapper {
  display: flex;
  gap: 16px;
  align-items: center;
}

.photo-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-photo-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.photo-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Buscar */
.search-bar {
  margin-bottom: 16px;
}

.search-bar-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: center;
}

.search-bar-row .form-group {
  margin-bottom: 0;
}

.search-bar-row .form-group.flex-2 {
  flex: 3;
}

.search-bar-row .form-group:not(.flex-2) {
  flex: 1;
  max-width: 240px;
}

/* Gráficos Contenedores */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
}

.chart-container-large {
  position: relative;
  height: 320px;
  width: 100%;
}

/* ==========================================================================
   TABS DE CONFIGURACIÓN
   ========================================================================== */
.tab-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tab-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.scrollable-card-body {
  max-height: 520px;
  overflow-y: auto;
}

/* Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: none;
  font-weight: 500;
  cursor: pointer;
}

/* ==========================================================================
   PEDIDO SIMULADOR Y SEMÁFORO LOGÍSTICO
   ========================================================================== */
.sim-metric-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 15px;
}

.sim-metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.sim-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.traffic-light-widget {
  padding: 24px;
  border-radius: var(--radius-lg);
  color: #000000 !important; /* Texto negro para contraste */
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  margin-top: 20px;
  border: 1px solid transparent;
}

.traffic-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.traffic-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.traffic-desc {
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0.9;
}

/* Estados del Semáforo */
.traffic-green {
  background-color: #d1fae5 !important; /* Verde pastel */
  border-color: #10b981 !important;
}

.traffic-yellow {
  background-color: #fef3c7 !important; /* Amarillo/Naranja pastel */
  border-color: #f59e0b !important;
}

.traffic-blue {
  background-color: #e0f2fe !important; /* Azul pastel */
  border-color: #0284c7 !important;
}

.scrollable-list-sm {
  max-height: 180px;
  overflow-y: auto;
}

/* ==========================================================================
   MODAL DIALOG (DETALLES E HISTORIAL)
   ========================================================================== */
.modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000; /* Z-Index máximo por encima de todo */
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  border: 1px solid var(--border-color);
  animation: slideIn 0.3s ease-out;
  overflow: hidden;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(0,0,0,0.01);
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Estilos de Tabla en Miniatura para Items de Detalles */
.modal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-detail-item {
  display: flex;
  flex-direction: column;
}

.modal-detail-item span.label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.modal-detail-item span.value {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

/* ==========================================================================
   RESPONSIVO / COMPATIBILIDAD
   ========================================================================== */
@media (max-width: 1024px) {
  .grid-2col,
  .grid-3-1,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-card.full-width {
    grid-column: span 1;
  }
  
  .sidebar {
    width: 70px;
  }
  
  .sidebar .user-info,
  .sidebar-user-panel .logout-btn,
  .sidebar-nav span,
  .sidebar-footer .theme-label,
  .sidebar-footer .switch {
    display: none;
  }
  
  .sidebar-user-panel {
    padding: 12px;
    justify-content: center;
  }
  
  .sidebar-nav {
    padding: 10px 4px;
  }
  
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
}

/* ==========================================================================
   MÓDULO SALIDA DE MERCANCÍA — ESTILOS REDISEÑADOS
   ========================================================================== */

/* Fila de cabecera del documento (Fecha + Bodega + PVE) */
.exit-header-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.4fr;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(99,179,237,0.08), rgba(129,230,217,0.08));
  border: 1px solid rgba(99,179,237,0.2);
  border-radius: 12px;
  margin-bottom: 20px;
}
.exit-header-row label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}
.exit-header-row label svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

/* Sección de agregar ítems */
.exit-add-section {
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 8px;
  background: var(--bg-light, #f8faff);
}
.exit-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.exit-section-title svg {
  width: 14px; height: 14px;
  color: var(--accent-teal);
}

/* Fila de entrada de ítem */
.exit-item-input-row {
  display: grid;
  grid-template-columns: 2.5fr 0.8fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.exit-col-product  { }
.exit-col-qty      { }
.exit-col-price    { }
.exit-col-info     { }
.exit-col-btn      { }
.exit-col-btn .btn {
  width: 100%;
  white-space: nowrap;
}

/* Badges de info (categoría + stock) */
.exit-info-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}
.exit-info-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--border-color);
  color: #000000;
  transition: background 0.2s, color 0.2s;
  text-align: center;
}
.exit-info-stock {
  font-size: 0.7rem;
}

/* Tabla de salida */
.exit-table {
  font-size: 0.88rem;
}
.exit-table thead th {
  background: rgba(99,179,237,0.07);
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 2px solid rgba(99,179,237,0.2);
}
.exit-table tbody tr {
  transition: background 0.15s;
}
.exit-table tbody tr:hover {
  background: rgba(99,179,237,0.04);
}
.exit-table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Cantidad badge */
.exit-qty-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(99,179,237,0.12);
  color: var(--accent-blue, #3182ce);
  font-weight: 700;
  font-size: 0.82rem;
}

/* Total row */
.exit-total-row td {
  padding: 12px 12px;
  border-top: 2px solid rgba(99,179,237,0.25);
  font-size: 0.9rem;
  background: rgba(129,230,217,0.06);
}
.exit-total-amount {
  font-size: 1.05rem;
  color: var(--accent-teal) !important;
  font-weight: 800;
}

/* Estado vacío */
.exit-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 20px;
  color: var(--text-muted);
  opacity: 0.6;
  font-size: 0.85rem;
}
.exit-empty svg {
  width: 36px;
  height: 36px;
  opacity: 0.4;
}

/* Sección campos ME */
.exit-me-card {
  margin-top: 20px;
  border: 1px solid rgba(237,137,54,0.3);
  border-radius: 12px;
  overflow: hidden;
  animation: fadeSlideIn 0.25s ease;
}
.exit-me-card-header {
  background: linear-gradient(135deg, rgba(237,137,54,0.1), rgba(252,211,77,0.08));
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c05621;
  border-bottom: 1px solid rgba(237,137,54,0.2);
}
.exit-me-card-header svg {
  width: 15px; height: 15px;
}
.exit-me-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr) repeat(2, 1fr);
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255,250,245,0.5);
}

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

/* Responsive: salida */
@media (max-width: 900px) {
  .exit-header-row {
    grid-template-columns: 1fr 1fr;
  }
  .exit-item-input-row {
    grid-template-columns: 1fr 1fr;
  }
  .exit-me-body {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .exit-header-row,
  .exit-item-input-row,
  .exit-me-body {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   DASHBOARD — FILTROS EN UNA SOLA LÍNEA
   ========================================================================== */

/* Card sin padding extra */
.filter-card .card-body.db-filter-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 14px 16px;
}

/* Cada columna de filtro */
.db-filter-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
}

/* Etiqueta compacta con ícono */
.db-filter-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 5px;
  white-space: nowrap;
}
.db-filter-label svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Select compacto para la fila del dashboard */
.db-select {
  height: 65px !important;   /* 3-4 opciones visibles */
  width: 100%;
  font-size: 0.78rem !important;
}

/* Columna de botones */
.db-filter-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.db-filter-btn {
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Responsive: en pantallas pequeñas se apilan */
@media (max-width: 1100px) {
  .filter-card .card-body.db-filter-row {
    flex-wrap: wrap;
  }
  .db-filter-group {
    flex: 1 1 calc(50% - 10px);
  }
}
@media (max-width: 600px) {
  .db-filter-group {
    flex: 1 1 100%;
  }
}

/* Filtros de Cruce de Inventarios - Diseño Horizontal y Responsive */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

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

@media (max-width: 600px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode overrides for Ventas (Agregar Productos al Documento) */
body.dark-mode .exit-add-section {
  background: var(--bg-primary) !important;
  color: #ffffff !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .exit-add-section label,
body.dark-mode .exit-add-section label svg,
body.dark-mode .exit-section-title,
body.dark-mode .exit-section-title svg {
  color: #ffffff !important;
}

body.dark-mode .exit-info-badge {
  color: #ffffff !important;
  background: var(--bg-secondary) !important;
}

/* Dark mode overrides for dashboard multi-select filters */
body.dark-mode .custom-select-multi {
  background-color: var(--bg-secondary) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
}

body.dark-mode .custom-select-multi option {
  background-color: var(--bg-secondary) !important;
  color: var(--text-main) !important;
}

body.dark-mode .custom-select-multi option:checked {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}

/* Estilos de Botones Selector de Rótulos de Envío */
#btn-select-label-tym {
  color: #018C8C;
  border-color: #018C8C;
}
#btn-select-label-tym:hover {
  background-color: rgba(1, 140, 140, 0.1);
}
#btn-select-label-tym.active {
  background-color: #018C8C !important;
  color: #ffffff !important;
  border-color: #018C8C !important;
}

#btn-select-label-me {
  color: #84cc16;
  border-color: #84cc16;
}
#btn-select-label-me:hover {
  background-color: rgba(132, 204, 22, 0.1);
}
#btn-select-label-me.active {
  background-color: #84cc16 !important;
  color: #ffffff !important;
  border-color: #84cc16 !important;
}

/* Estilos Premium para inputs de tipo archivo (file) */
input[type="file"] {
  width: 100%;
  font-family: var(--font-family);
  font-size: 0.85rem;
  background-color: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-fast);
  padding: 6px 12px;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-right: 8px;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.8rem;
  transition: background-color var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
  background-color: var(--primary-hover);
}

body.dark-mode input[type="file"]::file-selector-button {
  background-color: var(--primary);
}

body.dark-mode input[type="file"]::file-selector-button:hover {
  background-color: var(--primary-hover);
}


.custom-dropdown-btn {
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

.custom-dropdown-btn:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 140, 140, 0.15);
}

