/* ==========================================================================
   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 .autocomplete-dropdown,
body.glass-theme .selected-product-banner,
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: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 8px;
  box-sizing: border-box;
}
.sidebar-brand-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sidebar-brand .brand-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-brand .brand-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 18px;
  color: var(--text-main);
  white-space: nowrap;
  letter-spacing: -0.3px;
  line-height: 1;
}
.sidebar-brand .header-role-badge,
.sidebar-expand-btn .header-role-badge {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  font-size: 15px !important;
  border-width: 1px !important;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4) !important;
  margin-left: 2px !important;
}
.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.sidebar-toggle-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-color);
}

.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: 24px;
  z-index: 99;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm), 0 2px 10px rgba(0, 0, 0, 0.08);
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  user-select: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.sidebar-expand-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.sidebar-expand-btn .expand-icon {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1;
}
.sidebar-expand-btn .expand-brand-icon {
  font-size: 18px;
  line-height: 1;
}
.sidebar-expand-btn .expand-brand-text {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.3px;
  color: var(--text-main);
  line-height: 1;
}

/* Colapso del panel lateral en Desktop */
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%) !important;
}
body.sidebar-collapsed .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  padding-top: 72px !important;
}
body.sidebar-collapsed .sidebar-expand-btn {
  display: inline-flex !important;
}

/* 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: 12px;
  flex-wrap: wrap;
}
.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 Historial de Movimientos (Lado a Lado) */
.kardex-dates-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-top: 6px;
}

.kardex-date-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

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

.kardex-date-item input[type="date"] {
  width: 100%;
  min-width: 0;
  flex: 1;
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--text-primary);
  padding: 0;
  outline: none;
}

.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 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.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-md);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
  max-height: 290px;
  overflow-y: auto;
  z-index: 500;
}
.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  transition: all 0.15s ease;
}
.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--bg-card-hover);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.autocomplete-item-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.35;
}
.autocomplete-talla-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.18);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.45);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.autocomplete-ubic-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(139, 92, 246, 0.15);
  color: #C084FC;
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
}
.autocomplete-stock-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.autocomplete-stock-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.autocomplete-stock-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.autocomplete-stock-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.autocomplete-item-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.autocomplete-details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.talla-badge-banner {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.45);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.meta-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* 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-container.modal-md { max-width: 680px; width: 92vw; }
.modal-container.modal-lg { max-width: 1060px; width: 95vw; }
.modal-container.modal-xl { max-width: 1260px; width: 96vw; }
.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;
  font-size: 19px !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;
}
body.light-theme .sidebar-expand-btn {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #0F172A !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
}
body.light-theme .sidebar-expand-btn:hover {
  background: #F8FAFC !important;
  border-color: #2563EB !important;
}
body.light-theme .sidebar-expand-btn .expand-brand-text {
  color: #0F172A !important;
}
body.light-theme.role-admin .sidebar-expand-btn {
  border-color: #DDD6FE !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;
  font-size: 19px !important;
}

/* Insignias de Rol / Distintivo Corona Administrador */
.header-role-badge {
  font-size: 22px;
  line-height: 1;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  cursor: default;
  vertical-align: middle;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.role-badge-admin {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, rgba(139, 92, 246, 0.3) 100%);
  border: 1.5px solid #F59E0B;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45), 0 0 6px rgba(139, 92, 246, 0.35);
  animation: adminCrownPulse 2.8s infinite ease-in-out;
}
.role-badge-admin:hover {
  transform: scale(1.12);
}
@keyframes adminCrownPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4), 0 0 4px rgba(139, 92, 246, 0.3);
    border-color: #F59E0B;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.85), 0 0 14px rgba(168, 85, 247, 0.55);
    border-color: #FCD34D;
    transform: scale(1.06);
  }
}
@media (max-width: 768px) {
  .header-role-badge {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 19px;
  }
}
@media (max-width: 375px) {
  .header-role-badge {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 17px;
  }
}

/* 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;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.btn-fullscreen-toggle svg {
  display: block;
  pointer-events: none;
}
.btn-fullscreen-toggle span {
  pointer-events: none;
}
.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;
}

/* ================= MODO PSEUDO-FULLSCREEN (COMPATIBILIDAD BRAVE / IOS / TABLET) ================= */
html.pseudo-fullscreen,
body.pseudo-fullscreen {
  overflow: hidden !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.pseudo-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 999999 !important;
}

body.pseudo-fullscreen #app-main-layout {
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.pseudo-fullscreen .main-content {
  height: 100vh !important;
  overflow-y: auto !important;
}

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

/* ================= NOTIFICACIONES TOAST FLOTANTES IN-APP ================= */
.app-toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 92%;
  max-width: 440px;
}

.app-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: toastSlideDown 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.app-toast.hide {
  animation: toastSlideUp 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastSlideUp {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-24px) scale(0.92);
  }
}

.app-toast-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.app-toast-content {
  flex: 1;
  min-width: 0;
}

.app-toast-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.app-toast-message {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.4;
  word-break: break-word;
}

.app-toast-close {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin-left: 4px;
  transition: opacity 0.2s;
}

.app-toast-close:hover {
  opacity: 1;
}

.app-toast.toast-success {
  border-left: 5px solid #10b981;
}
.app-toast.toast-success .app-toast-title {
  color: #34d399;
}

.app-toast.toast-error {
  border-left: 5px solid #ef4444;
}
.app-toast.toast-error .app-toast-title {
  color: #f87171;
}

.app-toast.toast-warning {
  border-left: 5px solid #f59e0b;
}
.app-toast.toast-warning .app-toast-title {
  color: #fbbf24;
}

.app-toast.toast-info {
  border-left: 5px solid #3b82f6;
}
.app-toast.toast-info .app-toast-title {
  color: #60a5fa;
}

/* Adaptación de Toast por tema */
[data-theme="light"] .app-toast {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
}

[data-theme="liquid-glass"] .app-toast {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.38);
}

/* Feedback en botones al guardar */
.btn-success-feedback {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  transform: scale(1.02);
  transition: all 0.25s ease-in-out;
}

/* ================= INTERACTIVIDAD EN TABLAS DEL PANEL ================= */
.interactive-table tr.clickable-row {
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.15s ease;
}

.interactive-table tr.clickable-row:hover {
  background-color: rgba(59, 130, 246, 0.14) !important;
}

.btn-row-action {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 7px;
  line-height: 1;
  transition: all 0.15s;
}

.btn-row-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-blue);
}

.card-toggle-pills .btn-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-toggle-pills .btn-pill:hover {
  color: var(--text-primary);
}

.card-toggle-pills .btn-pill.active {
  background: var(--color-blue);
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* ================= EXPLORADOR DE MOVIMIENTOS RESPONSIVO (PC Y MÓVIL) ================= */
.mov-explorer-table-wrap {
  width: 100%;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden; /* Cero scroll horizontal en PC */
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.mov-explorer-table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse;
}

.mov-explorer-table th,
.mov-explorer-table td {
  padding: 10px 12px;
  vertical-align: middle;
  box-sizing: border-box;
}

.mov-explorer-table th {
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}
body.light-theme .mov-explorer-table th {
  background: #f1f5f9;
  color: #64748b;
}

/* Anchos y distribución inteligente de columnas en PC */
.mov-explorer-table .col-mov-fecha {
  width: 110px;
}
.mov-date-val {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-main);
  white-space: nowrap;
}
.mov-time-val {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.mov-explorer-table .col-mov-persona {
  width: 145px;
}
.mov-person-name {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
  word-break: break-word;
  line-height: 1.3;
}

.mov-explorer-table .col-mov-producto {
  /* Ancho flexible: absorbe todo el espacio central restante */
}
.mov-prod-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.35;
  word-break: break-word;
}
.mov-prod-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.mov-sku-tag {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
}

.mov-explorer-table .col-mov-cant {
  width: 70px;
  text-align: center;
}
.mov-cant-pill {
  background: rgba(59, 130, 246, 0.16);
  color: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-weight: 700;
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  white-space: nowrap;
}
body.light-theme .mov-cant-pill {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.mov-explorer-table .col-mov-tipo {
  width: 125px;
}
.mov-area-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  word-break: break-word;
  line-height: 1.25;
}

.mov-explorer-table .col-mov-accion {
  width: 95px;
  text-align: center;
}

.mov-notes-text {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--color-blue);
  border-radius: 0 4px 4px 0;
  word-break: break-word;
}

.btn-revert-mov {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-revert-mov:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.03);
}

/* Control de visibilidad Desktop / Móvil */
@media (min-width: 769px) {
  .mov-mobile-only {
    display: none !important;
  }
  .mov-desktop-only {
    display: block !important;
  }
}

/* ================= MODO TARJETAS EN DISPOSITIVOS MÓVILES (< 768px) ================= */
@media (max-width: 768px) {
  .modal-container.modal-lg {
    max-width: 100% !important;
    width: 96vw !important;
    margin: 6px !important;
    max-height: 92vh;
  }
  .mov-explorer-table-wrap {
    border: none !important;
    background: transparent !important;
    overflow-x: hidden !important;
    max-height: 62vh;
  }
  .mov-explorer-table,
  .mov-explorer-table thead,
  .mov-explorer-table tbody,
  .mov-explorer-table tr,
  .mov-explorer-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .mov-explorer-table thead {
    display: none !important;
  }
  .mov-explorer-table tbody tr.mov-row-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    cursor: default;
  }
  body.light-theme .mov-explorer-table tbody tr.mov-row-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  }
  .mov-explorer-table td {
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
  }
  .mov-desktop-only {
    display: none !important;
  }
  .mov-mobile-only {
    display: block !important;
  }
  .mov-mobile-card-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 2px;
  }
  .mov-mobile-card-footer {
    display: flex !important;
    justify-content: stretch;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
  }
  .mov-mobile-card-footer .btn-revert-mov {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ================= BOTONES RÁPIDOS CABECERA MÓVIL (SALIDA Y ENTRADA) ================= */
.btn-header-quick-salida {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 5px 9px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  white-space: nowrap !important;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-header-quick-salida:hover, .btn-header-quick-salida:active {
  background: #ef4444 !important;
  color: #ffffff !important;
  transform: scale(1.02);
}

.btn-header-quick-entrada {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 5px 9px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  white-space: nowrap !important;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-header-quick-entrada:hover, .btn-header-quick-entrada:active {
  background: #10b981 !important;
  color: #ffffff !important;
  transform: scale(1.02);
}

.btn-header-quick-solicitud {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 5px 9px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  white-space: nowrap !important;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-header-quick-solicitud:hover, .btn-header-quick-solicitud:active {
  background: #f59e0b !important;
  color: #ffffff !important;
  transform: scale(1.02);
}

/* ================= VISTA MÓVIL: TARJETAS DE PRÉSTAMOS ACTIVOS ================= */
.prestamos-mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

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

.prestamo-mobile-card.prestamo-card-activo {
  border-left: 4px solid #f59e0b;
}

.prestamo-mobile-card.prestamo-card-devuelto {
  border-left: 4px solid #10b981;
  opacity: 0.85;
}

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

.prestamo-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.prestamo-card-date {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.prestamo-card-tool-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.prestamo-card-tool-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.prestamo-card-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.prestamo-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prestamo-info-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
}

.prestamo-info-val {
  font-size: 13px;
  color: var(--text-primary);
}

.prestamo-card-notes {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--color-blue);
}

.prestamo-card-actions {
  margin-top: 4px;
}

.btn-devolver-mobile {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* ================= SOLICITUDES Y REQUERIMIENTOS DE MATERIAL FALTANTE ================= */
.badge-prio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-prio-critica {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.45);
  animation: pulse-critica 2s infinite ease-in-out;
}
@keyframes pulse-critica {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}
.badge-prio-alta {
  background: rgba(249, 115, 22, 0.18);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.45);
}
.badge-prio-media {
  background: rgba(234, 179, 8, 0.18);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.45);
}
.badge-prio-baja {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.badge-sol-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-sol-pendiente {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-sol-encompra {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.badge-sol-disponible {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-sol-rechazado {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.35);
}

/* Selector de Prioridad Táctil */
.priority-selector-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}
@media (max-width: 600px) {
  .priority-selector-group {
    grid-template-columns: 1fr 1fr;
  }
}
.priority-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}
.priority-pill .prio-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}
.priority-pill .prio-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
}
.priority-pill .prio-desc {
  font-size: 9.5px;
  color: var(--text-secondary);
  line-height: 1.1;
  margin-top: 2px;
}
.priority-pill:hover {
  border-color: var(--color-blue);
  transform: translateY(-1px);
}
.priority-pill.pill-critica.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}
.priority-pill.pill-critica.active .prio-title {
  color: #ef4444;
}
.priority-pill.pill-alta.active {
  background: rgba(249, 115, 22, 0.15);
  border-color: #f97316;
}
.priority-pill.pill-alta.active .prio-title {
  color: #f97316;
}
.priority-pill.pill-media.active {
  background: rgba(234, 179, 8, 0.15);
  border-color: #eab308;
}
.priority-pill.pill-media.active .prio-title {
  color: #eab308;
}
.priority-pill.pill-baja.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
}
.priority-pill.pill-baja.active .prio-title {
  color: #10b981;
}

/* Enlace Web Clickeable en Tabla y Tarjetas */
.solicitud-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.solicitud-link-btn:hover {
  text-decoration: underline;
  background: rgba(59, 130, 246, 0.18);
}

/* Tarjetas Móviles de Solicitudes */
.solicitudes-mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}
.solicitud-mobile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.solicitud-mobile-card.sol-card-critica {
  border-left: 4px solid #ef4444;
}
.solicitud-mobile-card.sol-card-alta {
  border-left: 4px solid #f97316;
}
.solicitud-mobile-card.sol-card-media {
  border-left: 4px solid #eab308;
}
.solicitud-mobile-card.sol-card-baja {
  border-left: 4px solid #10b981;
}
.solicitud-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.solicitud-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.solicitud-card-date {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.solicitud-card-prod-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.solicitud-card-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.solicitud-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.solicitud-info-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
}
.solicitud-info-val {
  font-size: 13px;
  color: var(--text-primary);
}
.solicitud-card-notes {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--color-blue);
}
.solicitud-card-admin-reply {
  font-size: 12px;
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.solicitud-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ================= HISTORIAL POR PERSONA Y TRAZABILIDAD ================= */
.hp-worker-selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.hp-selector-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: flex-end;
}
@media (max-width: 768px) {
  .hp-selector-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
.hp-worker-field, .hp-worker-search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hp-profile-banner {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.25s ease-out;
}
.hp-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hp-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.4);
}
.hp-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hp-name-row h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}
.hp-profile-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.hp-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
}
.hp-kpi-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.hp-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.hp-kpi-value {
  font-size: 22px;
  font-weight: 800;
  margin: 4px 0 2px 0;
  line-height: 1;
}
.hp-kpi-hint {
  font-size: 10px;
  color: var(--text-muted);
}
#hp-card-kpi-atrasados.has-alerts {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}
.hp-filters-card {
  margin-bottom: 16px;
  padding: 12px 16px;
}
.hp-filter-chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.hp-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
}
.hp-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.hp-filter-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}
.hp-placeholder-box {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.hp-placeholder-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.hp-placeholder-box h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}
.hp-placeholder-box p {
  font-size: 13px;
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.4;
}

/* Tabla Desktop Zero-Scroll */
.hp-desktop-table-wrap {
  width: 100%;
  overflow-x: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.hp-table-fixed {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}
.hp-table-fixed th,
.hp-table-fixed td {
  padding: 9px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-table-fixed td.wrap-cell {
  white-space: normal;
  word-break: break-word;
}

/* Badges de Historial Personal */
.badge-hp-consumo {
  display: inline-block;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-hp-prestamo {
  display: inline-block;
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-hp-atrasado {
  display: inline-block;
  background: rgba(220, 38, 38, 0.18);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.4);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  animation: pulseAtrasado 1.5s infinite alternate;
}
.badge-hp-devuelto {
  display: inline-block;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Tarjetas Móviles Historial Personal */
.hp-mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.hp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.hp-card-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.hp-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hp-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.3;
}
.hp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}
.hp-card-footer {
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Hoja de Impresión y Ficha Personal */
.hp-print-container {
  display: none;
}
@media print {
  body.printing-historial-personal * {
    visibility: hidden;
  }
  body.printing-historial-personal #hp-print-sheet,
  body.printing-historial-personal #hp-print-sheet * {
    visibility: visible;
  }
  body.printing-historial-personal #hp-print-sheet {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 24px;
    background: #fff !important;
    color: #000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
  }
  .hp-print-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
    margin-bottom: 14px;
  }
  .hp-print-title-box h2 {
    font-size: 18px;
    margin: 0 0 4px 0;
    font-weight: 800;
    color: #000 !important;
  }
  .hp-print-subtitle {
    font-size: 12px;
    color: #444 !important;
    margin: 0;
  }
  .hp-print-meta-box {
    text-align: right;
    font-size: 11px;
    color: #333 !important;
  }
  .hp-print-worker-info {
    display: flex;
    justify-content: space-between;
    background: #f4f4f5 !important;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 14px;
    color: #000 !important;
  }
  .hp-print-info-col div {
    margin-bottom: 3px;
  }
  .hp-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 24px;
    color: #000 !important;
  }
  .hp-print-table th, .hp-print-table td {
    border: 1px solid #ccc !important;
    padding: 6px 8px;
    text-align: left;
    color: #000 !important;
  }
  .hp-print-table th {
    background: #e4e4e7 !important;
    font-weight: bold;
  }
  .hp-print-signatures {
    display: flex;
    justify-content: space-around;
    margin-top: 40px;
    page-break-inside: avoid;
  }
  .hp-print-sig-col {
    text-align: center;
    width: 210px;
  }
  .hp-print-sig-line {
    border-top: 1px solid #000;
    margin-bottom: 8px;
  }
  .hp-print-sig-title {
    font-weight: bold;
    font-size: 12px;
    color: #000 !important;
  }
  .hp-print-sig-sub {
    font-size: 10px;
    color: #555 !important;
    margin-top: 2px;
  }
}


