/* ==========================================================================
   PañolPro 2026 - Modern Responsive Stylesheet
   Mobile-First & Desktop High Density
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema Oscuro (Predeterminado) */
  --bg-main: #0B1120;
  --bg-card: #151F32;
  --bg-card-hover: #1C2B44;
  --bg-input: #1D2A42;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3B82F6;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dimmed: #64748B;

  --color-blue: #3B82F6;
  --color-green: #10B981;
  --color-amber: #F59E0B;
  --color-orange: #EA580C;
  --color-red: #EF4444;
  --color-purple: #8B5CF6;

  --sidebar-width: 250px;
  --header-height: 56px;
  --bottom-nav-height: 62px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
}

body.light-theme {
  --bg-main: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-input: #FFFFFF;
  --border-color: #E2E8F0;
  --border-focus: #2563EB;

  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dimmed: #94A3B8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
}

/* ================= TEMA LIQUID GLASS (APPLE VISIONOS / MACOS GLASSMORPHISM) ================= */
body.glass-theme {
  --bg-main: #070B14;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.10);
  --bg-input: rgba(255, 255, 255, 0.07);
  --border-color: rgba(255, 255, 255, 0.14);
  --border-focus: #A78BFA;

  --text-main: #FFFFFF;
  --text-muted: #CBD5E1;
  --text-dimmed: #94A3B8;

  --color-blue: #60A5FA;
  --color-green: #34D399;
  --color-amber: #FBBF24;
  --color-orange: #FB923C;
  --color-red: #F87171;
  --color-purple: #C084FC;

  --shadow-sm: 0 4px 16px 0 rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  --shadow-md: 0 12px 40px 0 rgba(0, 0, 0, 0.45), inset 0 1px 1.5px rgba(255, 255, 255, 0.2);
}

/* Fondo dinámico Liquid Glass con orbes iridiscentes bioluminiscentes */
body.glass-theme::before,
body.glass-theme::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.5;
  animation: liquidOrbFloat 18s ease-in-out infinite alternate;
}

body.glass-theme::before {
  top: -12%;
  left: 8%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.38) 0%, rgba(59, 130, 246, 0.18) 70%, transparent 100%);
}

body.glass-theme::after {
  bottom: -15%;
  right: 5%;
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.32) 0%, rgba(168, 85, 247, 0.22) 70%, transparent 100%);
  animation-duration: 24s;
  animation-direction: alternate-reverse;
}

@keyframes liquidOrbFloat {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(60px, 40px) scale(1.1) rotate(180deg); }
  100% { transform: translate(-40px, 70px) scale(0.95) rotate(360deg); }
}

/* Transiciones ultra suaves entre temas */
body, .sidebar, .mobile-header, .mobile-bottom-nav, .kpi-card, .analytics-card, .modal-container, .data-table tr, .btn, .form-control {
  transition: background-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.25s ease,
              box-shadow 0.35s ease,
              backdrop-filter 0.35s ease;
}

/* Efectos Glassmorphism en tarjetas y paneles */
body.glass-theme .sidebar,
body.glass-theme .mobile-header,
body.glass-theme .mobile-bottom-nav,
body.glass-theme .kpi-card,
body.glass-theme .analytics-card,
body.glass-theme .modal-container,
body.glass-theme .custom-context-menu,
body.glass-theme .filter-bar-card,
body.glass-theme .section-lock-card {
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.35), inset 0 1px 1px 0 rgba(255, 255, 255, 0.18);
}

body.glass-theme .sidebar {
  background: rgba(11, 17, 32, 0.65);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

body.glass-theme .mobile-header {
  background: rgba(11, 17, 32, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

body.glass-theme .mobile-bottom-nav {
  background: rgba(11, 17, 32, 0.78);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

body.glass-theme .kpi-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

body.glass-theme .kpi-card:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5), inset 0 1px 1.5px rgba(255, 255, 255, 0.3);
}

body.glass-theme .btn-primary {
  background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

body.glass-theme .form-control {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
}

body.glass-theme .data-table tr:hover {
  background: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ================= LOGIN OVERLAY ================= */
.login-overlay-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #1E293B 0%, #0B1120 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo-icon { font-size: 28px; }
.login-logo h2 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--color-red);
  color: #FCA5A5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ================= APP LAYOUT ================= */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* SIDEBAR DESKTOP */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s ease, width 0.25s ease;
}
.sidebar-brand {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-brand .brand-icon { font-size: 22px; }
.sidebar-brand .brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 17px;
  flex: 1;
}
.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle-btn:hover { color: var(--text-main); background: var(--bg-card-hover); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}
.nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-blue);
  font-weight: 600;
  border-left: 3px solid var(--color-blue);
}
.nav-icon { font-size: 17px; }
.tab-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.tab-badge.badge-warning {
  background: var(--color-amber);
  color: #000;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-user-block {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.user-role { font-size: 11px; color: var(--text-muted); }
.sidebar-actions-row {
  display: flex;
  gap: 6px;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 32px 80px 32px;
  width: calc(100vw - var(--sidebar-width));
  max-width: 1600px;
  transition: margin-left 0.25s ease, width 0.25s ease;
}

.sidebar-expand-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 99;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
}

/* CABECERA PARA MÓVILES */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  z-index: 100;
  box-sizing: border-box;
}

.mobile-brand-group {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 8px;
  user-select: none;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.mobile-brand-group:active {
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
  transform: scale(0.97);
}

.brand-tools-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  padding: 4px 6px;
  border-radius: 7px;
}
.tools-hamburger-bars {
  font-size: 13px;
  line-height: 1;
  color: var(--color-blue, #3b82f6);
  font-weight: 900;
}
.brand-tools-badge .brand-icon {
  font-size: 14px;
  line-height: 1;
}
.mobile-brand-group .brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.3px;
  color: var(--text-main);
  white-space: nowrap;
}

@media (max-width: 440px) {
  .mobile-brand-group .brand-name {
    display: none;
  }
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon-mobile {
  background: var(--color-blue);
  color: #fff;
  border: none;
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 29px;
  box-sizing: border-box;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn-icon-mobile:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.btn-icon-mobile.btn-icon-scanner {
  background: rgba(59, 130, 246, 0.14);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.btn-icon-mobile.btn-icon-scanner:hover,
.btn-icon-mobile.btn-icon-scanner:active {
  background: rgba(59, 130, 246, 0.25);
  color: #BFDBFE;
}

.btn-icon-mobile.btn-icon-entry {
  background: #10b981;
  border: 1px solid #059669;
}
.btn-icon-mobile.btn-icon-entry:hover {
  background: #059669;
}

.btn-icon-mobile.btn-icon-exit {
  background: var(--color-blue);
  border: 1px solid #1d4ed8;
}
.btn-icon-mobile.btn-icon-exit:hover {
  background: var(--color-blue-hover);
}

@media (max-width: 350px) {
  .mobile-header {
    padding: 0 4px;
  }
  .mobile-header-actions {
    gap: 2px;
  }
  .btn-icon-mobile {
    padding: 4px 6px;
    font-size: 10px;
    gap: 2px;
  }
}

/* BARRA INFERIOR DE NAVEGACIÓN MÓVIL (BOTTOM NAV) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  z-index: 150;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  flex: 1;
  height: 100%;
  cursor: pointer;
  gap: 3px;
  transition: color 0.15s;
}
.bottom-nav-item.active {
  color: var(--color-blue);
  font-weight: 600;
}
.bottom-nav-icon { font-size: 18px; }
.bottom-nav-label { font-size: 10px; }
.bottom-nav-item.highlight-action {
  color: var(--color-blue);
}
.bottom-nav-item.highlight-action .bottom-nav-icon {
  background: var(--color-blue);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-top: -6px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* SECCIONES DE LA APLICACIÓN */
.app-section { display: none; }
.app-section.active { display: block; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title h1 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}
.page-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ================= KPI CARDS GRID ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
}
.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.kpi-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.kpi-icon { font-size: 16px; }
.kpi-value {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 11px;
  color: var(--text-dimmed);
}

.kpi-card.highlight-blue { border-left: 4px solid var(--color-blue); }
.kpi-card.alert-red { border-left: 4px solid var(--color-red); }
.kpi-card.alert-red .kpi-value { color: var(--color-red); }
.kpi-card.alert-orange { border-left: 4px solid var(--color-orange); }
.kpi-card.alert-orange .kpi-value { color: var(--color-orange); }
.kpi-card.alert-yellow { border-left: 4px solid var(--color-amber); }

/* DASHBOARD ANALYTICS GRID */
.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}
.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* ================= TABLAS Y DATOS ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.data-table th {
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}
.compact-table td, .compact-table th { padding: 8px 12px; font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* BADGES DE STOCK */
.badge-stock {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-stock.stock-ok { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.badge-stock.stock-bajo { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.badge-stock.stock-critico { background: rgba(234, 88, 12, 0.15); color: #FB923C; }
.badge-stock.stock-sinstock { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.badge-stock.stock-omitido { background: rgba(148, 163, 184, 0.15); color: #94A3B8; border: 1px dashed #64748B; }

.sku-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-icon-only {
  padding: 6px 10px !important;
  font-size: 15px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 36px !important;
}

/* FILTROS Y CONTROLES */
.filters-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 15px;
}
.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 38px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--border-focus); }
.clear-search-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-pills-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.filter-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.filter-pill:hover { background: var(--bg-card-hover); color: var(--text-main); }
.filter-pill.active {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
  font-weight: 600;
}
.filter-pill.pill-red.active { background: var(--color-red); border-color: var(--color-red); }
.filter-pill.pill-orange.active { background: var(--color-orange); border-color: var(--color-orange); }
.filter-pill.pill-yellow.active { background: var(--color-amber); color: #000; border-color: var(--color-amber); }
.filter-pill.pill-green.active { background: var(--color-green); border-color: var(--color-green); }
.filter-pill.pill-gray.active { background: #64748B; border-color: #64748B; }

/* Desktop helper classes for catalog title badge and collapsible filter bar */
.page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inv-count-pill {
  background: rgba(59, 130, 246, 0.12);
  color: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
}
.filter-collapsible-bar {
  display: none !important;
}

.filter-selects-row, .filter-row-wrap {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}
.select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.select-group label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.form-select-sm, .form-control-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  min-width: 0;
  max-width: 260px;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s;
}
.form-select-sm:focus, .form-control-sm:focus {
  border-color: var(--border-focus);
}

.inventory-footer-info {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ================= TARJETAS MÓVILES (MOBILE INVENTORY) ================= */
.mobile-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mobile-inv-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.mobile-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}
.mobile-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.mobile-card-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: 2px;
}
.mobile-stock-numbers {
  font-size: 13px;
  color: var(--text-main);
}
.mobile-stock-numbers b { font-size: 16px; }
.mobile-card-actions {
  display: flex;
  gap: 8px;
}
.btn-card-action {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ================= KARDEX ACTIVITY CARDS (MOBILE FIRST) ================= */
.kardex-mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kardex-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}

.kardex-card:hover {
  border-color: var(--border-focus);
}

.kardex-card:active {
  transform: scale(0.985);
  background: var(--bg-card-hover);
}

.kardex-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kardex-card-type-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kardex-type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.badge-kardex-salida {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-kardex-entrada {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-kardex-dev {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.kardex-qty-pill {
  font-size: 13px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.kardex-qty-pill.qty-neg {
  background: rgba(239, 68, 68, 0.18);
  color: #EF4444;
}

.kardex-qty-pill.qty-pos {
  background: rgba(16, 185, 129, 0.18);
  color: #10B981;
}

.kardex-card-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 600;
}

.kardex-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kardex-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  letter-spacing: -0.2px;
}

.kardex-card-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kardex-meta-tag.area-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-weight: 500;
}

.kardex-card-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.kardex-footer-person {
  color: var(--text-main);
  font-size: 12px;
}

.kardex-footer-notes {
  font-style: italic;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
}

/* Filtros compactos de Kardex */
.kardex-dates-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.kardex-date-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kardex-date-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-clear-dates-link {
  background: transparent;
  border: none;
  color: var(--color-blue);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

.filter-pill.pill-blue.active {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
}

/* ================= FORMULARIOS Y TOUCH CONTROLS ================= */
.form-layout-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.recent-sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  height: fit-content;
}
.recent-sidebar-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
}
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.recent-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
}
.recent-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}
.recent-item-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.operation-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.mode-radio {
  cursor: pointer;
}
.mode-radio input { display: none; }
.mode-box {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s;
}
.mode-radio input:checked + .mode-box {
  border-color: var(--color-blue);
  background: rgba(59, 130, 246, 0.1);
}
.mode-icon { font-size: 20px; margin-bottom: 2px; }
.mode-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.mode-desc { font-size: 11px; color: var(--text-muted); }

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--border-focus); }

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

.quantity-touch-stepper {
  display: flex;
  align-items: center;
  width: 100%;
}
.step-btn {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 44px;
  height: 42px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.step-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.quantity-input {
  border-radius: 0;
  height: 42px;
  font-weight: 700;
  font-size: 16px;
}

.selected-product-banner {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.product-banner-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.product-banner-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.sku-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-blue);
  margin-right: 6px;
}
.ubic-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.stock-pill-indicator {
  font-size: 13px;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}
.product-banner-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stock-warning-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 500;
}
.stock-warning-box.warning-yellow {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--color-amber);
  color: #FDE68A;
}
.stock-warning-box.warning-red {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--color-red);
  color: #FCA5A5;
}

.form-actions-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.sku-generated-display {
  background: rgba(59, 130, 246, 0.15);
  border: 1px dashed var(--color-blue);
  color: var(--color-blue);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
}

/* AUTOCOMPLETE */
.autocomplete-wrapper { position: relative; width: 100%; }
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 500;
}
.autocomplete-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--bg-card-hover);
  color: var(--color-blue);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item-title { font-weight: 600; }
.autocomplete-item-sub { font-size: 11px; color: var(--text-muted); }

/* BOTONES GLOBALES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--color-blue); color: #fff; }
.btn-primary:hover { background: #2563EB; }
.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover { background: var(--bg-card-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-text-action {
  background: none;
  border: none;
  color: var(--color-blue);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.btn-text-action:hover { text-decoration: underline; }

/* ================= MODALES ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}
.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-container.modal-sm { max-width: 420px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-main); }
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================= ETIQUETAS IMPRIMIBLES ================= */
.printable-labels-sheet {
  background: #fff;
  color: #000;
  padding: 30px;
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  border: 1px solid var(--border-color);
}
.etiqueta-box {
  width: 280px;
  height: 140px;
  border: 2px solid #000;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  background: #fff;
  color: #000;
}
.etiqueta-prod-name {
  font-family: sans-serif;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}
.etiqueta-category {
  font-family: sans-serif;
  font-size: 11px;
  color: #444;
}
.etiqueta-sku-text {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
}
.etiqueta-barcode-svg-container svg {
  max-width: 100%;
  height: 52px;
  background: #fff;
}

/* ================= PLANILLA DOLE ================= */
.dole-paper-sheet {
  background: #fff;
  color: #000;
  padding: 24px;
  border-radius: var(--radius-sm);
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.dole-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0056B3;
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.dole-sheet-title h2 {
  font-size: 16px;
  font-weight: 800;
  color: #0056B3;
  font-family: sans-serif;
}
.dole-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dole-meta-item label { font-size: 11px; font-weight: 700; color: #333; }
.dole-input-underline {
  width: 100%;
  border: none;
  border-bottom: 1px solid #000;
  padding: 4px 0;
  font-size: 13px;
  outline: none;
  background: transparent;
}
.dole-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.dole-items-table th {
  border: 1px solid #333;
  background: #F0F4F8;
  color: #000;
  font-size: 11px;
  padding: 6px;
  text-align: center;
}
.dole-items-table td {
  border: 1px solid #333;
  padding: 4px;
}
.dole-cell-input {
  width: 100%;
  border: none;
  padding: 4px;
  font-size: 12px;
  outline: none;
}
.dole-signatures-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 10px;
}
.dole-signature-box {
  text-align: center;
}
.signature-canvas-wrap {
  border: 1px dashed #666;
  height: 90px;
  margin-bottom: 4px;
  background: #FAFAFA;
}
.signature-line {
  border-top: 1px solid #000;
  padding-top: 4px;
  font-size: 11px;
  font-weight: 700;
}
.btn-clean-sig {
  background: none;
  border: none;
  color: #666;
  font-size: 10px;
  cursor: pointer;
  margin-top: 2px;
}

/* ================= RESPONSIVE ADAPTATIONS ================= */
.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .form-layout-container { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }

  .mobile-header { display: flex; }
  .mobile-bottom-nav { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
    z-index: 1001;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100vw;
    padding: calc(var(--header-height) + 14px) 14px calc(var(--bottom-nav-height) + 20px) 14px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi-card { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }

  /* En móvil, la cabecera superior única (mobile-header) unifica el título y acciones.
     Se ocultan los page-header internos para eliminar barras duplicadas y optimizar espacio */
  .page-header {
    display: none !important;
  }

  .mobile-header {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 1000;
    box-sizing: border-box;
  }

  .mobile-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .mobile-brand-group {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .mobile-header-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }

  .mobile-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    letter-spacing: -0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-header-title .mobile-title-sub {
    color: var(--color-blue);
  }

  #mobile-inv-count-badge {
    font-size: 11px;
    padding: 2px 7px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.18);
    color: #93C5FD;
    border: 1px solid rgba(59, 130, 246, 0.35);
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }

  .mobile-header-actions .btn-compact {
    height: 28px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }

  .mobile-header-actions .btn-compact.btn-icon-only {
    min-width: 28px;
    padding: 4px 6px;
    justify-content: center;
  }

  /* Aislamiento estricto de botones contextuales en la cabecera móvil */
  .mobile-header-actions .catalog-action,
  .mobile-header-actions .kardex-action {
    display: none !important;
  }

  /* Solo se muestran en Catálogo cuando el usuario es Administrador */
  body[data-section="inventory"].role-admin .mobile-header-actions .catalog-action {
    display: inline-flex !important;
  }

  /* Solo se muestran en Kardex cuando el usuario es Administrador */
  body[data-section="kardex"].role-admin .mobile-header-actions .kardex-action {
    display: inline-flex !important;
  }

  @media (max-width: 360px) {
    .mobile-header-title .mobile-title-sub {
      display: none;
    }
    .catalog-action .btn-text {
      display: none;
    }
  }

  /* Filtros y Buscador Ultra-Compacto en Móvil */
  .filters-card {
    padding: 8px 10px !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
    overflow: hidden;
  }
  .filter-group-main {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
  }
  .search-input-wrapper {
    height: 36px !important;
  }
  .search-input {
    height: 36px !important;
    padding: 6px 10px 6px 32px !important;
    font-size: 12.5px !important;
  }
  .search-icon {
    left: 10px !important;
    font-size: 13px !important;
  }
  .btn-scanner-trigger {
    height: 36px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .filter-pills-row {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
  }
  .filter-pills-row::-webkit-scrollbar {
    display: none;
  }
  .filter-pill {
    padding: 4px 10px;
    font-size: 11.5px;
    flex-shrink: 0;
    height: 27px;
    display: inline-flex;
    align-items: center;
    border-radius: 14px;
  }

  /* Barra Desplegable de Filtros Secundarios */
  .filter-collapsible-bar {
    display: flex !important;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 1px;
  }
  .btn-toggle-advanced-filters {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    height: 30px;
  }
  .btn-toggle-advanced-filters:hover,
  .btn-toggle-advanced-filters.active-drawer {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--color-blue);
    color: var(--text-main);
  }
  .btn-toggle-advanced-filters.has-active-filters {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid var(--color-blue);
    color: #93C5FD;
    font-weight: 600;
  }
  .btn-toggle-advanced-filters .toggle-left {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .badge-filter-count {
    background: var(--color-blue);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
  }
  .toggle-arrow {
    font-size: 11px;
    font-weight: 700;
  }
  .btn-clear-filters-mini {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #F87171;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    height: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
  }

  /* Oculto por defecto en móvil, desplegable al tocar el botón */
  #inv-filter-selects-row {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    animation: fadeIn 0.15s ease-out;
  }
  #inv-filter-selects-row.open {
    display: grid !important;
  }
  #inv-filter-selects-row .select-group:first-child {
    grid-column: 1 / -1; /* Categoría en ancho completo */
  }

  .select-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    width: 100%;
    min-width: 0;
  }

  .select-group label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 2px;
  }

  .select-group .form-select-sm {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 36px;
    padding: 6px 10px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
  }

  /* Tarjetas móviles compactas para que quepan varias en pantalla */
  .mobile-inv-card {
    padding: 10px 12px !important;
    gap: 6px !important;
  }
  .mobile-card-title {
    font-size: 13.5px !important;
    line-height: 1.25 !important;
  }
  .mobile-card-meta {
    font-size: 11px !important;
    gap: 6px !important;
  }
  .mobile-card-stock-row {
    padding-top: 6px !important;
  }
  .mobile-stock-numbers {
    font-size: 12px !important;
  }
  .mobile-stock-numbers b {
    font-size: 14px !important;
  }
  .btn-card-action {
    padding: 5px 9px !important;
    font-size: 11.5px !important;
  }

  .dashboard-analytics-grid {
    grid-template-columns: 1fr;
  }

  .operation-mode-toggle {
    grid-template-columns: 1fr;
  }

  .dole-meta-grid, .dole-signatures-grid {
    grid-template-columns: 1fr;
  }

  .form-card, .recent-sidebar-card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .btn-row-menu {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* ================= PRINT STYLES ================= */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .no-print, .sidebar, .mobile-header, .mobile-bottom-nav, .page-header { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  .printable-labels-sheet, .dole-paper-sheet { box-shadow: none !important; border: none !important; }
}

/* ================= CONTEXT MENU (CLIC DERECHO) ================= */
.custom-context-menu {
  position: fixed;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md), 0 10px 30px rgba(0,0,0,0.6);
  min-width: 240px;
  padding: 6px;
  backdrop-filter: blur(12px);
  animation: ctxScaleIn 0.12s ease-out;
}
@keyframes ctxScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.context-menu-header {
  padding: 8px 10px 6px 10px;
}
.context-prod-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.context-prod-sku {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-blue);
}
.context-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}
.context-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.1s;
}
.context-menu-item:hover {
  background: var(--color-blue);
  color: #fff;
}
.context-menu-item .ctx-icon {
  font-size: 14px;
}
.context-menu-item.item-danger:hover {
  background: var(--color-red);
  color: #fff;
}
.data-table tbody tr {
  cursor: context-menu;
  user-select: none;
}
.btn-row-menu {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
}
.btn-row-menu:hover {
  background: var(--color-blue);
  color: #fff;
}

/* ================= ESCÁNER DE CÁMARA PARA MÓVILES ================= */
#modal-camera-scanner {
  z-index: 10005 !important;
  background: rgba(0, 0, 0, 0.85);
}
.scanner-modal-container {
  max-width: 520px !important;
  width: 95% !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#camera-scanner-reader {
  width: 100% !important;
  border: none !important;
  min-height: 280px;
}

#camera-scanner-reader video {
  border-radius: var(--radius-sm);
  object-fit: cover !important;
  width: 100% !important;
}

.scanner-laser-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-reticle {
  width: 280px;
  height: 160px;
  border: 2px solid rgba(59, 130, 246, 0.8);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.scanner-reticle::before,
.scanner-reticle::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #38bdf8;
  border-style: solid;
}

.scanner-reticle::before {
  top: 0; left: 0;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.scanner-reticle::after {
  bottom: 0; right: 0;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

.laser-line {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ef4444, #f87171, #ef4444, transparent);
  box-shadow: 0 0 8px #ef4444;
  position: absolute;
  top: 0;
  animation: laserScan 2s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 8%; }
  100% { top: 90%; }
}

.scanner-controls-bar {
  position: absolute;
  bottom: 12px;
  display: flex;
  gap: 10px;
  z-index: 10;
}

.scanner-btn {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-scan-cam {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--color-blue);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-scan-cam:hover {
  background: var(--color-blue-bg);
  border-color: var(--color-blue);
}

.btn-scanner-trigger {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ================= CONTROL DE ROLES (MODO BÁSICO VS ADMINISTRADOR) ================= */
body.role-basic .admin-only,
body.role-basic .page-actions .admin-only,
body.role-basic .page-header-catalog .page-actions .admin-only,
body.role-basic button.admin-only,
body.role-admin .basic-only,
body.role-admin .page-actions .basic-only,
body.role-admin .page-header-catalog .page-actions .basic-only,
body.role-admin button.basic-only {
  display: none !important;
}

/* ================= TEMA VISUAL MODO ADMINISTRADOR (DISTINCIÓN DE TONO) ================= */
body.role-admin {
  /* 1. Cambio de Acento Principal: De Azul estándar (#3B82F6) a Púrpura Real Eléctrico (#8B5CF6) */
  --color-blue: #8B5CF6;
  --color-blue-hover: #7C3AED;
  --color-blue-bg: rgba(139, 92, 246, 0.16);
  --border-focus: #A78BFA;

  /* 2. Matiz de Fondo: De Pizarra Fría (#0B1120) a Obsidiana Índigo Profundo (#0D0B18) */
  --bg-main: #0D0B18;
  --bg-card: #171328;
  --bg-card-hover: #221C3B;
  --bg-input: #1E1836;
  --border-color: rgba(167, 139, 250, 0.16);
  --shadow-sm: 0 1px 4px rgba(139, 92, 246, 0.15);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.6);
}

/* Modo Claro con Privilegios de Administrador */
body.light-theme.role-admin {
  --color-blue: #7C3AED;
  --color-blue-hover: #6D28D9;
  --color-blue-bg: rgba(124, 58, 237, 0.12);
  --border-focus: #7C3AED;

  --bg-main: #F5F3FF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #EDE9FE;
  --bg-input: #FFFFFF;
  --border-color: #DDD6FE;
}

/* Cabecera Móvil Distintiva en Modo Admin */
body.role-admin .mobile-header {
  border-top: 3px solid #8B5CF6 !important;
  background: linear-gradient(180deg, #1C1536 0%, #141026 100%) !important;
  border-bottom: 1px solid rgba(139, 92, 246, 0.32) !important;
  box-shadow: 0 2px 14px rgba(139, 92, 246, 0.2) !important;
}
body.light-theme.role-admin .mobile-header {
  border-top: 3px solid #7C3AED !important;
  background: linear-gradient(180deg, #EDE9FE 0%, #F5F3FF 100%) !important;
  border-bottom: 1px solid #DDD6FE !important;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.12) !important;
}

/* Barra Inferior Móvil en Modo Admin (Dark Theme) */
body.role-admin:not(.light-theme) .mobile-bottom-nav {
  background: rgba(20, 16, 38, 0.96) !important;
  border-top: 1px solid rgba(139, 92, 246, 0.25) !important;
  backdrop-filter: blur(12px);
}
body.role-admin:not(.light-theme) .bottom-nav-item.active {
  color: #C4B5FD !important;
}
body.role-admin:not(.light-theme) .bottom-nav-item.highlight-action .bottom-nav-icon {
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%) !important;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.6) !important;
}

/* Barra Inferior Móvil (Light Theme - Modo Claro) */
body.light-theme .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top: 1px solid #E2E8F0 !important;
}
body.light-theme.role-admin .mobile-bottom-nav {
  border-top: 1px solid #DDD6FE !important;
}
body.light-theme.role-admin .bottom-nav-item.active {
  color: #7C3AED !important;
}
body.light-theme.role-admin .bottom-nav-item.highlight-action .bottom-nav-icon {
  background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%) !important;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4) !important;
}

/* Barra Lateral Desktop y Móvil en Modo Admin (Dark Theme) */
body.role-admin:not(.light-theme) .sidebar {
  background: #141026 !important;
  border-right: 1px solid rgba(139, 92, 246, 0.22) !important;
}
body.role-admin:not(.light-theme) .sidebar-brand {
  border-bottom: 1px solid rgba(139, 92, 246, 0.2) !important;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.14) 0%, transparent 100%) !important;
}
body.role-admin:not(.light-theme) .sidebar .nav-item {
  color: #94A3B8 !important;
}
body.role-admin:not(.light-theme) .sidebar .nav-item:hover {
  background: rgba(139, 92, 246, 0.14) !important;
  color: #F8FAFC !important;
}
body.role-admin:not(.light-theme) .sidebar .nav-item.active {
  background: rgba(139, 92, 246, 0.22) !important;
  color: #DDD6FE !important;
  border-left: 3px solid #8B5CF6 !important;
}
body.role-admin:not(.light-theme) .user-avatar {
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%) !important;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.45) !important;
}
body.role-admin:not(.light-theme) #sidebar-user-role {
  color: #C4B5FD !important;
  font-weight: 600 !important;
}

/* Barra Lateral Desktop y Móvil (Light Theme - Modo Claro) */
body.light-theme .sidebar {
  background: #FFFFFF !important;
  border-right: 1px solid #E2E8F0 !important;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06) !important;
}
body.light-theme .sidebar-brand {
  border-bottom: 1px solid #E2E8F0 !important;
  background: #FFFFFF !important;
}
body.light-theme .sidebar-brand .brand-name {
  color: #0F172A !important;
}
body.light-theme .sidebar .nav-item {
  color: #475569 !important;
}
body.light-theme .sidebar .nav-item:hover {
  background: #F1F5F9 !important;
  color: #0F172A !important;
}
body.light-theme .sidebar .nav-item.active {
  background: #EFF6FF !important;
  color: #1D4ED8 !important;
  border-left: 3px solid #2563EB !important;
  font-weight: 700 !important;
}
body.light-theme .sidebar-footer {
  border-top: 1px solid #E2E8F0 !important;
  background: #F8FAFC !important;
}
body.light-theme .user-name {
  color: #0F172A !important;
}
body.light-theme .user-role {
  color: #64748B !important;
}
body.light-theme .sidebar-toggle-btn {
  color: #64748B !important;
}
body.light-theme .sidebar-toggle-btn:hover {
  background: #E2E8F0 !important;
  color: #0F172A !important;
}
body.light-theme .tab-badge {
  background: #E2E8F0 !important;
  color: #334155 !important;
}

/* Detalles específicos de la barra lateral en Modo Admin con Light Theme */
body.light-theme.role-admin .sidebar {
  border-right: 1px solid #DDD6FE !important;
}
body.light-theme.role-admin .sidebar-brand {
  border-bottom: 1px solid #DDD6FE !important;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.08) 0%, transparent 100%) !important;
}
body.light-theme.role-admin .sidebar-brand .brand-name {
  color: #1E1B4B !important;
}
body.light-theme.role-admin .sidebar .nav-item:hover {
  background: #F5F3FF !important;
  color: #1E1B4B !important;
}
body.light-theme.role-admin .sidebar .nav-item.active {
  background: #EDE9FE !important;
  color: #6D28D9 !important;
  border-left: 3px solid #7C3AED !important;
}
body.light-theme.role-admin .sidebar .nav-item.active .tab-badge {
  background: #DDD6FE !important;
  color: #6D28D9 !important;
}
body.light-theme.role-admin .sidebar-footer {
  border-top: 1px solid #DDD6FE !important;
  background: #FAF5FF !important;
}
body.light-theme.role-admin .user-name {
  color: #1E1B4B !important;
}
body.light-theme.role-admin #sidebar-user-role {
  color: #7C3AED !important;
  font-weight: 700 !important;
}
body.light-theme.role-admin .user-avatar {
  background: linear-gradient(135deg, #7C3AED 0%, #DB2777 100%) !important;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3) !important;
}

/* Insignias de Rol en la Cabecera Móvil */
.header-role-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  height: 19px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  user-select: none;
}
.role-badge-admin {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.28) 0%, rgba(217, 70, 239, 0.22) 100%);
  color: #F5F3FF;
  border: 1px solid #A78BFA;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
  animation: adminBadgePulse 2.5s infinite ease-in-out;
}
@keyframes adminBadgePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(139, 92, 246, 0.3); border-color: #A78BFA; }
  50% { box-shadow: 0 0 12px rgba(192, 132, 252, 0.7); border-color: #C4B5FD; }
}
.role-badge-basic {
  background: rgba(59, 130, 246, 0.12);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.28);
}
@media (max-width: 375px) {
  .header-role-badge {
    padding: 2px 5px;
    font-size: 9.5px;
  }
}

/* Botones de autenticación en cabecera móvil */
.btn-header-auth {
  background: var(--color-blue);
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  height: 29px;
  white-space: nowrap;
}

.btn-header-auth:hover {
  background: var(--color-blue-hover);
}

.btn-header-logout {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  border-radius: 50% !important;
  width: 29px !important;
  height: 29px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13.5px !important;
  flex-shrink: 0 !important;
  cursor: pointer;
}

.btn-header-logout:hover,
.btn-header-logout:active {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
}

/* Tarjeta informativa de bloqueo para Modo Básico */
.section-lock-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.2s ease-out;
}

.section-lock-card .lock-icon {
  font-size: 40px;
  line-height: 1;
}

.section-lock-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.section-lock-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 460px;
  line-height: 1.45;
  margin: 0;
}

.section-lock-card .btn {
  margin-top: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
}

/* ================= BOTÓN DE PANTALLA COMPLETA (FULLSCREEN) ================= */
.fullscreen-float-btn {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 999;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}
.fullscreen-float-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  color: var(--color-blue);
  transform: scale(1.05);
}
.fullscreen-float-btn:active {
  transform: scale(0.95);
}

.btn-fullscreen-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-fullscreen-toggle svg {
  display: block;
}
.btn-fullscreen-toggle .fs-icon-enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-fullscreen-toggle .fs-icon-exit {
  display: none;
  align-items: center;
  justify-content: center;
}

body.is-fullscreen .btn-fullscreen-toggle .fs-icon-enter {
  display: none !important;
}
body.is-fullscreen .btn-fullscreen-toggle .fs-icon-exit {
  display: inline-flex !important;
}

@media (max-width: 768px) {
  .fullscreen-float-btn {
    display: none !important;
  }
}
@media print {
  .fullscreen-float-btn, .btn-fullscreen-toggle {
    display: none !important;
  }
}

