/* ==============================================================================
   MAGARETTO - SISTEMA DE CONTROL DE EMPAQUE Y CÓDIGO DE BARRAS
   Estilos CSS basados en la Guía de Diseño Oficial (AGENTS.md)
   ============================================================================== */

:root {
  /* Tokens de Color Oficiales Magaretto (según AGENTS.md) */
  --bg-primary: #F8F9FF;
  --bg-secondary: #EFF4FF;
  --bg-sidebar: #EFF4FF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFD;
  --bg-input: #FFFFFF;
  
  --border-color: #D5E0F8;
  --border-focus: #6412D5;
  
  --text-primary: #0B1C30;
  --text-secondary: #545F73;
  --text-muted: #828FA3;
  
  --accent-garlic: #6412D5;
  --accent-garlic-dark: #4A0D9E;
  --accent-primary: #6412D5;
  --accent-primary-hover: #7C3AED;
  --accent-light: #ECE6FA;
  --accent-light-bg: #F5F1FD;
  
  --status-success: #10B981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-warning: #F59E0B;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-danger: #EF4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  
  --shadow-sm: 0 1px 3px rgba(11, 28, 48, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(11, 28, 48, 0.06), 0 2px 4px -1px rgba(11, 28, 48, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(11, 28, 48, 0.08), 0 4px 6px -2px rgba(11, 28, 48, 0.04);
  --shadow-glow-success: 0 0 20px rgba(16, 185, 129, 0.25);
  --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Dimensiones de Navegación */
  --sidebar-width-expanded: 250px;
  --sidebar-width-compact: 72px;
  --topbar-height: 64px;
}

/* Base & Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
}

/* Contenedor Maestro App */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* ==============================================================================
   BARRA LATERAL (SIDEBAR) - Modos Expandido y Compacto (AGENTS.md)
   ============================================================================== */
.app-sidebar {
  width: var(--sidebar-width-expanded);
  min-width: var(--sidebar-width-expanded);
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 40;
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  overflow: hidden;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--accent-primary);
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-text h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin: 0;
}

.sidebar-brand-subtitle {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Navegación Vertical */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-nav .nav-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
}

.sidebar-nav .nav-tab i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-nav .nav-tab:hover {
  background-color: rgba(100, 18, 213, 0.06);
  color: var(--text-primary);
}

.sidebar-nav .nav-tab.active {
  background-color: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 700;
  border-color: rgba(100, 18, 213, 0.2);
  box-shadow: 0 1px 3px rgba(100, 18, 213, 0.08);
}

.sidebar-nav .nav-tab.active i {
  color: var(--accent-primary);
}

/* Pie de la Barra Lateral */
.sidebar-footer {
  padding: 0.85rem 0.75rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex-shrink: 0;
}

.sidebar-expand-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-expand-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-primary);
}

.sidebar-user-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  line-height: 1.2;
}

.sidebar-user-name, .user-session-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role, .user-session-role {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Crédito Obligatorio en el pie de la barra lateral (AGENTS.md) */
.sidebar-credit {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  line-height: 1.3;
}

.sidebar-credit a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s;
}

.sidebar-credit a:hover {
  text-decoration: underline;
  color: var(--accent-primary-hover);
}

.sidebar-version {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: -0.25rem;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-logout-btn:hover {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border-color: var(--status-danger);
}

/* ==============================================================================
   ESTADO COMPACTO DE LA BARRA LATERAL (AGENTS.md)
   ============================================================================== */
.app-sidebar.compact {
  width: var(--sidebar-width-compact);
  min-width: var(--sidebar-width-compact);
  overflow-x: hidden;
}

.app-sidebar.compact .sidebar-brand-text {
  display: none !important;
}

.app-sidebar.compact .sidebar-header {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}

.app-sidebar.compact .sidebar-toggle-btn {
  display: none !important;
}

.app-sidebar.compact .sidebar-nav {
  padding: 0.85rem 0.5rem;
  overflow-x: hidden;
}

.app-sidebar.compact .nav-tab {
  justify-content: center;
  align-items: center;
  padding: 0.65rem 0;
  width: 100%;
  gap: 0;
  overflow: hidden;
  font-size: 0 !important;
}

.app-sidebar.compact .nav-tab i {
  font-size: 1.15rem !important;
  margin: 0 !important;
  width: auto;
}

.app-sidebar.compact .nav-tab-label {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-sidebar.compact .sidebar-expand-btn {
  display: flex !important;
}

.app-sidebar.compact .sidebar-expand-label {
  display: none !important;
}

.app-sidebar.compact .sidebar-user-block {
  justify-content: center;
  padding: 0.4rem;
  background: transparent;
  border-color: transparent;
}

.app-sidebar.compact .sidebar-user-info {
  display: none !important;
}

.app-sidebar.compact .sidebar-credit {
  display: none !important;
}

.app-sidebar.compact .sidebar-version {
  display: none !important;
}

.app-sidebar.compact .sidebar-logout-label {
  display: none !important;
}

.app-sidebar.compact .sidebar-logout-btn {
  padding: 0.55rem 0;
  justify-content: center;
}

/* Tooltip en estado compacto */
.app-sidebar.compact .nav-tab:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0B1C30;
  color: #FFFFFF;
  font-size: 0.78rem !important;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.15s ease-out;
}

.app-sidebar.compact .nav-tab:hover::before {
  content: '';
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #0B1C30;
  z-index: 1000;
  pointer-events: none;
}

/* ==============================================================================
   ÁREA DE CONTENIDO Y TOPBAR (AGENTS.md)
   ============================================================================== */
.app-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.btn-mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
}

.topbar-title-block {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.topbar-page-title {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.topbar-page-subtitle {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: blink-live-dot 0.9s infinite alternate ease-in-out;
  flex-shrink: 0;
}

.status-dot.syncing {
  background-color: #F59E0B;
  box-shadow: 0 0 8px #F59E0B;
  animation: blink-live-dot 0.5s infinite alternate ease-in-out;
}

.status-dot.offline {
  background-color: #EF4444;
  box-shadow: 0 0 6px #EF4444;
  animation: none;
}

@keyframes blink-live-dot {
  0% {
    opacity: 1;
    transform: scale(1.15);
    box-shadow: 0 0 10px #10B981, 0 0 3px #10B981;
  }
  100% {
    opacity: 0.25;
    transform: scale(0.7);
    box-shadow: 0 0 1px #10B981;
  }
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-primary);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.btn-test-sound {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.btn-test-sound:hover {
  background-color: var(--accent-light);
}

.volume-slider {
  width: 60px;
  height: 4px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Botón de Alternancia Modo Claro / Oscuro (TopBar) */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.75rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-theme-toggle:hover {
  background-color: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-theme-toggle:active {
  transform: translateY(0);
}

.btn-theme-toggle i {
  font-size: 0.88rem;
  transition: transform 0.3s ease, color 0.2s ease;
  color: var(--accent-primary);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .btn-mobile-toggle {
    display: flex;
  }
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px !important;
    min-width: 260px !important;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 28, 48, 0.45);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
  .hide-mobile {
    display: none !important;
  }
  .sidebar-toggle-btn {
    display: none;
  }
  .sidebar-expand-btn {
    display: none;
  }
}

/* ==============================================================================
   MAIN CONTAINER - 95% DE ANCHO CENTRADO EN TODAS LAS SECCIONES
   ============================================================================== */
.main-container {
  width: 95%;
  max-width: 95%;
  margin: 0 auto;
  padding: 1.25rem 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.tab-content {
  display: none !important;
  flex: 1;
  min-height: 0;
}

.tab-content.active {
  display: flex !important;
  flex-direction: column;
  animation: fadeIn 0.15s ease-in-out;
}

/* Permitir scroll en pestañas administrativas secundarias */
.tab-content:not(#tab-scanner).active {
  overflow-y: auto;
  padding-right: 0.4rem;
  display: block !important;
}

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

/* ==============================================================================
   KPI COMPACT STRIP (Diseñado para no ocupar espacio vertical)
   ============================================================================== */
.kpi-compact-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.kpi-chip {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.15s;
  min-height: 42px;
}

.kpi-chip:hover {
  border-color: var(--border-focus);
}

/* Unified Module & Card Icon Badges */
.card-icon-badge,
.dash-card-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 1px solid rgba(100, 18, 213, 0.12);
  transition: all 0.15s ease;
}

.card-icon-badge.badge-success {
  background: #ECFDF5;
  color: #059669;
  border-color: rgba(5, 150, 105, 0.18);
}

.card-icon-badge.badge-warning {
  background: #FFFBEB;
  color: #D97706;
  border-color: rgba(217, 119, 6, 0.18);
}

.card-icon-badge.badge-danger {
  background: #FEF2F2;
  color: #DC2626;
  border-color: rgba(220, 38, 38, 0.18);
}

.card-icon-badge.badge-info {
  background: #EFF6FF;
  color: #2563EB;
  border-color: rgba(37, 99, 235, 0.18);
}

.kpi-chip-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 1px solid rgba(100, 18, 213, 0.1);
  background-color: var(--accent-light);
  color: var(--accent-primary);
}

.kpi-chip-icon.blue { background-color: #EFF6FF; color: #2563EB; border-color: rgba(37, 99, 235, 0.15); }
.kpi-chip-icon.green { background-color: #ECFDF5; color: #059669; border-color: rgba(5, 150, 105, 0.15); }
.kpi-chip-icon.yellow { background-color: #FFFBEB; color: #D97706; border-color: rgba(217, 119, 6, 0.15); }
.kpi-chip-icon.purple { background-color: var(--accent-light); color: var(--accent-primary); border-color: rgba(100, 18, 213, 0.15); }
.kpi-chip-icon.amber { background-color: #FEF3C7; color: #B45309; border-color: rgba(180, 83, 9, 0.2); }
.kpi-chip-icon.cyan { background-color: var(--accent-light); color: var(--accent-primary); border-color: rgba(100, 18, 213, 0.15); }

.kpi-chip-envase {
  border-color: var(--border-color);
}

.kpi-chip-envase:hover {
  border-color: var(--accent-primary) !important;
  background-color: var(--accent-light-bg) !important;
}

.kpi-chip-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.kpi-chip-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.kpi-chip-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.1;
}

/* ==============================================================================
   TAB 1: SCANNER OPERATOR VIEW (100% VISIBLE EN PANTALLA)
   ============================================================================== */

#tab-scanner {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

#tab-scanner.active {
  display: flex !important;
}

#operatorScannerView {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

/* Barra de Entrada Compacta */
.scanner-compact-bar {
  background: var(--bg-card);
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(100, 18, 213, 0.12);
}

.scanner-badge-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.05em;
  background: var(--accent-light);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.scanner-pulse-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  animation: radar-pulse 1.5s infinite;
}

@keyframes radar-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 8px var(--accent-primary); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.barcode-compact-input {
  flex: 1;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 1.15rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 0.08em;
  outline: none;
  transition: all 0.15s;
}

.barcode-compact-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(100, 18, 213, 0.25);
}

.barcode-compact-input::placeholder {
  color: var(--text-muted);
  font-size: 0.92rem;
  letter-spacing: normal;
}

.btn-manual-scan-compact {
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-manual-scan-compact:hover {
  background-color: var(--accent-primary-hover);
}

.scanner-status-right {
  flex-shrink: 0;
}

/* Cuadrícula Principal de Escaneo (Dividida en 2 Columnas Ajustadas) */
.scanner-view-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .scanner-view-grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjeta Gigante de Última Caja Escaneada (Ajustada al 100% de la altura sin desbordes) */
.last-scan-hero-card {
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.65rem 0.95rem;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow-y: auto;
  transition: all 0.25s ease;
}

.last-scan-hero-card.success-flash {
  border-color: var(--status-success);
  box-shadow: var(--shadow-glow-success);
  animation: flash-green 0.5s ease-out;
}

.last-scan-hero-card.error-flash {
  border-color: var(--status-danger);
  box-shadow: var(--shadow-glow-danger);
  animation: flash-red 0.5s ease-out;
}

@keyframes flash-green {
  0% { background-color: rgba(16, 185, 129, 0.35); }
  100% { background-color: var(--bg-card); }
}

@keyframes flash-red {
  0% { background-color: rgba(239, 68, 68, 0.35); }
  100% { background-color: var(--bg-card); }
}

.last-scan-empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  margin: auto;
}

.last-scan-empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 0.35rem;
  opacity: 0.4;
  color: var(--accent-garlic);
}

.last-scan-empty-state h3 {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.last-scan-content {
  display: none;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
}

.last-scan-content.visible {
  display: flex !important;
}

.last-scan-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}

.scan-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.scan-status-badge.success {
  background-color: var(--status-success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.scan-status-badge.duplicate {
  background-color: var(--status-warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.scan-status-badge.error {
  background-color: var(--status-danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.scan-timestamp {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.employee-hero-name {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0.1rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-hero-code {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent-garlic);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0;
}

/* Frase Destacada de Acumulado de la Caja (Ej: Juan Pérez 10 cajas - 22/08/26) */
.hero-accum-statement {
  background: var(--accent-light);
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.scan-hero-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.6rem;
  margin-top: auto;
}

.hero-stat-item {
  text-align: center;
}

.hero-stat-label {
  font-size: 0.64rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.05rem;
  letter-spacing: 0.02em;
}

.hero-stat-value {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.hero-stat-value.highlight-green {
  color: #34d399;
}

.hero-stat-value.highlight-yellow {
  color: var(--accent-garlic);
}

/* Panel Lateral: Tabs y Acumulado por Empleado */
.side-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.card-header {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-card);
  color: var(--text-primary);
  flex-shrink: 0;
}

.side-tab-buttons {
  display: flex;
  gap: 0.25rem;
}

.btn-side-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-side-tab:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-side-tab.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.live-scans-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Filas de Acumulado de Empleados (Con Números Gigantes de Alta Visibilidad) */
.emp-accum-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
  gap: 0.75rem;
}

.emp-accum-item:hover {
  background-color: var(--bg-card-hover);
}

.emp-accum-item.has-boxes {
  background-color: rgba(56, 189, 248, 0.04);
}

.emp-accum-item.leader {
  background-color: rgba(245, 158, 11, 0.09);
  border-left: 4px solid #f59e0b;
}

.emp-accum-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.emp-accum-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.emp-accum-avatar.leader-avatar {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.emp-accum-name-line {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.emp-accum-meta-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

/* Contador Gigante de Cajas Acumuladas (Legible a distancia) */
.emp-accum-big-count {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.emp-accum-big-count .count-num {
  font-size: 1.75rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #34d399;
  line-height: 1;
  letter-spacing: -0.02em;
}

.emp-accum-big-count .count-unit {
  font-size: 0.78rem;
  font-weight: 800;
  color: #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.emp-accum-big-count.leader-badge {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.emp-accum-big-count.leader-badge .count-num {
  color: #fbbf24;
}

.emp-accum-big-count.leader-badge .count-unit {
  color: #fde68a;
}

.emp-accum-big-count.zero-badge {
  background: rgba(148, 163, 184, 0.08);
  border-color: #334155;
  padding: 0.25rem 0.65rem;
}

.emp-accum-big-count.zero-badge .count-num {
  color: #64748b;
  font-size: 1.25rem;
}

.emp-accum-big-count.zero-badge .count-unit {
  color: #64748b;
}

.scan-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.scan-log-item:hover {
  background-color: var(--bg-card-hover);
}

.scan-log-item:first-child {
  background-color: rgba(56, 189, 248, 0.08);
  border-left: 3px solid #38bdf8;
}

.log-emp-info {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.emp-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.log-emp-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.1;
}

.log-emp-code {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.log-meta-info {
  text-align: right;
  flex-shrink: 0;
}

.log-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  line-height: 1;
}

.log-price-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #34d399;
  font-family: var(--font-mono);
  margin-bottom: 0.15rem;
}

/* ==============================================================================
   TAB 2: EMPLOYEE MANAGEMENT & BARCODE STICKER GENERATOR
   ============================================================================== */

.section-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-input-wrapper {
  position: relative;
  min-width: 280px;
}

.search-input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-primary);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}

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

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-success {
  background-color: #059669;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-success:hover {
  background-color: #047857;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-card);
}

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

.data-table th {
  background-color: var(--bg-secondary);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background-color: var(--bg-card-hover);
}

.badge-active {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--status-success-bg);
  color: #34d399;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-inactive {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--status-danger-bg);
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Printable Barcode Label Card */
.barcode-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}


/* ==============================================================================
   TAB 3: RECURSOS HUMANOS & LIQUIDACIÓN DE PAGO A DESTAJO
   ============================================================================== */

.filter-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
}

.filter-select, .filter-date {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
}

.filter-select:focus, .filter-date:focus {
  border-color: var(--accent-primary);
}

.payroll-summary-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.payroll-banner-info h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.payroll-banner-info p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.payroll-banner-total {
  text-align: right;
}

.payroll-banner-total .amount {
  font-size: 2.25rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

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

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

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

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-primary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast-msg {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.2s ease-out;
}

.toast-msg.success { border-left-color: var(--status-success); }
.toast-msg.error { border-left-color: var(--status-danger); }
.toast-msg.warning { border-left-color: var(--status-warning); }

/* ==============================================================================
   ESTILOS DE LA VISTA EJECUTIVA (TABLERO MÓVIL Y EJECUTIVO)
   ============================================================================== */
.executive-dashboard-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.25rem 0 1.5rem;
}

.exec-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.exec-hero-card::before {
  display: none;
}

.exec-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.exec-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--status-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--status-success);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.exec-live-badge .pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--status-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--status-success);
  animation: pulseLight 1.5s infinite;
}

.exec-date-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: capitalize;
}

.exec-hero-body {
  padding: 0.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.exec-hero-number {
  font-size: clamp(3.2rem, 10vw, 4.5rem);
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1;
  color: var(--accent-primary);
  margin-bottom: 0.35rem;
  text-align: center;
}

.exec-hero-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

/* Barra de Calidad Minimalista */
.exec-quality-bar-wrap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.exec-quality-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.exec-quality-progress {
  height: 8px;
  background: rgba(245, 158, 11, 0.2);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.exec-quality-fill {
  height: 100%;
  background: linear-gradient(90deg, #6412D5, #7C3AED);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

/* Mini Cards Grid (2x2) */
.exec-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.exec-mini-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.exec-mini-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.exec-mini-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.exec-mini-icon.speed { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.exec-mini-icon.users { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.exec-mini-icon.trophy { background: rgba(250, 204, 21, 0.15); color: #fde047; }
.exec-mini-icon.clock { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.exec-mini-data {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.exec-mini-val {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
}

.exec-mini-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Sección de Lista de Rendimiento por Empleado */
.exec-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.exec-section-header {
  padding: 0.85rem 1.15rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exec-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
}

.exec-section-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.exec-emp-list {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  gap: 0.4rem;
}

.exec-emp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  transition: all 0.15s ease;
}

.exec-emp-item.has-boxes {
  border-left: 3.5px solid var(--accent-primary);
}

.exec-emp-item.leader-item {
  border: 1.5px solid rgba(250, 204, 21, 0.45);
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.06) 0%, var(--bg-primary) 100%);
}

.exec-emp-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.exec-rank-badge {
  font-size: 0.85rem;
  font-weight: 800;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.exec-emp-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.exec-emp-avatar.leader-avatar {
  background: rgba(250, 204, 21, 0.25);
  color: #fde047;
  border: 1.5px solid #fde047;
}

.exec-emp-details {
  min-width: 0;
  flex: 1;
}

.exec-emp-name-line {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.exec-emp-meta-line {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.exec-emp-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  margin-top: 0.35rem;
  overflow: hidden;
}

.exec-emp-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 9999px;
}

.exec-emp-count-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.75rem;
  min-width: 75px;
  text-align: right;
  flex-shrink: 0;
}

.exec-emp-count-box.active {
  background: var(--status-success-bg);
  border-color: var(--status-success);
}

.exec-emp-count-box.active .exec-count-num {
  color: var(--status-success);
}

.exec-emp-count-box.leader-count {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.5);
}

.exec-count-num {
  font-size: 1.35rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.exec-count-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}

.exec-emp-count-box.active .exec-count-num { color: #34d399; }
.exec-emp-count-box.leader-count .exec-count-num { color: #fde047; }

/* ==============================================================================
   RESPONSIVE DESIGN FOR SMARTPHONES & TABLETS (EJECUTIVOS & MÓVILES)
   ============================================================================== */
@media (max-width: 768px) {
  html, body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    width: 100% !important;
    max-width: 100vw !important;
    position: relative !important;
  }

  .app-header {
    height: auto !important;
    padding: 0.5rem 0.65rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .header-container {
    flex-direction: column !important;
    gap: 0.4rem !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .brand-section {
    justify-content: space-between !important;
    width: 100% !important;
  }

  .nav-tabs {
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding-bottom: 0.25rem !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .nav-tab {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.78rem !important;
    flex-shrink: 0 !important;
  }

  .header-actions {
    justify-content: space-between !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
  }

  .connection-status {
    font-size: 0.68rem !important;
    padding: 0.2rem 0.5rem !important;
  }

  .user-session-chip {
    padding: 0.2rem 0.5rem !important;
  }

  .user-session-name {
    font-size: 0.72rem !important;
    max-width: 110px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .user-session-role {
    font-size: 0.6rem !important;
    padding: 0.05rem 0.3rem !important;
  }

  .main-container {
    padding: 0.5rem 0.5rem 4rem 0.5rem !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    height: auto !important;
    max-height: none !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .tab-content,
  #tab-scanner {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    display: none;
  }

  .tab-content.active,
  #tab-scanner.active {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  /* Vista Ejecutiva en Móvil */
  .executive-dashboard-view {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 0 3rem 0 !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
  }

  .exec-hero-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 1.1rem 0.85rem 0.9rem !important;
    border-radius: var(--radius-lg) !important;
    text-align: center !important;
  }

  .exec-hero-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.35rem 0 0.65rem !important;
  }

  .exec-hero-number {
    font-size: clamp(3rem, 12vw, 4rem) !important;
    width: 100% !important;
    text-align: center !important;
  }

  .exec-hero-label {
    font-size: 0.78rem !important;
    letter-spacing: 0.08em !important;
    text-align: center !important;
    width: 100% !important;
  }

  .exec-quality-bar-wrap {
    padding: 0.5rem 0.75rem !important;
  }

  .exec-quality-labels {
    font-size: 0.72rem !important;
  }

  .exec-metrics-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .exec-mini-card {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.65rem 0.6rem !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
  }

  .exec-mini-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.95rem !important;
    flex-shrink: 0 !important;
  }

  .exec-mini-data {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .exec-mini-val {
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .exec-mini-title {
    font-size: 0.62rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .exec-section-card {
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-lg) !important;
  }

  .exec-section-header {
    padding: 0.7rem 0.85rem !important;
  }

  .exec-section-title {
    font-size: 0.85rem !important;
  }

  .exec-emp-list {
    padding: 0.4rem !important;
    gap: 0.35rem !important;
  }

  .exec-emp-item {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.65rem 0.65rem !important;
    gap: 0.45rem !important;
  }

  .exec-emp-left {
    min-width: 0 !important;
    flex: 1 !important;
    gap: 0.5rem !important;
  }

  .exec-emp-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.8rem !important;
  }

  .exec-emp-details {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .exec-emp-name-line {
    font-size: 0.85rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .exec-emp-meta-line {
    font-size: 0.68rem !important;
    flex-wrap: wrap !important;
    gap: 0.25rem !important;
  }

  .exec-emp-count-box {
    min-width: 58px !important;
    padding: 0.25rem 0.45rem !important;
    flex-shrink: 0 !important;
  }

  .exec-count-num {
    font-size: 1.15rem !important;
  }

  .kpi-compact-strip {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    display: flex;
  }

  .kpi-chip {
    flex-shrink: 0;
    min-width: 130px;
  }

  .scanner-view-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .last-scan-hero-card {
    height: auto;
    min-height: 250px;
  }

  .side-card {
    height: 400px;
  }

  .production-metrics-grid {
    grid-template-columns: 1fr !important;
  }

  .payroll-summary-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==============================================================================
   AUTHENTICATION & SECURITY MODAL (LOGIN & ROLES)
   ============================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 28, 48, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.3s ease;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px -10px rgba(11, 28, 48, 0.15), 0 0 20px rgba(100, 18, 213, 0.08);
  animation: authScaleUp 0.3s ease-out;
}

@keyframes authScaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo {
  width: 58px;
  height: 58px;
  font-size: 1.75rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.auth-brand h2 {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.auth-brand p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  padding-right: 2.75rem !important;
  width: 100%;
}

.btn-toggle-eye {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.15s;
}

.btn-toggle-eye:hover {
  color: #38bdf8;
}

.auth-submit-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 800;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-error-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: shakeError 0.4s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.auth-footer-hint {
  text-align: center;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* User Session Header Chip */
.user-session-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem 0.25rem 0.4rem;
  border-radius: var(--radius-full);
}

.user-session-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.user-session-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-session-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-session-role {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-admin, .role-badge.role-admin {
  color: #6412D5;
  background: #ECE6FA;
  border: 1px solid rgba(100, 18, 213, 0.22);
}

.role-ejecutivo, .role-badge.role-ejecutivo {
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
}

.role-rrhh, .role-badge.role-rrhh {
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
}

.role-usuario, .role-badge.role-usuario {
  color: #475569;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
}

/* Status Chip */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-chip.active {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.status-chip.active .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
}

.status-chip.inactive {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.status-chip.inactive .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #EF4444;
}

/* Modern Action Buttons in Tables */
.btn-action-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.88rem;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.btn-action-sm:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-action-sm.btn-edit-user {
  color: var(--accent-primary);
  background: var(--accent-light);
  border-color: rgba(100, 18, 213, 0.2);
}

.btn-action-sm.btn-edit-user:hover {
  background: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
}

.btn-action-sm.btn-warn {
  color: #D97706;
  background: #FFFBEB;
  border-color: #FDE68A;
}

.btn-action-sm.btn-warn:hover {
  background: #D97706;
  color: #FFFFFF;
  border-color: #D97706;
}

.btn-action-sm.btn-ok {
  color: #059669;
  background: #ECFDF5;
  border-color: #A7F3D0;
}

.btn-action-sm.btn-ok:hover {
  background: #059669;
  color: #FFFFFF;
  border-color: #059669;
}

.btn-action-sm.btn-delete-user {
  color: #DC2626 !important;
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
}

.btn-action-sm.btn-delete-user:hover {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border-color: #DC2626 !important;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.btn-logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
}

/* ==============================================================================
   PRINT STYLESHEET FOR PAYROLL SLIPS & BARCODE LABELS
   ============================================================================== */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }
  
  .app-header, .nav-tabs, .header-actions, .scanner-input-container,
  .section-actions-bar, .filter-bar, .modal-backdrop, .btn-print-single,
  .audio-controls, .connection-status, .toast-container, .btn-primary,
  .btn-secondary, .btn-success {
    display: none !important;
  }
  
  .main-container {
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .tab-content {
    display: block !important;
  }
}
  
/* ==============================================================================
   PWA FLOATING INSTALL BUTTON (DESKTOP & MOBILE)
   ============================================================================== */
.pwa-floating-install-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  animation: floatBounce 3s infinite ease-in-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.btn-pwa-floating {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #FFFFFF;
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem 0.5rem 0.6rem;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.btn-pwa-floating:hover {
  border-color: var(--accent-primary-hover);
  box-shadow: 0 10px 25px rgba(100, 18, 213, 0.2);
  transform: scale(1.03);
}

.pwa-floating-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent-primary);
  flex-shrink: 0;
}

.pwa-floating-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.1;
}

.pwa-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.pwa-sub {
  font-size: 0.65rem;
  color: var(--accent-primary);
  font-weight: 700;
  text-transform: uppercase;
}

.pwa-icon-download {
  font-size: 0.9rem;
  color: var(--accent-primary);
  margin-left: 0.25rem;
  animation: pulseLight 2s infinite;
}

.btn-pwa-dismiss {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pwa-dismiss:hover {
  color: #ef4444;
  background: #fee2e2;
  border-color: #ef4444;
}

@media (max-width: 768px) {
  .pwa-floating-install-container {
    bottom: 1rem;
    right: 1rem;
  }
  .btn-pwa-floating {
    padding: 0.45rem 0.85rem 0.45rem 0.5rem;
  }
  .pwa-floating-logo {
    width: 28px;
    height: 28px;
  }
}

/* ==============================================================================
   BARRA HORIZONTAL COMPACTA DE ENVASES EN PRODUCCIÓN (PANTALLA PRINCIPAL)
   1 sola línea horizontal, ultra clara para el operador
   ============================================================================== */
.active-packing-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.95rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.packing-strip-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.packing-strip-items {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.packing-strip-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.packing-strip-badge.badge-primera {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #059669;
}

.packing-strip-badge.badge-primera strong {
  color: var(--text-primary);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.packing-strip-badge.badge-segunda {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.packing-strip-badge.badge-segunda strong {
  color: var(--text-primary);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.btn-goto-config-packing {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-goto-config-packing:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ==============================================================================
   CONFIGURACIÓN DE ENVASE DE JORNADA (PESTAÑA CONFIGURACIÓN - 1 LÍNEA HORIZONTAL)
   ============================================================================== */
.packing-config-horizontal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.config-h-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 800;
  white-space: nowrap;
}

.config-h-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.config-h-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.config-h-select {
  width: auto !important;
  min-width: 175px;
  padding: 0.4rem 0.85rem !important;
  font-size: 0.88rem !important;
  font-weight: 800 !important;
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.config-h-select:focus {
  outline: none;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(100, 18, 213, 0.12) !important;
}

/* ==============================================================================
   CARTEL MODAL DE ALERTA: CORRELATIVO DUPLICADO (ALTO IMPACTO VISUAL)
   ============================================================================== */
.duplicate-alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(11, 28, 48, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeInModal 0.15s ease-out;
}

.duplicate-alert-dialog {
  background: var(--bg-card);
  border: 2px solid #ef4444;
  border-radius: var(--radius-xl);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popAlert 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popAlert {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.duplicate-alert-header {
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  padding: 1.5rem 1.5rem 1.2rem;
  text-align: center;
}

.duplicate-alert-icon-wrap {
  width: 64px;
  height: 64px;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  color: #ef4444;
  font-size: 2rem;
  animation: pulseIcon 1.2s infinite;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.duplicate-alert-header h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #ef4444;
  margin: 0 0 0.35rem;
  letter-spacing: 0.03em;
}

.duplicate-alert-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.duplicate-alert-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.duplicate-correlativo-highlight {
  background: rgba(239, 68, 68, 0.08);
  border: 1px dashed rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  text-align: center;
}

.duplicate-correlativo-highlight .dup-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.duplicate-correlativo-highlight .dup-number {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ef4444;
  letter-spacing: 0.05em;
}

.duplicate-details-grid {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.dup-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border-color);
}

.dup-detail-item:last-child {
  border-bottom: none;
}

.dup-detail-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.dup-detail-val {
  color: var(--text-primary);
  font-weight: 700;
  font-family: var(--font-mono);
}

.dup-detail-val.highlight {
  color: var(--accent-primary);
  font-family: inherit;
}

.duplicate-warning-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #b91c1c;
  font-size: 0.85rem;
  line-height: 1.4;
}

.duplicate-warning-box i {
  font-size: 1.4rem;
  color: #ef4444;
  flex-shrink: 0;
}

.duplicate-alert-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
}

.btn-ack-duplicate {
  width: 100%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
}

.btn-ack-duplicate:hover,
.btn-ack-duplicate:focus {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  outline: none;
}

/* ==============================================================================
   BOTÓN Y MODAL DE ESCANEO POR CÁMARA (OPTIMIZADO PARA CELULAR)
   ============================================================================== */
.btn-camera-scan-compact {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-camera-scan-compact:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.camera-scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 28, 48, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  animation: fadeIn 0.15s ease-out;
}

.camera-scanner-dialog {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.camera-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.camera-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.camera-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-camera-ctrl {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-camera-ctrl:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-camera-close {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-camera-close:hover {
  background: #ef4444;
  color: #ffffff;
}

.camera-scanner-body {
  position: relative;
  width: 100%;
  height: 320px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.camera-video-viewport {
  width: 100% !important;
  height: 100% !important;
}

.camera-video-viewport video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.camera-targeting-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 55%;
  pointer-events: none;
  box-sizing: border-box;
}

.laser-scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, #6412D5, #7C3AED, transparent);
  box-shadow: 0 0 12px #6412D5, 0 0 4px #7C3AED;
  animation: laserScanAnim 2s infinite ease-in-out;
}

@keyframes laserScanAnim {
  0% { top: 5%; opacity: 0.9; }
  50% { top: 92%; opacity: 1; }
  100% { top: 5%; opacity: 0.9; }
}

.corner-bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--accent-primary);
  border-style: solid;
}

.corner-bracket.top-left { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 4px; }
.corner-bracket.top-right { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 4px; }
.corner-bracket.bottom-left { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 4px; }
.corner-bracket.bottom-right { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 4px; }

.camera-scan-feedback {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.92);
  color: #ffffff;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  animation: popIn 0.2s ease-out;
  white-space: nowrap;
  z-index: 10;
}

.camera-scanner-footer {
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.camera-tip {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.camera-footer-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.camera-continuous-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
}

.camera-continuous-toggle input[type="checkbox"] {
  accent-color: #38bdf8;
  width: 16px;
  height: 16px;
}

/* ==============================================================================
   SECCIÓN TABLERO / DASHBOARD DE ESTADÍSTICAS Y PICKING (DISEÑO MODERNO)
   ============================================================================== */
#tab-dashboard {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0 2.5rem 0;
}

.dash-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.dash-header-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dash-title-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md, 8px);
  background: var(--accent-light);
  border: 1px solid var(--border-color);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dash-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.dash-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Tarjeta de Filtros */
.dash-filters-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  overflow: visible !important;
  position: relative !important;
}

.dash-filters-card:hover {
  border-color: var(--accent-primary);
}

.dash-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.dash-filters-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.dash-filters-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-light);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1px solid rgba(100, 18, 213, 0.2);
}

.dash-filters-row-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.85rem;
}

.dash-filters-row-main .dash-filter-item {
  flex: 1 1 180px;
  min-width: 155px;
}

.dash-filters-row-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.dash-search-wrap {
  flex: 1;
  min-width: 250px;
  position: relative;
  display: flex;
  align-items: center;
}

.dash-search-icon {
  position: absolute;
  left: 0.85rem;
  color: #64748b;
  pointer-events: none;
  font-size: 0.9rem;
}

.dash-search-input-field {
  padding-left: 2.3rem !important;
  height: 38px !important;
  font-size: 0.85rem !important;
  width: 100% !important;
}

.dash-btn-reset-filters {
  height: 38px !important;
  padding: 0 1rem !important;
  white-space: nowrap !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.dash-btn-reset-filters:hover {
  background: var(--accent-light) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
}

.dash-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  align-items: flex-end;
  width: 100%;
}

.dash-filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.dash-filter-search {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .dash-filter-search {
    grid-column: span 1;
  }
}

.dash-filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.dash-input {
  width: 100% !important;
  max-width: 100% !important;
  height: 38px !important;
  box-sizing: border-box !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm, 6px) !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  padding: 0.45rem 0.75rem !important;
  transition: all 0.2s ease;
  display: block !important;
}

.dash-input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(100, 18, 213, 0.12) !important;
  outline: none;
}

select.dash-input {
  cursor: pointer;
}

.dash-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Multi-Select Dropdowns para el Dashboard */
.dash-multiselect-wrap {
  position: relative;
  width: 100%;
}

.dash-multiselect-btn {
  width: 100% !important;
  height: 38px !important;
  box-sizing: border-box !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm, 6px) !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  padding: 0.45rem 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.5rem;
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition: all 0.2s ease;
}

.dash-multiselect-btn:hover,
.dash-multiselect-btn.open {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(100, 18, 213, 0.12) !important;
}

.dash-multiselect-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.dash-multiselect-chevron {
  font-size: 0.75rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.dash-multiselect-btn.open .dash-multiselect-chevron {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

.dash-multiselect-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  min-width: 250px;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  padding: 0.6rem;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}

.dash-multiselect-dropdown.open {
  display: flex;
}

.dash-multiselect-search-box {
  position: relative;
  width: 100%;
}

.dash-multiselect-search-box i {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.8rem;
  pointer-events: none;
}

.dash-multiselect-search-input {
  width: 100% !important;
  box-sizing: border-box !important;
  height: 32px !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  color: var(--text-primary) !important;
  padding: 0.25rem 0.65rem 0.25rem 1.85rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
}

.dash-multiselect-search-input:focus {
  border-color: var(--accent-primary) !important;
  outline: none;
}

.dash-multiselect-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
}

.dash-multiselect-action-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.dash-multiselect-action-btn:hover {
  background: var(--accent-light);
  color: var(--accent-primary-hover);
}

.dash-multiselect-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-right: 0.2rem;
}

.dash-multiselect-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-primary);
  transition: background 0.15s ease;
  user-select: none;
}

.dash-multiselect-item:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.dash-multiselect-item input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
  margin: 0;
}

.dash-multiselect-item-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent-primary);
  white-space: nowrap;
}

/* Grid de KPIs */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
  width: 100%;
}

.dash-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: dashCardPop 0.4s ease backwards;
}

@keyframes dashCardPop {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.dash-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.dash-kpi-card.blue:hover { border-color: rgba(59, 130, 246, 0.5); }
.dash-kpi-card.cyan:hover { border-color: rgba(56, 189, 248, 0.5); }
.dash-kpi-card.green:hover { border-color: rgba(52, 211, 153, 0.5); }
.dash-kpi-card.amber:hover { border-color: rgba(245, 158, 11, 0.5); }
.dash-kpi-card.purple:hover { border-color: var(--accent-primary); }
.dash-kpi-card.gold:hover { border-color: rgba(250, 204, 21, 0.6); }
.dash-kpi-card.violet:hover { border-color: var(--accent-primary); }
.dash-kpi-card.orange:hover { border-color: rgba(249, 115, 22, 0.6); }

.dash-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.dash-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 1px solid rgba(100, 18, 213, 0.12);
  background: var(--accent-light);
  color: var(--accent-primary);
}

.dash-kpi-card.blue .dash-kpi-icon { background: #EFF6FF; color: #2563EB; border-color: rgba(37, 99, 235, 0.18); }
.dash-kpi-card.cyan .dash-kpi-icon { background: #ECFDF5; color: #059669; border-color: rgba(5, 150, 105, 0.18); }
.dash-kpi-card.green .dash-kpi-icon { background: #ECFDF5; color: #047857; border-color: rgba(4, 120, 87, 0.18); }
.dash-kpi-card.amber .dash-kpi-icon { background: #FFFBEB; color: #D97706; border-color: rgba(217, 119, 6, 0.18); }
.dash-kpi-card.purple .dash-kpi-icon { background: var(--accent-light); color: var(--accent-primary); border-color: rgba(100, 18, 213, 0.18); }
.dash-kpi-card.gold .dash-kpi-icon { background: #FEF3C7; color: #B45309; border-color: rgba(180, 83, 9, 0.22); }
.dash-kpi-card.violet .dash-kpi-icon { background: var(--accent-light); color: var(--accent-primary); border-color: rgba(100, 18, 213, 0.18); }
.dash-kpi-card.orange .dash-kpi-icon { background: #FEF2F2; color: #DC2626; border-color: rgba(220, 38, 38, 0.18); }

.dash-kpi-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.dash-kpi-value {
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.1;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.dash-kpi-leader {
  font-size: 1.25rem !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--accent-primary);
}

.dash-kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dash-pill-pct {
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.dash-pill-pct.cyan { background: rgba(56, 189, 248, 0.15); color: #0284c7; }
.dash-pill-pct.green { background: rgba(52, 211, 153, 0.15); color: #059669; }
.dash-pill-pct.violet { background: var(--accent-light); color: var(--accent-primary); }
.dash-pill-pct.orange { background: rgba(249, 115, 22, 0.15); color: #ea580c; }

/* Grid de Análisis */
.dash-analytics-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .dash-analytics-grid {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.dash-card:hover {
  border-color: var(--accent-primary);
}

.dash-card-header {
  padding: 0.9rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dash-card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.dash-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-primary);
  background: var(--accent-light);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1px solid rgba(100, 18, 213, 0.15);
}

.dash-card-body {
  padding: 1.25rem;
}

/* Matriz Calidad × Envase */
.dash-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem;
}

.dash-matrix-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.dash-matrix-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.dash-matrix-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.dash-matrix-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.dash-matrix-tag.primera { background: rgba(16, 185, 129, 0.15); color: #059669; }
.dash-matrix-tag.segunda { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.dash-matrix-tag.arana { background: var(--accent-light); color: var(--accent-primary); }
.dash-matrix-tag.descarte { background: rgba(249, 115, 22, 0.15); color: #ea580c; }

.dash-matrix-count {
  font-size: 1.5rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.dash-matrix-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.dash-matrix-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.dash-matrix-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-matrix-bar-fill.primera { background: linear-gradient(90deg, #059669, #10b981); }
.dash-matrix-bar-fill.segunda { background: linear-gradient(90deg, #d97706, #f59e0b); }
.dash-matrix-bar-fill.arana { background: linear-gradient(90deg, #6412D5, #7C3AED); }
.dash-matrix-bar-fill.descarte { background: linear-gradient(90deg, #ea580c, #fb923c); }

/* Lista de Turnos */
.dash-shift-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dash-shift-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}

.dash-shift-item:hover {
  border-color: var(--accent-primary);
}

.dash-shift-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-shift-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border: 1px solid rgba(100, 18, 213, 0.12);
}

.dash-shift-icon.manana { background: #FFFBEB; color: #D97706; border-color: rgba(217, 119, 6, 0.18); }
.dash-shift-icon.tarde { background: #FEF3C7; color: #B45309; border-color: rgba(180, 83, 9, 0.22); }
.dash-shift-icon.noche { background: var(--accent-light); color: var(--accent-primary); border-color: rgba(100, 18, 213, 0.18); }

.dash-shift-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
}

.dash-shift-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dash-shift-right {
  text-align: right;
}

.dash-shift-val {
  font-size: 1.25rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.dash-shift-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
}

/* Gráfico de Picking Horario */
.dash-hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 180px;
  padding-top: 1.5rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.dash-hourly-col {
  flex: 1;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  height: 100%;
  justify-content: flex-end;
}

.dash-hourly-bar-container {
  width: 100%;
  max-width: 38px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.dash-hourly-bar {
  width: 100%;
  background: linear-gradient(180deg, #7C3AED 0%, rgba(100, 18, 213, 0.35) 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
  min-height: 4px;
  cursor: pointer;
  position: relative;
}

.dash-hourly-bar:hover {
  background: linear-gradient(180deg, #6412D5 0%, #4A0D9E 100%);
  box-shadow: 0 0 12px rgba(100, 18, 213, 0.4);
}

.dash-hourly-tooltip {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0B1C30;
  color: #ffffff;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 1px solid var(--accent-primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.dash-hourly-bar:hover .dash-hourly-tooltip {
  opacity: 1;
}

.dash-hourly-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Tabla de Ranking */
.dash-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 900;
}

.dash-rank-badge.top-1 { background: rgba(250, 204, 21, 0.2); color: #ca8a04; border: 1px solid rgba(250, 204, 21, 0.5); }
.dash-rank-badge.top-2 { background: rgba(100, 116, 139, 0.15); color: #475569; border: 1px solid rgba(100, 116, 139, 0.3); }
.dash-rank-badge.top-3 { background: rgba(217, 119, 6, 0.15); color: #b45309; border: 1px solid rgba(217, 119, 6, 0.3); }
.dash-rank-badge.standard { color: var(--text-secondary); font-size: 0.8rem; font-weight: 800; }

.dash-plant-share-bar {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.3rem;
}

.dash-plant-share-fill {
  height: 100%;
  background: linear-gradient(90deg, #6412D5, #7C3AED);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.dash-envase-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  margin: 0.1rem 0.15rem;
  white-space: nowrap;
}

/* ==============================================================================
   TEMA OSCURO / DARK THEME (DISEÑO PROFESIONAL, ELEGANTE Y DE ALTO CONTRASTE)
   ============================================================================== */
[data-theme="dark"],
body.dark-theme {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-sidebar: #131E35;
  --bg-card: #1E293B;
  --bg-card-hover: #27354D;
  --bg-input: #152238;
  
  --border-color: #334155;
  --border-focus: #A855F7;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --accent-garlic: #A855F7;
  --accent-garlic-dark: #7E22CE;
  --accent-primary: #A855F7;
  --accent-primary-hover: #C084FC;
  --accent-light: #2E1B4E;
  --accent-light-bg: #24143D;
  
  --status-success: #34D399;
  --status-success-bg: rgba(52, 211, 153, 0.16);
  --status-warning: #FBBF24;
  --status-warning-bg: rgba(251, 191, 36, 0.16);
  --status-danger: #F87171;
  --status-danger-bg: rgba(248, 113, 113, 0.16);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

/* Botón de Modo Oscuro en Topbar */
[data-theme="dark"] .btn-theme-toggle {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: #F8FAFC;
}

[data-theme="dark"] .btn-theme-toggle:hover {
  background-color: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

[data-theme="dark"] .btn-theme-toggle i {
  color: #FBBF24; /* Sol amarillo dorado */
}

/* Ajustes Específicos de Estructura y Navegación en Modo Oscuro */
[data-theme="dark"] .app-topbar {
  background: var(--bg-sidebar);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .app-sidebar {
  background-color: var(--bg-sidebar);
  border-right-color: var(--border-color);
}

[data-theme="dark"] .sidebar-header {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .sidebar-footer {
  background-color: var(--bg-sidebar);
  border-top-color: var(--border-color);
}

[data-theme="dark"] .sidebar-user-block {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .sidebar-brand-text h2,
[data-theme="dark"] .topbar-page-title,
[data-theme="dark"] .user-name {
  color: var(--text-primary);
}

[data-theme="dark"] .sidebar-toggle-btn,
[data-theme="dark"] .btn-mobile-toggle,
[data-theme="dark"] .sidebar-logout-btn,
[data-theme="dark"] .sidebar-expand-btn {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-toggle-btn:hover,
[data-theme="dark"] .btn-mobile-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

[data-theme="dark"] .sidebar-nav .nav-tab {
  color: var(--text-secondary);
}

[data-theme="dark"] .sidebar-nav .nav-tab:hover {
  background-color: rgba(168, 85, 247, 0.12);
  color: var(--text-primary);
}

[data-theme="dark"] .sidebar-nav .nav-tab.active {
  background-color: var(--accent-light);
  color: var(--accent-primary);
  border-color: rgba(168, 85, 247, 0.35);
}

/* Barra Compacta y Escáner */
[data-theme="dark"] .scanner-compact-bar {
  background: var(--bg-card);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .barcode-compact-input {
  background-color: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .barcode-compact-input::placeholder {
  color: var(--text-muted);
}

[data-theme="dark"] .kpi-chip {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .kpi-chip-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .kpi-chip-value {
  color: var(--text-primary);
}

/* Tarjetas y Modales */
[data-theme="dark"] .scanner-side-card,
[data-theme="dark"] .last-scan-hero-card,
[data-theme="dark"] .card,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .dash-filter-card,
[data-theme="dark"] .dash-kpi-card,
[data-theme="dark"] .dash-chart-card,
[data-theme="dark"] .packing-config-horizontal-card,
[data-theme="dark"] .active-packing-strip {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .card-header {
  border-bottom-color: var(--border-color);
}

/* Insignias de Módulo */
[data-theme="dark"] .card-icon-badge,
[data-theme="dark"] .dash-card-icon-badge {
  background: var(--accent-light-bg);
  color: var(--accent-primary);
  border-color: rgba(168, 85, 247, 0.25);
}

[data-theme="dark"] .card-icon-badge.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

[data-theme="dark"] .card-icon-badge.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}

[data-theme="dark"] .card-icon-badge.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
}

[data-theme="dark"] .card-icon-badge.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
}

/* Tablas y Controles */
[data-theme="dark"] .data-table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .data-table td {
  border-bottom-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .data-table tr:hover {
  background-color: var(--bg-card-hover);
}

[data-theme="dark"] .table-responsive {
  border-color: var(--border-color);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

[data-theme="dark"] .connection-status,
[data-theme="dark"] .audio-controls {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-test-sound {
  color: var(--accent-primary);
}

[data-theme="dark"] .btn-test-sound:hover {
  background-color: var(--accent-light);
}

[data-theme="dark"] .emp-accum-item {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .emp-accum-item:hover {
  background-color: var(--bg-card-hover);
}

[data-theme="dark"] .emp-accum-total-badge {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-action-sm {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-action-sm:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

[data-theme="dark"] .dash-multiselect-dropdown {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .dash-multiselect-item:hover {
  background-color: var(--bg-card-hover);
}

[data-theme="dark"] .hero-accum-statement {
  background-color: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

[data-theme="dark"] .hero-accum-statement * {
  color: inherit;
}

[data-theme="dark"] .active-packing-item {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .scan-hero-stats-row {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

/* Scrollbars para Dark Mode */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg-sidebar);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}


