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

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

:root {
  --sidebar-width: 270px;

  --card-bg: rgba(20, 20, 28, 0.7);

  --primary: #6D7FE1;
  --primary-dark: #5567c9;
  --primary-light: rgba(109, 127, 225, 0.15);
  --primary-hover: #5a6cd1;

  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);

  --bg: #0a0a0f;
  --surface: rgba(20, 20, 28, 0.7);
  --surface-hover: rgba(30, 30, 40, 0.8);
  --surface-glass: rgba(12, 12, 20, 0.6);
  --text: #ffffff;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --input-bg: rgba(255, 255, 255, 0.05);

  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  --shadow-float: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   REGLAS DE TEMA CLARO - ALTO CONTRASTE Y BLOQUES DE COLOR VIBRANTES
   ========================================================================== */
.light-theme {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: rgba(79, 70, 229, 0.1);
  --primary-hover: #4338ca;

  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);
  --success: #059669;
  --success-light: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.1);

  --bg: #eef2f6;
  --card-bg: #ffffff;
  --card-bg-solid: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.98);

  --text: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;

  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --input-bg: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.1);
  --shadow-float: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.light-theme body {
  background-color: #eef2f6 !important;
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(79, 70, 229, 0.06), transparent 50%),
    radial-gradient(ellipse at 85% 25%, rgba(14, 165, 233, 0.06), transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.05), transparent 50%) !important;
  color: #0f172a !important;
}

.light-theme .topbar {
  background: #ffffff !important;
  border-bottom: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}
.light-theme .topbar h2 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* SIDEBAR EN TEMA CLARO */
.light-theme .sidebar {
  background: #ffffff !important;
  border-right: 1.5px solid #cbd5e1 !important;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04) !important;
}
.light-theme .sidebar-header {
  border-bottom: 1.5px solid #e2e8f0 !important;
  background: #f8fafc !important;
}
.light-theme .search-box {
  border-bottom: 1.5px solid #e2e8f0 !important;
  background: #f8fafc !important;
}
.light-theme .search-box input {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}
.light-theme .search-box input:focus {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18) !important;
}
.light-theme .nav-section-title {
  color: #334155 !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}
.light-theme .nav-item {
  color: #334155 !important;
  font-weight: 600 !important;
  transition: all 0.15s ease !important;
}
.light-theme .nav-item:hover {
  background: #f1f5f9 !important;
  color: #4338ca !important;
  font-weight: 700 !important;
}
.light-theme .nav-item.active {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
}
.light-theme .nav-count {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  border: 1px solid #cbd5e1 !important;
}
.light-theme .nav-item.active .nav-count {
  background: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

/* HERO BANNER EN TEMA CLARO */
.light-theme .dash-hero-container,
.light-theme .dash-hero-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%) !important;
  border: 1.5px solid #4338ca !important;
  box-shadow: 0 8px 24px rgba(49, 46, 129, 0.25) !important;
  border-radius: 16px !important;
}
.light-theme .dash-hero-container h2,
.light-theme .dash-hero-banner h2 {
  color: #ffffff !important;
}
.light-theme .dash-hero-container p,
.light-theme .dash-hero-banner p {
  color: #e2e8f0 !important;
}
.light-theme .dash-hero-container .dash-quick-btn,
.light-theme .dash-hero-banner .dash-quick-btn {
  background: rgba(255, 255, 255, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}
.light-theme .dash-hero-container .dash-quick-btn:hover,
.light-theme .dash-hero-banner .dash-quick-btn:hover {
  background: rgba(255, 255, 255, 0.28) !important;
  border-color: #ffffff !important;
}
.light-theme .dash-hero-container .dash-quick-btn.primary-action,
.light-theme .dash-hero-banner .dash-quick-btn.primary-action {
  background: #ffffff !important;
  color: #3730a3 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

/* KPI CARDS 3.0 EN TEMA CLARO - BLOQUES DE COLOR */
.light-theme .dash-kpi-card-v3 {
  background: #ffffff !important;
  border: 2px solid #cbd5e1 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05) !important;
}
.light-theme .dash-kpi-card-v3:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1) !important;
}
.light-theme .dash-kpi-title-v3 {
  color: #334155 !important;
  font-weight: 800 !important;
}
.light-theme .dash-kpi-num-v3 {
  font-weight: 900 !important;
}
.light-theme .dash-kpi-footer-v3 {
  border-top: 1.5px solid #f1f5f9 !important;
  color: #475569 !important;
  font-weight: 700 !important;
}

/* BORDES Y COLORES ESPECÍFICOS DE KPIS */
.light-theme .dash-kpi-card-v3:nth-child(1) {
  border-color: #a7f3d0 !important;
}
.light-theme .dash-kpi-card-v3:nth-child(1) .dash-kpi-num-v3 {
  color: #059669 !important;
}
.light-theme .dash-kpi-card-v3:nth-child(1) .dash-kpi-icon-v3 {
  background: #d1fae5 !important;
  color: #059669 !important;
  border: 1px solid #a7f3d0 !important;
}

.light-theme .dash-kpi-card-v3:nth-child(2) {
  border-color: #fde68a !important;
}
.light-theme .dash-kpi-card-v3:nth-child(2) .dash-kpi-num-v3 {
  color: #d97706 !important;
}
.light-theme .dash-kpi-card-v3:nth-child(2) .dash-kpi-icon-v3 {
  background: #fef3c7 !important;
  color: #d97706 !important;
  border: 1px solid #fde68a !important;
}

.light-theme .dash-kpi-card-v3:nth-child(3) {
  border-color: #c7d2fe !important;
}
.light-theme .dash-kpi-card-v3:nth-child(3) .dash-kpi-num-v3 {
  color: #4f46e5 !important;
}
.light-theme .dash-kpi-card-v3:nth-child(3) .dash-kpi-icon-v3 {
  background: #e0e7ff !important;
  color: #4f46e5 !important;
  border: 1px solid #c7d2fe !important;
}

.light-theme .dash-kpi-card-v3:nth-child(4) {
  border-color: #fecaca !important;
}
.light-theme .dash-kpi-card-v3:nth-child(4) .dash-kpi-num-v3 {
  color: #dc2626 !important;
}
.light-theme .dash-kpi-card-v3:nth-child(4) .dash-kpi-icon-v3 {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}

/* PANELES DEL DASHBOARD EN TEMA CLARO */
.light-theme .dash-panel {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
  border-radius: 14px !important;
}
.light-theme .dash-panel h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}
.light-theme .dash-panel > div:first-child span {
  color: #475569 !important;
  font-weight: 600 !important;
}

/* TARJETAS DE HARDWARE Y DISPONIBILIDAD */
.light-theme .dash-hardware-card {
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
}
.light-theme .dash-hardware-card:hover {
  background: #ffffff !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15) !important;
}
.light-theme .dash-hardware-card h4 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* SEMÁFORO DE INSUMOS Y SIN STOCK EN TEMA CLARO */
.light-theme .dash-supply-card {
  background: #fff8f8 !important;
  border: 1.5px solid #fca5a5 !important;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.06) !important;
}
.light-theme .dash-supply-card:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
}
.light-theme .dash-supply-card h4 {
  color: #991b1b !important;
  font-weight: 800 !important;
}

/* CUADRILLAS EN TEMA CLARO */
.light-theme .dash-tech-card-v3 {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
}
.light-theme .dash-tech-card-v3:hover {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12) !important;
}
.light-theme .dash-tech-card-v3 h4 {
  color: #0f172a !important;
  font-weight: 800 !important;
}
.light-theme .tech-avatar-circle {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border: 1.5px solid #bae6fd !important;
  font-weight: 800 !important;
}

/* TABLAS Y LOTES EN TEMA CLARO */
.light-theme .material-group {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04) !important;
}
.light-theme .material-group.single-active {
  border-color: #4f46e5 !important;
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.2) !important;
}
.light-theme .material-card {
  background: #ffffff !important;
}
.light-theme .material-card:hover {
  background: #f8fafc !important;
}
.light-theme .material-card h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

.light-theme .subcategory-block {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
}
.light-theme .subcategory-block h4 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

.light-theme table {
  background: #ffffff !important;
}
.light-theme th {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}
.light-theme td {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
  font-weight: 500 !important;
}
.light-theme tr:hover td {
  background: #f1f5f9 !important;
}

/* BOTONES GLOBALES EN TEMA CLARO */
.light-theme .btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3) !important;
}
.light-theme .btn-secondary,
.light-theme .btn-icon {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #1e293b !important;
  font-weight: 600 !important;
}
.light-theme .btn-secondary:hover,
.light-theme .btn-icon:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

/* PILLS DE FILTRO */
.light-theme .timeline-pill {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  font-weight: 700 !important;
}
.light-theme .timeline-pill.active {
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 50%, rgba(109, 127, 225, 0.08), transparent 50%),
    radial-gradient(ellipse at 85% 30%, rgba(139, 92, 246, 0.06), transparent 50%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
  animation: orbFloat 20s infinite ease-in-out alternate;
}
.orb-1 {
  width: 45vw; height: 45vw;
  background: rgba(109, 127, 225, 0.12);
  top: -25vh; left: -15vw;
}
.orb-2 {
  width: 40vw; height: 40vw;
  background: rgba(139, 92, 246, 0.08);
  bottom: -25vh; right: -15vw;
  animation-delay: -7s;
}
.orb-3 {
  width: 35vw; height: 35vw;
  background: rgba(16, 185, 129, 0.05);
  top: 30vh; left: 40vw;
  animation-delay: -14s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 60px) scale(1.08); }
}

::selection { background: var(--primary-light); color: var(--text); }

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; min-width: 0; position: relative; z-index: 10; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.3;
}
.sidebar-header h1 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}
.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.search-box {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.search-box input:focus {
  border-color: var(--primary);
  background: rgba(109, 127, 225, 0.06);
  box-shadow: 0 0 0 3px rgba(109, 127, 225, 0.08);
}
.search-box input::placeholder { color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }

.sidebar-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-btn {
  width: 100% !important;
  justify-content: center !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px;
}
.sidebar-footer-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.sidebar-footer-btn {
  flex: 1 !important;
  justify-content: center !important;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  margin-bottom: 2px;
  gap: 10px;
  position: relative;
  user-select: none;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(109, 127, 225, 0.15), rgba(139, 92, 246, 0.1));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(109, 127, 225, 0.2);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, var(--primary), #a78bfa);
}

.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-item .nav-icon i[data-lucide] {
  width: 18px; height: 18px;
  stroke: var(--text-muted);
  transition: var(--transition-fast);
}

.nav-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-item:hover .nav-actions {
  display: flex !important;
}
.nav-item:hover .nav-badge {
  display: none !important;
}
.nav-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.nav-action-btn:hover {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
}
.nav-action-btn.danger:hover {
  background: var(--danger) !important;
  color: #ffffff !important;
  border-color: var(--danger) !important;
}
.light-theme .nav-action-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}
.nav-item:hover .nav-icon i[data-lucide] { stroke: var(--text-secondary); }
.nav-item.active .nav-icon i[data-lucide] { stroke: var(--primary); }

.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .nav-badge {
  background: rgba(109, 127, 225, 0.25);
  color: var(--primary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.view {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  min-height: 62px;
  gap: 12px;
  flex-wrap: nowrap;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.topbar h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#userInfo {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  padding: 0 4px;
  white-space: nowrap;
}

.btn-text-hide-sm {
  display: inline;
  white-space: nowrap;
}

/* Pantallas medianas y tablets: Colapsar botones secundarios limpiamente sin deformar */
@media (max-width: 1200px) {
  #userInfo { display: none !important; }
  .topbar-secondary { display: none !important; }
  #mobileOverflowBtn { display: inline-flex !important; }
  .topbar { padding: 10px 16px; }
  .topbar h2 { font-size: 15px; }
  .btn-text-hide-sm { display: none !important; }
  .btn-responsive-text {
    width: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
  }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  height: 38px;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
  border: none !important;
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35) !important;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-danger {
  background: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2) !important;
  border: none !important;
}
.btn-danger:hover { background: #dc2626 !important; }

.btn-sm { padding: 6px 14px; height: 34px; font-size: 13px; border-radius: 8px; }

.btn-icon {
  width: 38px; height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ===== VIEWS ===== */
.view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.view::-webkit-scrollbar { width: 6px; }

/* ===== DASHBOARD HEADER ===== */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.dash-header-left {
  display: flex;
  flex-direction: column;
}
.dash-welcome {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}
.dash-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.dash-header-right {
  text-align: right;
  flex-shrink: 0;
}
.dash-date {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: nowrap;
}

/* ===== DASHBOARD KPI ROW (3 métricas principales) ===== */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  backdrop-filter: blur(12px);
  transition: var(--transition);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255,255,255,0.1);
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon i { width: 22px; height: 22px; }
.kpi-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== DASHBOARD PANELS ROW (Movimientos + Alertas) ===== */
.dash-panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dash-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dash-panel-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.dash-panel-link {
  background: rgba(109,127,225,0.1);
  color: var(--primary);
  border: 1px solid rgba(109,127,225,0.2);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.dash-panel-link:hover {
  background: rgba(109,127,225,0.2);
}
.dash-panel-body {
  padding: 10px 20px 16px 20px;
  flex: 1;
  overflow-y: auto;
  max-height: 340px;
}

/* Alertas fusionadas */
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: rgba(255,255,255,0.02); border-radius: 6px; padding-left: 6px; margin-left: -6px; }
.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alert-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.alert-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== RESUMEN COMPACTO DE CATEGORÍAS ===== */
.dash-categories-summary {
  margin-bottom: 22px;
}
.cat-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  backdrop-filter: blur(12px);
}
.cat-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}
.cat-summary-item:hover {
  background: rgba(255,255,255,0.04);
}
.cat-summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
  max-width: 40%;
}
.cat-summary-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-summary-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
}
.cat-summary-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
  min-width: 30px;
}
.cat-summary-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  opacity: 0.8;
}
.cat-summary-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap !important;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cat-val-disp {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}
.cat-lbl-disp {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 1px;
}
.cat-sep {
  opacity: 0.35;
  font-size: 11px;
  margin: 0 2px;
  color: var(--text-muted);
}
.cat-val-tot {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.cat-lbl-tot {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== DASHBOARD CHART SECTION ===== */
.dash-chart-section {
  margin-bottom: 22px;
}

/* ===== LEGACY STATS GRID (ya no se usa en el dashboard pero se mantiene para compatibilidad) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-md);
  background: var(--card-accent-bg);
  border-color: var(--card-accent-border);
}
.stat-card:hover::before { opacity: 0.6; }

.stat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.stat-card-icon i {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  opacity: 0.6;
  transition: var(--transition-fast);
}
.stat-card:hover .stat-card-icon i {
  opacity: 1;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-right: 8px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-card .stat-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ===== DASHBOARD CHARTS ===== */
.dashboard-charts {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.chart-container, .summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}
.chart-container:hover, .summary-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.threshold-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.threshold-control input {
  width: 48px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

.chart-svg { overflow: visible; }
.chart-label { font-size: 12px; fill: var(--text-muted); dominant-baseline: middle; font-weight: 500; }
.chart-value { font-size: 12px; fill: var(--text); font-weight: 700; dominant-baseline: middle; font-variant-numeric: tabular-nums; }
.chart-track { fill: rgba(255, 255, 255, 0.03); rx: 4; }
.chart-bar { fill: var(--primary); transition: all 0.2s ease; opacity: 0.85; rx: 4; }
.chart-bar:hover, .chart-bar-highlight {
  fill: var(--primary-dark);
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(109,127,225,0.4));
}

.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.status-bar-wrap { display: flex; flex-direction: column; gap: 10px; }

.chart-legend { display: flex; gap: 20px; flex-wrap: wrap; }
.chart-legend-item { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.chart-legend-swatch { width: 10px; height: 10px; border-radius: 4px; display: inline-block; }

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.summary-card h4 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 600;
}
.summary-card .summary-item {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.summary-card .summary-item:last-child { border-bottom: none; }

/* ===== LOTE TOOLBAR (Registros por lote) ===== */
.lote-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  flex-wrap: wrap;
  gap: 10px;
}
.lote-toolbar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}
.lote-actions-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto; /* Empujar a la derecha en caso flex-wrap */
}

/* ===== TABLE CONTROLS ===== */
.table-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.table-controls input, .table-controls select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: var(--transition-fast);
  height: 36px;
}
.table-controls input { flex: 1; max-width: 280px; }
.table-controls input:focus, .table-controls select:focus,
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 127, 225, 0.1);
}

.group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.group-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px; height: 16px;
}

/* ===== TABLE ===== */
.table-container {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: auto;
  margin-top: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 0;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 14px;
}

th {
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 10;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}
th.sortable:hover { color: var(--primary); }

td {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  white-space: nowrap;
}

tr { transition: var(--transition-fast); }
tr:last-child td { border-bottom: none; }

tr:hover td {
  background: rgba(109, 127, 225, 0.04);
}

tr.stock-low td {
  background: rgba(239, 68, 68, 0.06);
}
tr.stock-low:hover td {
  background: rgba(239, 68, 68, 0.1);
}

.stock-low-badge {
  font-weight: 700;
  color: #f87171;
}

tr.group-header td {
  background: rgba(10, 10, 15, 0.4);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  padding: 8px 18px;
}

.actions-cell {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.actions-cell button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  transition: var(--transition-fast);
  white-space: nowrap;
}
.actions-cell button:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}
.actions-cell .btn-edit { color: var(--primary); }
.actions-cell .btn-edit:hover { background: rgba(109, 127, 225, 0.1); border-color: rgba(109, 127, 225, 0.2); }
.actions-cell .btn-delete { color: var(--danger); }
.actions-cell .btn-delete:hover { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }

.table-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-bottom: 4px;
  flex-wrap: wrap;
}
.table-pagination span {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 8px;
}
.table-pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
}
.table-pagination button:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}
.table-pagination button:disabled {
  opacity: 0.3;
  cursor: default;
  background: transparent;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(2, 4, 12, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 1;
}

.modal-content {
  background: rgba(18, 20, 30, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  width: 100%;
  max-width: 620px;
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: visible;
  position: relative;
  z-index: 100000;
}

.modal-content-sm { max-width: 420px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.modal-close:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  overflow-x: visible;
  flex: 1;
  min-height: 180px;
}
.modal-body::-webkit-scrollbar { width: 4px; }

#modalBody {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
#modalBody .form-group { margin-bottom: 0; }

.form-group-full { grid-column: span 2; }

@media (max-width: 600px) {
  #modalBody { grid-template-columns: 1fr; gap: 10px; }
  .form-group-full { grid-column: span 1; }
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(2, 4, 12, 0.3);
  flex-shrink: 0;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 12px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: var(--transition-fast);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 127, 225, 0.1);
  background: rgba(255, 255, 255, 0.04);
}
.form-group input::placeholder { color: var(--text-muted); }

/* Estilos legibles para opciones de desplegables (select > option) */
select option {
  background-color: #1a1b26 !important;
  color: #ffffff !important;
  padding: 8px 12px;
}
.light-theme select option {
  background-color: #ffffff !important;
  color: #1a1b26 !important;
}

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

/* ===== SEARCH RESULTS ===== */
.search-results {
  padding: 0 28px 16px;
}
.search-results h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.search-result-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(109, 127, 225, 0.1);
}
.search-result-item .sr-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.search-result-item .sr-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== IMPORT SECTION ===== */
.import-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
}
.import-controls input[type="file"] {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
}

.import-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 12px;
}

.import-success { color: var(--success); font-weight: 600; }
.import-error { color: var(--danger); font-weight: 600; }

.import-warnings-details {
  margin-top: 12px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #fbbf24;
}
.import-warnings-details summary {
  cursor: pointer;
  font-weight: 600;
}
.import-warnings-details ul { margin: 10px 0 0 18px; }
.import-warnings-details li { margin-bottom: 4px; }

/* ===== BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-badge.activo, .status-badge.nuevo {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}
.status-badge.usado {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}
.status-badge.inactivo {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}
.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}
.status-badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}
.status-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}
.status-badge.info {
  background: rgba(109, 127, 225, 0.1);
  color: #818cf8;
}

/* ===== NO DATA ===== */
.no-data {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.no-data p { font-size: 15px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  opacity: 0;
  transform: translateX(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
}
.toast-show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.toast-success {
  background: rgba(6, 78, 59, 0.9);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.toast-error {
  background: rgba(127, 29, 29, 0.9);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.toast-info {
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* ===== PERSONAL / RESPONSABLES ===== */
.personal-container {
  display: flex;
  gap: 20px;
  height: 100%;
  min-height: 0;
}
.personal-sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.personal-sidebar h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.personal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-fast);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
}
.personal-item:hover { background: rgba(255, 255, 255, 0.05); }
.personal-item.active {
  background: rgba(109, 127, 225, 0.08);
  border-color: rgba(109, 127, 225, 0.15);
}

.personal-detail {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ===== LUCIDE ICONS ===== */
i[data-lucide], svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2px;
  vertical-align: middle;
}
.btn-icon-text i[data-lucide] { margin-right: 6px; }

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .cat-summary-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 14px 18px !important;
  }
  .cat-summary-left {
    max-width: 45% !important;
  }
}

@media (max-width: 1100px) {
  .dashboard-charts { grid-template-columns: 1fr; }
  .dash-panels-row { grid-template-columns: 1fr; }
  .personal-container { flex-direction: column; }
  .personal-sidebar { width: 100%; max-height: 200px; }
}

@media (max-width: 900px) {
  body { font-size: 14px; }
  #mobileMenuBtn { display: inline-flex !important; }

  .sidebar {
    position: fixed;
    left: -290px;
    top: 0;
    height: 100vh;
    z-index: 9999;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    width: 290px;
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.8);
  }
  .sidebar.open { left: 0; }

  .main-content { padding: 0; }
  .view { padding: 12px; }

  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    min-height: 52px;
    flex-wrap: nowrap;
    position: relative;
  }
  .topbar-left {
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
  }
  .topbar h2 {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 160px);
  }

  /* En móvil: mover botones de categoría al menú overflow ⋮ para no saturar el título */
  #categoryHeaderActions { display: none !important; }
  .topbar-secondary { display: none !important; }
  #mobileOverflowBtn { display: inline-flex !important; }

  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .topbar-actions #userInfo { display: none !important; }
  .topbar-actions .btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 7px;
    white-space: nowrap;
    flex-shrink: 0;
    gap: 4px;
  }
  .topbar-actions .btn-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  /* Dashboard KPI en móvil */
  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }
  .kpi-card {
    padding: 12px 14px !important;
    gap: 8px !important;
  }
  .kpi-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }
  .kpi-icon i { width: 18px !important; height: 18px !important; }
  .kpi-value {
    font-size: 18px !important;
  }
  .kpi-label {
    font-size: 10px !important;
  }

  /* Resumen de Categorías en móvil (Gráficos grandes) */
  .cat-summary-grid {
    grid-template-columns: 1fr !important;
    padding: 16px !important;
    gap: 12px !important;
  }
  .cat-summary-item {
    padding: 12px 14px !important;
    background: rgba(255,255,255,0.02) !important;
    border-radius: 10px !important;
    gap: 12px !important;
  }
  .cat-summary-left i {
    width: 18px !important;
    height: 18px !important;
  }
  .cat-summary-name {
    font-size: 14px !important;
    font-weight: 700 !important;
  }
  .cat-summary-bar-track {
    height: 10px !important;
    border-radius: 5px !important;
  }
  .cat-summary-bar-fill {
    border-radius: 5px !important;
  }
  .cat-summary-value {
    font-size: 16px !important;
  }


  /* Paneles movimientos y alertas en móvil */
  .dash-panels-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
  }
  .dash-panel-header {
    padding: 12px 14px 10px 14px !important;
  }
  .dash-panel-header h3 {
    font-size: 13px !important;
  }
  .dash-panel-body {
    padding: 8px 14px 12px 14px !important;
    max-height: 250px !important;
  }
  .dash-panel-link {
    font-size: 11px !important;
    padding: 4px 10px !important;
  }

  /* Alertas en móvil */
  .alert-item {
    gap: 8px !important;
    padding: 8px 0 !important;
  }
  .alert-title {
    font-size: 12px !important;
  }
  .alert-badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }

  /* Gráfica en móvil */
  .dash-chart-section {
    margin-bottom: 14px !important;
  }
  .chart-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .chart-header h3 {
    font-size: 11px !important;
    max-width: 100% !important;
  }

  /* Toolbar de Lotes en móvil */
  .lote-toolbar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 14px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }
  .lote-toolbar-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    flex: 0 0 auto !important;
  }
  .lote-actions-group {
    display: flex !important;
    gap: 6px !important;
    margin-left: auto !important;
    justify-content: flex-end !important;
    align-items: center !important;
    flex-wrap: wrap !important;
  }
  .lote-actions-group .btn {
    flex: 0 0 auto !important;
    height: 32px !important;
    font-size: 11px !important;
    padding: 0 10px !important;
    border-radius: 7px !important;
    justify-content: center !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
  }

  /* Subcategorías / Series en móvil */
  .subcategory-block {
    padding: 12px 14px !important;
    margin-top: 10px !important;
    margin-bottom: 12px !important;
    border-radius: 8px !important;
  }
  .subcategory-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
    flex-wrap: wrap !important;
  }
  .subcategory-header h4 {
    font-size: 13px !important;
    flex: 1 1 auto !important;
    min-width: 150px !important;
  }
  .subcategory-header .btn-group {
    display: flex !important;
    gap: 6px !important;
    margin-left: auto !important;
  }
  .btn-text-dispatch {
    display: none !important;
  }
  .sub-dispatch-btn::after {
    content: "Salida";
  }
  .table-pagination {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  .table-controls { flex-direction: column; align-items: stretch; }
  .table-controls input { max-width: 100%; }
  .group-toggle { width: 100%; }

  .table-container {
    margin-top: 10px;
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
  }
  .actions-cell button {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .form-row { grid-template-columns: 1fr; gap: 10px; }
  .dash-summary { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-header { flex-direction: column; gap: 6px; }
  .dash-header-right { text-align: left; }

  .modal-content {
    width: 95%;
    max-height: 90vh;
    border-radius: var(--radius-xl);
  }
  .modal-header, .modal-body, .modal-footer {
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn { padding: 0 8px; font-size: 11px; height: 30px; }
  .topbar h2 { font-size: 13px; }
  .view { padding: 8px; }

  .material-card {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }
  .material-card > div:last-child {
    width: 100%;
    justify-content: flex-end !important;
    flex-wrap: nowrap;
    gap: 8px !important;
  }
  .material-card > div:last-child > span:first-child {
    margin-right: auto !important;
  }
  .material-card h3 {
    font-size: 13px !important;
    max-width: 100% !important;
  }

  div[id^="table-mat-"] {
    padding: 0 8px 12px 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  div[id^="table-mat-"] table {
    min-width: 500px;
  }

  /* Paginación */
  .pagination { flex-wrap: wrap; gap: 6px; }
  .pagination button { padding: 5px 10px; font-size: 11px; }

  /* Mapa */
  #leafletMap { height: 300px !important; }
}

/* ===== OVERFLOW MENU MÓVIL ===== */
.overflow-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.overflow-menu-item:last-child { border-bottom: none; }
.overflow-menu-item:hover { background: rgba(255,255,255,0.05); }
.overflow-menu-item svg,
.overflow-menu-item i { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }
.light-theme .overflow-menu-item:hover { background: rgba(0,0,0,0.04); }

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

/* ===== MOVEMENT PREVIEW ===== */
#moveStockCurrent, #moveStockNew {
  font-variant-numeric: tabular-nums;
}

/* ===== SPINNER ===== */
.spinner {
  display: inline-block;
  border: 3px solid rgba(255,255,255,0.06);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ===== RECENT MOVEMENTS ===== */
.recent-movements {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.recent-movements h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.rm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.rm-item:last-child { border-bottom: none; }
.rm-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rm-icon.entrada, .rm-icon.creacion { background: rgba(16,185,129,0.12); color: var(--success); }
.rm-icon.salida, .rm-icon.eliminacion { background: rgba(239,68,68,0.12); color: var(--danger); }
.rm-icon.modificacion { background: rgba(245,158,11,0.12); color: var(--warning); }
.rm-body { flex: 1; min-width: 0; }
.rm-producto { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rm-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.pagination button:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
}
.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== LOW STOCK ALERT ===== */
.low-stock-alert {
  background: var(--card-bg);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 12px;
  padding: 16px 20px;
}
.low-stock-alert h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
}
.low-stock-alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(239,68,68,0.05);
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
}
.low-stock-alert-item:hover {
  background: rgba(239,68,68,0.1);
}
.low-stock-alert-item .item-name {
  color: var(--text-primary);
  font-weight: 500;
}
.low-stock-alert-item .item-stock {
  color: var(--danger);
  font-weight: 600;
}

/* ===== SMART DROPDOWN / AUTOCOMPLETE PREMIUM ===== */
.smart-dropdown-wrapper {
  position: relative;
  width: 100%;
}
.smart-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(420px, 92vw);
  box-sizing: border-box;
  max-height: 250px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.98);
  border: 1.5px solid rgba(99, 102, 241, 0.45);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 15px rgba(99, 102, 241, 0.2);
  backdrop-filter: blur(24px);
  z-index: 100000;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 3px;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.smart-dropdown-menu.dropup {
  top: auto !important;
  bottom: calc(100% + 6px) !important;
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.75), 0 0 15px rgba(99, 102, 241, 0.2) !important;
  animation: dropupFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}
@keyframes dropupFadeIn {
  0% { opacity: 0; transform: translateY(8px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dropdownFadeIn {
  0% { opacity: 0; transform: translateY(-8px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.smart-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}
.smart-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}
.smart-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}
.smart-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text);
  font-size: 13px;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
  min-width: 0;
}
.smart-dropdown-item:hover,
.smart-dropdown-item.focused {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  transform: translateX(2px);
}
.smart-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
}
.smart-dropdown-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.smart-dropdown-text-col {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}
.smart-dropdown-title {
  font-weight: 600;
  line-height: 1.3;
}
.smart-dropdown-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}
.smart-dropdown-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.smart-dropdown-item.warehouse-item .smart-dropdown-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.smart-dropdown-highlight {
  color: #818cf8;
  background: rgba(129, 140, 248, 0.15);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}
.smart-dropdown-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 6px 10px 3px 10px;
  font-weight: 700;
  opacity: 0.7;
}
.smart-dropdown-empty {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ESTILOS DE GESTIÓN DE ALMACÉN EN DASHBOARD */
.warehouse-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.warehouse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.warehouse-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.warehouse-today-panel {
  background: var(--surface-glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.today-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.today-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.today-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.today-entradas .today-icon {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.today-salidas .today-icon {
  background: rgba(109, 127, 225, 0.15);
  color: var(--primary);
}

.today-devoluciones .today-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.today-info {
  display: flex;
  flex-direction: column;
}

.today-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.today-txt {
  font-size: 12px;
  color: var(--text-muted);
}

.warehouse-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.insight-card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.insight-header {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.insight-header h3 {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.insight-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.insight-item-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.insight-item-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.quick-op-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.quick-op-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Animación de Resaltado Temporal Suave */
.highlight-pulse {
  animation: highlightGlowFade 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes highlightGlowFade {
  0% {
    border-color: rgba(99, 102, 241, 0.9) !important;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.45) !important;
  }
  60% {
    border-color: rgba(99, 102, 241, 0.4) !important;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15) !important;
  }
  100% {
    border-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: none !important;
  }
}

/* Responsive Table & Subcategory Block Styles */
.material-group {
  box-sizing: border-box;
  max-width: 100%;
  outline: none !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.material-group.single-active {
  border-color: rgba(99, 102, 241, 0.4) !important;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.08) !important;
}

.material-card {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.material-card:focus,
.material-card:focus-visible,
.material-group:focus,
.material-group:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
div[id^="table-mat-"] {
  box-sizing: border-box;
  max-width: 100%;
}
.subcategory-block {
  box-sizing: border-box;
  max-width: 100%;
}
.subcategory-block > div[style*="overflow-x"],
div[id^="table-mat-"] > div[style*="overflow-x"] {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) rgba(255, 255, 255, 0.05);
  max-width: 100%;
}
.subcategory-block table,
div[id^="table-mat-"] table {
  min-width: 780px;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  div[id^="table-mat-"] {
    padding: 0 12px 12px 12px !important;
  }
  .subcategory-block {
    padding: 10px 12px !important;
  }
}

/* ===== VISUAL DISTINCTION FOR ROWS ===== */
tr.row-almacen {
  background-color: rgba(16, 185, 129, 0.04);
}
tr.row-almacen td:first-child {
  border-left: 3px solid var(--success);
}
tr.row-almacen:hover {
  background-color: rgba(16, 185, 129, 0.08) !important;
}
tr.row-dispatched {
  opacity: 0.65;
  transition: opacity 0.2s;
}
tr.row-dispatched:hover {
  opacity: 0.95;
}

/* ==========================================================================
   ENHANCED MOBILE & TABLET RESPONSIVE STYLES (< 768px and < 480px)
   ========================================================================== */

@media (max-width: 768px) {
  /* Prevent horizontal bouncing / overflow on mobile */
  html, body {
    overflow-x: hidden !important;
    position: relative;
    width: 100%;
  }

  #app {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .main-content {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Prevent iOS zoom on inputs */
  input, select, textarea, .form-control, .smart-input {
    font-size: 16px !important;
  }

  /* Topbar header on mobile */
  .topbar {
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  .topbar h2 {
    font-size: 14px !important;
    max-width: 140px;
  }

  #categoryHeaderActions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  #categoryHeaderActions button {
    font-size: 10px !important;
    padding: 2px 8px !important;
    height: 26px !important;
  }

  /* Table search & controls */
  .table-controls {
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  /* Material/Lote Card Header */
  .material-card {
    padding: 10px 12px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .material-card > div:last-child {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px !important;
  }

  /* Lote Actions Toolbar inside Accordion */
  div[id^="table-mat-"] {
    padding: 0 10px 12px 10px !important;
  }
  div[id^="table-mat-"] > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    margin-top: 10px !important;
    margin-bottom: 10px !important;
  }
  div[id^="table-mat-"] > div:first-child > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px !important;
  }
    div[id^="table-mat-"] > div:first-child > div:last-child button {
      flex: 1 1 auto;
      font-size: 11px !important;
      padding: 6px 10px !important;
      justify-content: center;
    }
}

/* Subcategory & Lote Contextual Dropdown (Global: Desktop and Mobile) */
.sub-menu-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.sub-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 99999;
  min-width: 185px;
  background: #14141c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 6px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-direction: column;
  gap: 4px;
}
.light-theme .sub-menu-dropdown {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15) !important;
}
.sub-menu-item {
  width: 100%;
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: transparent !important;
  border: none !important;
  border-radius: 6px;
  color: #f1f5f9 !important;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
}
.sub-menu-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}
.light-theme .sub-menu-item {
  color: #334155 !important;
  background: transparent !important;
}
.light-theme .sub-menu-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
.sub-menu-item.text-danger {
  color: #ef4444 !important;
}
.sub-menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #dc2626 !important;
}

/* ==========================================================================
   MOBILE RESPONSIVE: TABLE-TO-CARD TRANSFORMATION (< 768px)
   ========================================================================== */

@media (max-width: 768px) {
  /* Subcategory Header: Compact & Uncluttered */
  .subcategory-block {
    padding: 12px 10px !important;
    margin-top: 10px !important;
    margin-bottom: 14px !important;
  }
  .subcategory-block > div:first-child {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }
  .subcategory-block > div:first-child > div:first-child {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }
  .subcategory-block > div:first-child > div:first-child h4 {
    font-size: 12px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }

  /* Table-to-Cards: Zero Horizontal Scroll */
  .inventory-table, 
  .inventory-table tbody, 
  .inventory-table tr, 
  .inventory-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .inventory-table thead {
    display: none !important;
  }

  .inventory-table {
    min-width: 100% !important;
  }

  .inventory-table tr {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    margin-bottom: 10px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
    position: relative;
  }
  .light-theme .inventory-table tr {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  }

  .inventory-table td {
    padding: 5px 0 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: right !important;
    font-size: 13px !important;
    min-height: 28px;
  }

  .inventory-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
    text-align: left;
    flex-shrink: 0;
  }

  /* Mostrar índice numérico en modo tarjeta móvil */
  .inventory-table td[data-label="#"] {
    padding-bottom: 6px !important;
    font-weight: bold;
    color: var(--primary);
  }

  /* Resaltar Responsable en la parte superior como título de tarjeta */
  .inventory-table td[data-label="Responsable"] {
    padding-bottom: 8px !important;
    margin-bottom: 6px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #fff !important;
  }
  .light-theme .inventory-table td[data-label="Responsable"] {
    color: #0f172a !important;
    border-bottom-color: #f1f5f9 !important;
  }

  /* Botones de acción al pie de la tarjeta */
  .inventory-table td[data-label="Acciones"],
  .inventory-table td.actions-cell {
    display: flex !important;
    padding-top: 10px !important;
    margin-top: 8px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .light-theme .inventory-table td[data-label="Acciones"],
  .light-theme .inventory-table td.actions-cell {
    border-top-color: #f1f5f9 !important;
  }
  .inventory-table td[data-label="Acciones"]::before,
  .inventory-table td.actions-cell::before {
    display: none !important;
  }
  .inventory-table td[data-label="Acciones"] button,
  .inventory-table td.actions-cell button {
    flex: 0 0 auto !important;
    padding: 0 12px !important;
    height: 30px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    justify-content: center !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    cursor: pointer;
  }
  .inventory-table td.actions-cell .btn-edit {
    background: rgba(79, 70, 229, 0.12) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(79, 70, 229, 0.3) !important;
  }
  .inventory-table td.actions-cell .btn-delete {
    background: rgba(239, 68, 68, 0.12) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
  }

  /* Modals on mobile */
  .modal {
    padding: 10px !important;
  }
  .modal-content {
    width: 96% !important;
    max-width: 96% !important;
    max-height: 90vh !important;
    border-radius: 16px !important;
    margin: auto !important;
  }
  .modal-body {
    padding: 16px !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
  }
  .modal-footer {
    padding: 12px 16px !important;
    gap: 8px !important;
  }
  .modal-footer .btn {
    flex: 1;
    height: 42px !important;
    font-size: 13px !important;
    justify-content: center;
  }

  /* Smart dropdown suggestions menu on mobile */
  .smart-dropdown-menu {
    max-height: 200px !important;
    border-radius: 10px !important;
  }
  .smart-dropdown-item {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }

  /* Floating toast on mobile */
  #toastContainer {
    bottom: 16px !important;
    right: 16px !important;
    left: 16px !important;
    max-width: calc(100vw - 32px) !important;
  }
  .toast {
    width: 100% !important;
    font-size: 13px !important;
  }
}

@media (max-width: 480px) {
  .topbar h2 {
    font-size: 13px !important;
    max-width: 110px;
  }
}

/* ==========================================================================
   DASHBOARD 3.0 — CENTRO DE OPERACIONES FIBER Z
   ========================================================================== */

.dash-hero-container {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.light-theme .dash-hero-container {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-color: #e2e8f0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
}

.dash-hero-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.dash-capacity-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12.5px;
  font-weight: 600;
  color: #10b981;
}

.light-theme .dash-capacity-badge {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

.dash-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dash-quick-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.dash-quick-btn.primary-action {
  background: var(--primary);
  border-color: transparent;
  color: #ffffff;
}

.dash-quick-btn.primary-action:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
}

.light-theme .dash-quick-btn {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.light-theme .dash-quick-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* KPI Cards 3.0 */
.dash-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dash-kpi-card-v3 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.dash-kpi-card-v3:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.light-theme .dash-kpi-card-v3:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.dash-kpi-header-v3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dash-kpi-icon-v3 {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-kpi-num-v3 {
  font-size: 30px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.dash-kpi-title-v3 {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

.dash-kpi-footer-v3 {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.light-theme .dash-kpi-footer-v3 {
  border-top-color: #f1f5f9;
  color: #475569;
}

/* Flujo de Hardware Card */
.dash-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.dash-hardware-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dash-hardware-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

.light-theme .dash-hardware-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.light-theme .dash-hardware-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.flow-bar-segmented {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  margin: 11px 0 13px;
}

.light-theme .flow-bar-segmented {
  background: #e2e8f0;
}

/* Semáforo de Insumos */
.dash-supply-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dash-supply-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.light-theme .dash-supply-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.light-theme .dash-supply-card:hover {
  background: #ffffff;
}

/* Cuadrillas / Custodia */
.dash-tech-card-v3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dash-tech-card-v3:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(245, 158, 11, 0.45);
  transform: translateY(-2px);
}

.light-theme .dash-tech-card-v3 {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.light-theme .dash-tech-card-v3:hover {
  background: #ffffff;
}

.tech-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

/* Timeline Filter Pills */
.timeline-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.timeline-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timeline-pill:hover,
.timeline-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

#recentMovements {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#recentMovements::-webkit-scrollbar {
  width: 5px;
}

#recentMovements::-webkit-scrollbar-track {
  background: transparent;
}

#recentMovements::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

#recentMovements::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== SKELETON LOADERS DE ALTA GAMA ===== */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  border-radius: 8px;
}

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

.skeleton-card {
  height: 64px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  padding: 12px 18px;
  gap: 14px;
}

.skeleton-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 6px;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 35%;
}

.skeleton-text.medium {
  width: 60%;
}

/* Indicador de cálculo de stock en vivo */
.stock-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  transition: all 0.2s ease;
  margin-top: 8px;
}
.stock-preview-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.stock-preview-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.stock-preview-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}