/* =============================================
   BUSQUEDA MERCADERIA - Custom Styles
   ============================================= */


:root,
[data-theme="light"] {
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-surface-hover: #f0f2f5;
  --color-surface-alt: #eef1f5;
  --color-text: #1a1d23;
  --color-text-secondary: #5f6774;
  --color-text-muted: #8b93a0;
  --color-border: #dfe3e8;
  --color-primary: #0052cc;
  --color-primary-hover: #0047b3;
  --color-primary-light: #e8f0fe;
  --color-primary-dark: #0a2540;
  --color-success: #00a86b;
  --color-success-light: #e6f9f1;
  --color-danger: #e53e3e;
  --color-danger-light: #fde8e8;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-info: #3b82f6;
  --color-nav-bg: #0a2540;
  --color-nav-text: #ffffff;
  --color-nav-hover: rgba(255,255,255,0.1);
  --color-nav-active: rgba(255,255,255,0.2);
  --color-bottom-nav-bg: #ffffff;
  --color-bottom-nav-border: #dfe3e8;
  --color-card-bg: #ffffff;
  --color-card-shadow: rgba(0,0,0,0.06);
  --color-input-bg: #ffffff;
  --color-input-border: #cfd4de;
  --color-sidebar-width: 240px;
  --color-result-ubicacion-bg: #0052cc;
  --color-result-ubicacion-text: #ffffff;
}

[data-theme="dark"] {
  --color-bg: #0f1117;
  --color-surface: #1a1d27;
  --color-surface-hover: #242734;
  --color-surface-alt: #1e2130;
  --color-text: #e8eaed;
  --color-text-secondary: #9aa0ab;
  --color-text-muted: #6b7280;
  --color-border: #2c2f3e;
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-primary-light: #1e2d4a;
  --color-primary-dark: #0a1628;
  --color-success: #10b981;
  --color-success-light: #064e3b;
  --color-danger: #ef4444;
  --color-danger-light: #450a0a;
  --color-warning: #f59e0b;
  --color-warning-light: #451a03;
  --color-info: #3b82f6;
  --color-nav-bg: #0f1117;
  --color-nav-text: #e8eaed;
  --color-nav-hover: rgba(255,255,255,0.08);
  --color-nav-active: rgba(255,255,255,0.15);
  --color-bottom-nav-bg: #1a1d27;
  --color-bottom-nav-border: #2c2f3e;
  --color-card-bg: #1a1d27;
  --color-card-shadow: rgba(0,0,0,0.3);
  --color-input-bg: #1a1d27;
  --color-input-border: #2c2f3e;
  --color-result-ubicacion-bg: #2563eb;
  --color-result-ubicacion-text: #ffffff;
}

/* Dark theme: tabla corporativa */
[data-theme="dark"] .cmp-table-wrap {
  border-color: #2c2f3e;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .cmp-table thead th {
  background: #1e2d4a;
  color: #e8eaed;
  border-bottom: 1px solid #2c2f3e;
}

[data-theme="dark"] .cmp-table td {
  border-bottom-color: #252836;
  background: #1a1d27;
}

[data-theme="dark"] .cmp-table tbody tr:nth-child(even) td {
  background: #1e2130;
}

[data-theme="dark"] .cmp-table tbody tr:hover td {
  background: #242734;
}

[data-theme="dark"] .cmp-table .table-danger td:first-child {
  border-left-color: #ef4444;
}

[data-theme="dark"] .cmp-table .table-warning td:first-child {
  border-left-color: #f59e0b;
}

[data-theme="dark"] .cmp-table .table-info td:first-child {
  border-left-color: #3b82f6;
}

[data-theme="dark"] .cmp-table .table-success td:first-child {
  border-left-color: #10b981;
}

/* Dark theme: notificaciones */
[data-theme="dark"] .alert-danger {
  background: #2d0e0e;
  color: #f87171;
  border: 1px solid #4a1a1a;
}

[data-theme="dark"] .alert-warning {
  background: #2d2206;
  color: #fbbf24;
  border: 1px solid #4a380e;
}

[data-theme="dark"] .alert-success {
  background: #0a2e1a;
  color: #34d399;
  border: 1px solid #14522d;
}

[data-theme="dark"] .alert-info {
  background: #0d1f3d;
  color: #60a5fa;
  border: 1px solid #1a3a6a;
}

/* Dark theme: table-secondary (sin_sap, sin_stock) — solo borde izquierdo, fondo usa filas alternadas */
[data-theme="dark"] .cmp-table .table-secondary td {
  color: #6b7280;
}

[data-theme="dark"] .cmp-table .table-secondary td:first-child {
  border-left-color: #6b7280;
}

[data-theme="dark"] .cmp-badge.badge.bg-secondary {
  background-color: #374151 !important;
  color: #9ca3af !important;
}

/* Dark theme: badges en tabla comparar */
[data-theme="dark"] .cmp-badge.bg-warning {
  background-color: #a67c00 !important;
  color: #1a1d27 !important;
}

[data-theme="dark"] .cmp-badge.bg-danger {
  background-color: #7f1d1d !important;
  color: #fca5a5 !important;
}

[data-theme="dark"] .cmp-badge.bg-info {
  background-color: #1e3a5f !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .cmp-badge.bg-success {
  background-color: #065f46 !important;
  color: #6ee7b7 !important;
}


* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}


.login-page {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* Fondo animado */
.login-bg-fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  animation: loginFloat 18s ease-in-out infinite;
  will-change: transform;
}
.login-blob-1 {
  width: 420px;
  height: 420px;
  top: -140px;
  left: -120px;
  background: #3b82f6;
  animation-duration: 17s;
}
.login-blob-2 {
  width: 380px;
  height: 380px;
  bottom: -160px;
  right: -100px;
  background: #00d4b8;
  animation-duration: 21s;
  animation-delay: -6s;
}
.login-blob-3 {
  width: 300px;
  height: 300px;
  top: 45%;
  left: 55%;
  background: #7c3aed;
  animation-duration: 19s;
  animation-delay: -11s;
}

@keyframes loginFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -35px) scale(1.1); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 940px;
}

.login-card {
  display: flex;
  background: var(--color-surface);
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.35);
  overflow: hidden;
  animation: loginCardIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel de marca (izquierda en desktop) */
.login-brand {
  position: relative;
  flex: 0 0 40%;
  min-width: 0;
  overflow: hidden;
  padding: 3rem 2.3rem;
  display: flex;
  align-items: center;
  color: #fff;
  background: linear-gradient(160deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}

.login-brand-inner {
  position: relative;
  z-index: 1;
}

.login-brand-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 1.4rem;
}

.login-brand h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 0.6rem;
  line-height: 1.25;
}

.login-brand p {
  font-size: 0.9rem;
  opacity: 0.85;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.login-brand-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.login-brand-features li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.83rem;
  opacity: 0.92;
}

.login-brand-features i {
  color: #4ade80;
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* Panel del formulario (derecha en desktop) */
.login-form-panel {
  flex: 1;
  min-width: 0;
  padding: 3rem 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-header {
  margin-bottom: 1.75rem;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
}

.login-header p {
  font-size: 0.9rem;
  margin: 0.4rem 0 0;
}

.login-alert {
  animation: loginFadeUp 0.4s ease both;
  margin-bottom: 1rem;
}

.login-field {
  animation: loginFadeUp 0.5s ease both;
  animation-delay: calc(var(--d, 0) * 90ms + 90ms);
}

@keyframes loginFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-form .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--color-text-secondary);
}

.login-form .input-group-text {
  background: var(--color-surface-alt);
  border: 2px solid var(--color-input-border);
  border-right: none;
  color: var(--color-text-muted);
}

.login-form .form-control {
  border: 2px solid var(--color-input-border);
  border-left: none;
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.25rem rgba(59,130,246,0.15);
}

.login-form .input-group:focus-within .input-group-text,
.login-form .input-group:focus-within .login-toggle-pass {
  border-color: var(--color-primary);
}

/* Bot\u00f3n mostrar/ocultar contrase\u00f1a */
.login-toggle-pass {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  background: var(--color-surface-alt);
  border: 2px solid var(--color-input-border);
  border-left: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
.login-toggle-pass:hover,
.login-toggle-pass:focus-visible {
  color: var(--color-primary);
  outline: none;
}

.login-form .btn.login-submit {
  padding: 0.85rem;
  font-weight: 700;
  border-radius: 12px;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.login-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0,82,204,0.35);
}
.login-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}
.login-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.login-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
  animation: login-spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes login-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .login-blob,
  .login-card,
  .login-alert,
  .login-field {
    animation: none !important;
  }
}

@media (max-width: 959.98px) {
  .login-card {
    flex-direction: column;
    border-radius: 20px;
  }
  .login-brand {
    padding: 1.75rem 1.75rem 1.5rem;
  }
  .login-brand p {
    margin-bottom: 1.1rem;
  }
  .login-form-panel {
    padding: 2rem 1.75rem 2.25rem;
  }
}

@media (max-width: 560px) {
  .login-brand-features {
    display: none;
  }
  .login-brand-icon {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    margin-bottom: 0.9rem;
  }
  .login-brand h2 {
    font-size: 1.2rem;
  }
  .login-brand p {
    font-size: 0.85rem;
    margin-bottom: 0;
  }
}


.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--color-sidebar-width);
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand i {
  font-size: 1.5rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--color-nav-text);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
  opacity: 0.75;
}

.sidebar-link:hover {
  background: var(--color-nav-hover);
  opacity: 1;
  color: var(--color-nav-text);
}

.sidebar-link.active {
  background: var(--color-nav-active);
  opacity: 1;
}

.sidebar-link i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .user-info {
  margin: 0.75rem 0;
}

.sidebar-footer .user-name {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
}

.sidebar-footer .user-role {
  font-size: 0.78rem;
  opacity: 0.65;
}

.theme-toggle {
  text-align: center;
  margin-bottom: 0.5rem;
}

.theme-toggle .btn {
  border-color: rgba(255,255,255,0.2);
  color: var(--color-nav-text);
  width: 100%;
  padding: 0.5rem;
}

.theme-toggle .btn:hover {
  background: rgba(255,255,255,0.1);
}


.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--color-sidebar-width);
  padding: 1.5rem;
  padding-bottom: 80px;
  min-height: 100vh;
  overflow-x: hidden;
}


.bottom-nav-wrap {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
}

.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--color-bottom-nav-bg);
  border-top: 1px solid var(--color-bottom-nav-border);
  padding: 0.35rem 0;
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin: 0 auto;
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.75rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 56px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.bottom-nav-link i {
  font-size: 1.35rem;
}

.bottom-nav-link.active {
  color: var(--color-primary);
}

.bottom-nav-link:hover {
  color: var(--color-primary);
  background: var(--color-surface-hover);
}

/* Responsive nav: fewer items on small screens */
.nav-item-controlar { display: none; }
.nav-item-import { display: none; }
.drawer-item-controlar { display: none; }
.drawer-item-import { display: none; }

@media (min-width: 420px) {
  .nav-item-controlar { display: flex; }
}

@media (min-width: 520px) {
  .nav-item-import { display: flex; }
}

/* More drawer - slides up from behind bottom-nav */
.more-drawer {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-bottom-nav-bg);
  border-top: 1px solid var(--color-bottom-nav-border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  padding: 0.6rem 0.75rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  transform: translateY(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s, visibility 0.25s;
  z-index: 1;
}

.more-drawer.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.more-drawer-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.65rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 52px;
}

.more-drawer-link i {
  font-size: 1.25rem;
}

.more-drawer-link.active {
  color: var(--color-primary);
}

.more-drawer-link:hover {
  color: var(--color-primary);
  background: var(--color-surface-hover);
}

/* Overlay to close drawer on tap outside */
.more-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0,0,0,0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.more-overlay.open {
  opacity: 1;
  visibility: visible;
}


.search-page {
  max-width: 800px;
  margin: 0 auto;
}

.search-header {
  margin-bottom: 1rem;
}

.sucursal-selector label {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.sucursal-selector .form-select {
  background: var(--color-input-bg);
  color: var(--color-text);
  border: 2px solid var(--color-input-border);
  font-weight: 500;
  padding: 0.6rem 1rem;
}

.sucursal-badge {
  display: inline-flex;
  align-items: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}


.search-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  padding-bottom: 0.5rem;
}

.search-bar {
  padding-bottom: 0.5rem;
}

.search-bar .input-group-text {
  background: var(--color-input-bg);
  border: 2px solid var(--color-input-border);
  border-right: none;
  color: var(--color-text-muted);
}

.search-bar .form-control {
  border: 2px solid var(--color-input-border);
  border-left: none;
  border-right: none;
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 1rem;
  padding: 0.85rem 1rem;
}

.search-bar .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.search-bar .btn {
  border: 2px solid var(--color-primary);
  background: var(--color-primary);
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}


.search-placeholder {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.search-placeholder i {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.search-placeholder h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  gap: 0.75rem;
}

.view-toggle .btn {
  padding: 0.35rem 0.6rem;
  line-height: 1;
  font-size: 1rem;
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.view-toggle .btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.view-toggle .btn:hover:not(.active) {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.result-count {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.search-results.view-cards .cards-view {
  display: grid;
  gap: 0.75rem;
}

.search-results.view-cards .result-card {
  background: var(--color-card-bg);
  border-radius: 14px;
  box-shadow: 0 2px 8px var(--color-card-shadow);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--color-border);
}

.search-results.view-cards .result-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--color-card-shadow);
}

.search-results.view-cards .result-ubicacion {
  background: var(--color-result-ubicacion-bg);
  color: var(--color-result-ubicacion-text);
  padding: 0.7rem 1.1rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-results.view-cards .result-ubicacion::before {
  content: "\F132";
  font-family: "bootstrap-icons";
  font-size: 1.25rem;
  opacity: 0.8;
}

.search-results.view-cards .result-body {
  padding: 0.9rem 1.1rem;
}

.search-results.view-cards .result-descripcion {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.search-results.view-cards .result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.search-results.view-cards .result-cantidad {
  display: inline-block;
  background: var(--color-success-light);
  color: var(--color-success);
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
}

.search-results.view-cards .result-sku,
.search-results.view-cards .result-ean,
.search-results.view-cards .result-atributo {
  display: inline-block;
  background: var(--color-surface-alt);
}

.search-results.view-cards .result-atributo {
  color: var(--color-warning);
  font-weight: 600;
}

.td-atributo {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-warning);
}

.cmp-badge-atributo {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-warning);
}

.cmp-badge-seccion {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-info);
}

.cmp-badge-familia {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-purple, #7c3aed);
}

.td-familia {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.cmp-familia-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 10px 8px;
}

.cmp-familia-search .bi-search {
  position: absolute;
  left: 10px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  pointer-events: none;
}

.cmp-familia-search-input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  border: 1px solid var(--color-border, #d6dbe3);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--color-bg, #fff);
  color: var(--color-text, #1f2733);
  outline: none;
}

.cmp-familia-search-input:focus {
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.td-seccion {
  text-align: center;
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  color: var(--color-text-secondary);
}

.result-seccion {
  display: inline-block;
  background: var(--color-info);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.ctrl-item-seccion {
  display: inline-block;
  font-size: 0.7rem;
  background: var(--color-info);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  margin-left: 0.25rem;
}

.search-results.view-cards .result-boleta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.search-results.view-cards .result-boleta::before {
  content: "Boleta: ";
  font-weight: 600;
}

.search-results.view-cards .result-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--color-border);
}

@media (min-width: 576px) {
  .search-results.view-cards .cards-view {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 992px) {
  .search-results.view-cards .cards-view {
    grid-template-columns: 1fr 1fr;
  }
}

.search-results.view-list {
  gap: 0;
}

.list-view {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}

.list-item:first-child {
  border-radius: 12px 12px 0 0;
}

.list-item:last-child {
  border-bottom: none;
  border-radius: 0 0 12px 12px;
}

.list-item:hover {
  background: var(--color-surface-hover);
}

.list-item-ubicacion {
  flex-shrink: 0;
  background: var(--color-result-ubicacion-bg);
  color: var(--color-result-ubicacion-text);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  min-width: 72px;
  text-align: center;
  line-height: 1.3;
}

.list-item-body {
  flex: 1;
  min-width: 0;
}

.list-item-desc {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.list-item-meta .badge {
  font-size: 0.7rem;
  font-weight: 700;
}

/* Table view */
.search-results.view-table {
  gap: 0;
}

.view-table {
  margin: 0;
  font-size: 0.85rem;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.view-table thead th {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0.65rem 0.85rem;
  border: none;
  position: sticky;
  top: 0;
  z-index: 2;
}

.view-table thead th:first-child { border-radius: 12px 0 0 0; }
.view-table thead th:last-child { border-radius: 0 12px 0 0; }

.view-table td {
  padding: 0.5rem 0.85rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card-bg);
  transition: background 0.12s;
}

.view-table tbody tr:nth-child(even) td {
  background: var(--color-surface-alt);
}

.view-table tbody tr:hover td {
  background: var(--color-primary-light);
}

.view-table tbody tr:last-child td:first-child { border-radius: 0 0 0 12px; }
.view-table tbody tr:last-child td:last-child { border-radius: 0 0 12px 0; }

.td-ubicacion strong {
  color: var(--color-primary);
  font-size: 0.9rem;
  background: var(--color-primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  display: inline-block;
}

.td-cantidad {
  font-weight: 700;
  color: var(--color-success);
  text-align: center;
  font-size: 0.95rem;
}

.td-sku {
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.td-boleta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-family: monospace;
}

/* Scroll sentinel */
.scroll-sentinel {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.scroll-sentinel:not(.loading) .spinner-border {
  display: none;
}

.scroll-sentinel.loading .spinner-border {
  display: inline-block;
}

.td-boleta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* Pagination */
.pagination-nav {
  margin-top: 1.25rem;
  margin-bottom: 1rem;
}

.pagination-nav .page-link {
  background: var(--color-card-bg);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  margin: 0 2px;
}

.pagination-nav .page-item.active .page-link {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.pagination-nav .page-item.disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
}

.pagination-nav .page-link:hover:not(.disabled) {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay .spinner-border {
  width: 3rem;
  height: 3rem;
}


.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.search-loading {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
}




.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.no-results i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}


.import-page,
.import-preview-page {
  max-width: 900px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.import-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .import-cards {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

.import-card {
  background: var(--color-card-bg);
  border-radius: 18px;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 10px var(--color-card-shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.import-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.import-card-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
}

.import-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--color-text);
}

.import-card-head p {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.35;
}

.import-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.import-sucursal-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  margin-top: 0.75rem;
  border-radius: 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.85rem;
}
.import-sucursal-info i { font-size: 1.1rem; }
.import-sucursal-warn {
  background: #fef3c7;
  color: #92400e;
}
.import-sucursal-warn a { color: #92400e; font-weight: 600; }
[data-theme="dark"] .import-sucursal-warn {
  background: #422006;
  color: #fbbf24;
}
[data-theme="dark"] .import-sucursal-warn a { color: #fbbf24; }

/* Dropzone */
.import-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 148px;
  min-width: 0;
  width: 100%;
  border: 2px dashed var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-alt);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.08s ease;
  padding: 1rem;
}
.import-dropzone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.import-dropzone:active {
  transform: scale(0.995);
}
.import-dropzone--drag {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  border-style: solid;
}
.import-dropzone--filled {
  border-style: solid;
  border-color: var(--color-success);
  background: var(--color-success-light);
}

.import-dz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  pointer-events: none;
}
.import-dz-cloud {
  font-size: 2.2rem;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
}
.import-dz-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}
.import-dz-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.import-dz-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  pointer-events: none;
}
.import-dz-file-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.import-dz-file-icon svg {
  width: 100%;
  height: 100%;
}
.import-dz-file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.import-dz-file-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-dz-file-size {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.import-dz-remove {
  pointer-events: auto;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.import-dz-remove:hover {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* Bot\u00f3n de importar */
.btn-import {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}
.btn-import i { font-size: 1.1rem; }
.btn-import:active:not(:disabled) {
  transform: scale(0.985);
}
.btn-import:disabled {
  background: var(--color-text-muted) !important;
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-import-primary {
  background: var(--color-primary);
}
.btn-import-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}
.btn-import-success {
  background: var(--color-success);
}
.btn-import-success:hover:not(:disabled) {
  background: #009160;
}

.import-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: import-spin 0.7s linear infinite;
}
@keyframes import-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 767.98px) {
  .import-card {
    padding: 1.25rem;
  }
  .import-dropzone {
    min-height: 130px;
  }
}

.preview-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.preview-card {
  background: var(--color-card-bg);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.preview-card-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.preview-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.preview-card-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-card-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.preview-card-count {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  background: var(--color-surface-alt);
}

.preview-count-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
}

.preview-count-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-muted);
}

/* Alertas de la vista previa */
.preview-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-top: 1rem;
  font-size: 0.88rem;
  line-height: 1.4;
}
.preview-alert:first-of-type {
  margin-top: 1.25rem;
}

.preview-alert-icon {
  flex-shrink: 0;
  font-size: 1.2rem;
  margin-top: 0.1rem;
}

.preview-alert-body strong {
  display: inline-block;
  margin-bottom: 0.15rem;
}

.preview-alert-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}
.preview-alert-list li {
  margin-bottom: 0.2rem;
}

.preview-alert-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.preview-alert-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

/* Acciones (confirmar / cancelar) */
.preview-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.preview-actions .btn-import {
  flex: 1;
  min-width: 160px;
  width: auto;
}

.btn-import-outline {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text-secondary);
  text-decoration: none;
}
.btn-import-outline:hover {
  border-color: var(--color-text-muted);
  background: var(--color-surface-alt);
  color: var(--color-text);
}

@media (max-width: 480px) {
  .preview-actions {
    flex-direction: column-reverse;
  }
  .preview-actions .btn-import {
    width: 100%;
  }
}


.crud-page {
  max-width: 960px;
  margin: 0 auto;
}

.crud-table-wrapper {
  background: var(--color-card-bg);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--color-card-shadow);
}

.crud-table {
  margin: 0;
}

.crud-table thead th {
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.crud-table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.crud-table tbody tr:last-child td {
  border-bottom: none;
}

.crud-search .input-group-text {
  background: var(--color-input-bg);
  border: 2px solid var(--color-input-border);
  border-right: none;
  color: var(--color-text-muted);
}

.crud-search .form-control {
  border: 2px solid var(--color-input-border);
  border-left: none;
  background: var(--color-input-bg);
  color: var(--color-text);
}

.crud-form {
  background: var(--color-card-bg);
  border-radius: 14px;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 8px var(--color-card-shadow);
  max-width: 600px;
}

.crud-form .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.crud-form .form-control,
.crud-form .form-select {
  background: var(--color-input-bg);
  color: var(--color-text);
  border: 2px solid var(--color-input-border);
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

.crud-form .form-control:focus,
.crud-form .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.25rem rgba(59,130,246,0.15);
}

.crud-form .btn {
  border-radius: 12px;
  font-weight: 600;
  padding: 0.85rem;
}


@media (max-width: 767.98px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-bottom: 90px;
  }

  .bottom-nav-wrap {
    display: block;
  }

  .search-sticky {
    padding-top: 0;
  }

  .result-ubicacion {
    font-size: 1.3rem;
    padding: 0.6rem 0.9rem;
  }

  .result-body {
    padding: 0.75rem 0.9rem;
  }

  .login-form-panel {
    padding: 1.75rem 1.5rem 2rem;
  }

  .crud-form {
    padding: 1.25rem;
  }

  .crud-table td,
  .crud-table th {
    padding: 0.6rem 0.75rem;
  }

  .import-card {
    padding: 1.25rem;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px;
    padding: 1.25rem;
  }

  .bottom-nav-wrap {
    display: none;
  }
}

@media (min-width: 1024px) {
  .bottom-nav-wrap {
    display: none;
  }

  .main-content {
    padding: 2rem;
  }
}


.btn {
  border-radius: 10px;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  transition: all 0.2s;
}

.btn-lg {
  border-radius: 12px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-success {
  background: var(--color-success);
  border-color: var(--color-success);
}

.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
}

/* ========== HOME / DASHBOARD ========== */
.home-page {
  max-width: 960px;
  margin: 0 auto;
}

.home-header {
  margin-bottom: 1.75rem;
  animation: homeFadeIn 0.4s ease-out;
}

.home-greeting h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-greeting p {
  font-size: 0.95rem;
  margin: 0.25rem 0 0;
}

.home-cards {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 576px) {
  .home-cards { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 992px) {
  .home-cards { grid-template-columns: 1fr 1fr; }
}

.home-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem;
  background: var(--color-card-bg);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 8px var(--color-card-shadow);
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  animation: homeCardIn 0.5s ease-out both;
}

.home-card:nth-child(1) { animation-delay: 0.05s; }
.home-card:nth-child(2) { animation-delay: 0.12s; }
.home-card:nth-child(3) { animation-delay: 0.19s; }
.home-card:nth-child(4) { animation-delay: 0.26s; }
.home-card:nth-child(5) { animation-delay: 0.33s; }
.home-card:nth-child(6) { animation-delay: 0.40s; }

.home-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 3px 3px 0;
  transition: width 0.2s;
}

.home-card-search::before { background: var(--color-primary); }
.home-card-compare::before { background: var(--color-warning); }
.home-card-controlar::before { background: var(--color-info); }
.home-card-import::before { background: var(--color-success); }
.home-card-sucursales::before { background: var(--color-info); }
.home-card-usuarios::before { background: var(--color-danger); }

.home-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--color-card-shadow);
  border-color: var(--color-primary);
}

.home-card:hover::before { width: 6px; }

.home-card-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  transition: transform 0.2s;
}

.home-card-search .home-card-icon { background: var(--color-primary); }
.home-card-compare .home-card-icon { background: var(--color-warning); }
.home-card-controlar .home-card-icon { background: var(--color-info); }
.home-card-import .home-card-icon { background: var(--color-success); }
.home-card-sucursales .home-card-icon { background: var(--color-info); }
.home-card-usuarios .home-card-icon { background: var(--color-danger); }

.home-card:hover .home-card-icon { transform: scale(1.08); }

.home-card-body { flex: 1; min-width: 0; }
.home-card-body h3 { font-size: 1rem; font-weight: 700; margin: 0 0 0.2rem; color: var(--color-text); }
.home-card-body p { font-size: 0.8rem; color: var(--color-text-secondary); margin: 0; line-height: 1.35; }

.home-card-arrow {
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  transition: transform 0.2s, color 0.2s;
}

.home-card:hover .home-card-arrow {
  transform: translateX(4px);
  color: var(--color-primary);
}

@keyframes homeFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes homeCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 575.98px) {
  .home-card { padding: 1rem; gap: 0.85rem; }
  .home-card-icon { width: 44px; height: 44px; font-size: 1.15rem; }
  .home-card-body h3 { font-size: 0.95rem; }
  .home-card-body p { font-size: 0.75rem; }
}

/* ========== SUCURSAL SELECTOR MEJORADO ========== */
/* ========== SUCURSAL SELECT — moderno corporativo ========== */
.sucursal-select-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sucursal-select-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sucursal-select-label i {
  font-size: 0.85rem;
  color: var(--color-primary);
}

.sucursal-select-label span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}

.sucursal-select-card .form-select {
  width: 100%;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 0.9rem 2.75rem 0.9rem 1.1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  background-color: var(--color-card-bg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%238b93a0' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px 16px;
}

.sucursal-select-card .form-select:hover {
  border-color: var(--color-text-muted);
  background-color: var(--color-surface-hover);
}

.sucursal-select-card .form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
  background-color: var(--color-card-bg);
}

.sucursal-select-card .form-select optgroup,
.sucursal-select-card .form-select option {
  font-weight: 400;
  font-size: 0.95rem;
  padding: 0.5rem 0.8rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.sucursal-select-card .form-select option:first-child {
  color: var(--color-text-muted);
}

[data-theme="dark"] .sucursal-select-card .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

@media (max-width: 575.98px) {
  .sucursal-select-card .form-select {
    padding: 0.75rem 2.5rem 0.75rem 0.9rem;
    font-size: 1rem;
    border-radius: 10px;
  }
}

.form-control,
.form-select {
  font-size: 1rem;
  border-radius: 10px;
}

.toast {
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.modal-content {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.modal-header {
  border-bottom-color: var(--color-border);
}

.modal-footer {
  border-top-color: var(--color-border);
}

.alert {
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  padding: 0.85rem 1rem;
}

.alert-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.alert-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.alert-success {
  background: var(--color-success-light);
  color: var(--color-success);
  border-color: var(--color-success);
}


::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ========== COMPARAR - Premium Mobile-First ========== */

.cmp-page {
  max-width: 1200px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 0 0.25rem;
}

/* Controls row - mobile-first */
.cmp-controls-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 576px) {
  .cmp-controls-row {
    flex-direction: row;
    align-items: flex-end;
    gap: 0.75rem;
  }
}

.cmp-controls-select {
  flex: 1;
  min-width: 0;
}

.cmp-controls-select .form-select {
  font-size: 0.9rem;
}

.cmp-controls-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.cmp-controls-actions .btn {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  white-space: nowrap;
  border-radius: 12px;
}

@media (min-width: 576px) {
  .cmp-controls-actions .btn {
    padding: 0.5rem 1.2rem;
  }
}

/* Loading */
#cmpLoading .spinner-border {
  width: 2.2rem;
  height: 2.2rem;
  border-width: 0.2rem;
}

/* ========== Resumen Premium ========== */
.cmp-resumen {
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.88) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(226,232,240,0.6);
  box-shadow: 0 4px 16px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.cmp-resumen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #0ea5e9, #22c55e, #f59e0b, #ef4444);
  border-radius: 20px 20px 0 0;
  opacity: 0.7;
}

.cmp-resumen {
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.92) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(226,232,240,0.7);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04), 0 8px 32px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.9);
  margin-bottom: 0.6rem;
  position: relative;
  overflow: hidden;
}

.cmp-resumen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #0ea5e9, #22c55e, #f59e0b, #ef4444);
  border-radius: 16px 16px 0 0;
  opacity: 0.5;
}

.cmp-resumen {
  background: #ffffff;
  border-radius: 18px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(226,232,240,0.8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 8px 32px rgba(0,0,0,0.05);
  margin-bottom: 0.6rem;
  position: relative;
  overflow: hidden;
}

.cmp-resumen-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cmp-resumen-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cmp-stat {
  flex: 1 1 calc(33.333% - 0.35rem);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 0.35rem 0.55rem;
  border-radius: 16px;
  background: rgba(250,251,253,0.95);
  border: 1px solid rgba(241,245,249,0.9);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  cursor: default;
}

.cmp-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border-color: rgba(226,232,240,1);
  background: #ffffff;
}

.cmp-stat:active {
  transform: scale(0.97);
}

.cmp-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  position: relative;
  z-index: 1;
  transition: transform 0.3s;
}

.cmp-stat:hover .cmp-stat-icon {
  transform: scale(1.1);
}

.cmp-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.cmp-stat-label {
  font-size: 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--color-text-muted);
  font-weight: 700;
  white-space: nowrap;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.cmp-stat-purple .cmp-stat-icon { color: #6366f1; background: rgba(99,102,241,0.08); }
.cmp-stat-purple:hover { border-color: rgba(99,102,241,0.3); box-shadow: 0 8px 24px rgba(99,102,241,0.08); }
.cmp-stat-blue .cmp-stat-icon { color: #0ea5e9; background: rgba(14,165,233,0.08); }
.cmp-stat-blue:hover { border-color: rgba(14,165,233,0.3); box-shadow: 0 8px 24px rgba(14,165,233,0.08); }
.cmp-stat-amber .cmp-stat-icon { color: #d97706; background: rgba(245,158,11,0.08); }
.cmp-stat-amber:hover { border-color: rgba(245,158,11,0.3); box-shadow: 0 8px 24px rgba(245,158,11,0.08); }
.cmp-stat-red .cmp-stat-icon { color: #dc2626; background: rgba(239,68,68,0.08); }
.cmp-stat-red:hover { border-color: rgba(239,68,68,0.3); box-shadow: 0 8px 24px rgba(239,68,68,0.08); }
.cmp-stat-green .cmp-stat-icon { color: #16a34a; background: rgba(34,197,94,0.08); }
.cmp-stat-green:hover { border-color: rgba(34,197,94,0.3); box-shadow: 0 8px 24px rgba(34,197,94,0.08); }
.cmp-stat-orange .cmp-stat-icon { color: #ea580c; background: rgba(249,115,22,0.08); }
.cmp-stat-orange:hover { border-color: rgba(249,115,22,0.3); box-shadow: 0 8px 24px rgba(249,115,22,0.08); }
.cmp-stat-muted .cmp-stat-icon { color: #64748b; background: rgba(148,163,184,0.08); }
.cmp-stat-muted:hover { border-color: rgba(148,163,184,0.3); box-shadow: 0 8px 24px rgba(148,163,184,0.06); }

.cmp-stat-ok .cmp-stat-num { color: #16a34a; }
.cmp-stat-warn .cmp-stat-num { color: #d97706; }
.cmp-stat-danger .cmp-stat-num { color: #dc2626; }

.cmp-resumen-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: #fafbfc;
  border-radius: 10px;
  border: 1px solid rgba(241,245,249,0.8);
  font-size: 0.6rem;
  color: var(--color-text-muted);
  font-weight: 500;
  flex-wrap: nowrap;
}

.cmp-footer-left {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.cmp-footer-left i {
  font-size: 0.65rem;
  color: var(--color-text-dim);
}

.cmp-footer-import {
  white-space: nowrap;
}

.cmp-footer-import strong {
  color: var(--color-text);
  font-weight: 700;
}

.cmp-footer-right {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.cmp-sucursal-tag {
  font-size: 0.58rem;
  color: var(--color-text-dim);
  font-weight: 500;
  white-space: nowrap;
}

.cmp-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-transform: uppercase;
}

.cmp-sync-green {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
  border: 1px solid rgba(34,197,94,0.2);
}

.cmp-sync-amber {
  background: rgba(245,158,11,0.1);
  color: #d97706;
  border: 1px solid rgba(245,158,11,0.2);
}

.cmp-sync-red {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,0.2);
  animation: cmpSyncPulse 2s infinite;
}

@keyframes cmpSyncPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.25); }
  50% { box-shadow: 0 0 0 3px rgba(239,68,68,0); }
}

.cmp-sync-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cmp-sync-green .cmp-sync-dot { background: #22c55e; }
.cmp-sync-amber .cmp-sync-dot { background: #f59e0b; }
.cmp-sync-red .cmp-sync-dot { background: #ef4444; }

@media (max-width: 575px) {
  .cmp-stat {
    flex: 1 1 calc(50% - 0.25rem);
    padding: 0.5rem 0.25rem 0.4rem;
  }
  .cmp-stat-num { font-size: 1.2rem; }
  .cmp-stat-label { font-size: 0.44rem; }
.cmp-stat-icon { width: 30px; height: 30px; font-size: 0.75rem; border-radius: 8px; }
  .cmp-resumen { padding: 0.6rem 0.75rem; }
  .cmp-resumen-footer { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .cmp-footer-right { width: 100%; justify-content: flex-end; }
}

@media (min-width: 576px) {
  .cmp-stat { flex: 1 1 calc(33.333% - 0.35rem); }
  .cmp-stat-num { font-size: 1.7rem; }
  .cmp-stat-label { font-size: 0.52rem; }
  .cmp-stat-icon { width: 42px; height: 42px; font-size: 0.9rem; border-radius: 12px; }
  .cmp-resumen { padding: 1rem 1.25rem; }
}

@media (min-width: 768px) {
  .cmp-stat { flex: 1 1 auto; }
  .cmp-stat-num { font-size: 1.9rem; }
  .cmp-stat-label { font-size: 0.55rem; }
  .cmp-stat-icon { width: 46px; height: 46px; font-size: 1rem; }
  .cmp-resumen { padding: 1.1rem 1.5rem; }
  .cmp-resumen-grid { gap: 0.6rem; }
}

@media (min-width: 1024px) {
  .cmp-stat-num { font-size: 2rem; }
  .cmp-stat-label { font-size: 0.58rem; }
  .cmp-stat-icon { width: 50px; height: 50px; font-size: 1.1rem; border-radius: 14px; }
  .cmp-resumen { padding: 1.25rem 1.75rem; }
}
/* Toolbar */
.cmp-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.cmp-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cmp-toolbar-left::-webkit-scrollbar { display: none; }

.cmp-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Filter buttons */
.cmp-filter-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.cmp-filter-btn:active {
  transform: scale(0.94);
}

.cmp-filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.cmp-filter-btn.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

.cmp-filter-btn .cmp-filter-chevron {
  font-size: 0.6rem;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cmp-filter-btn.active .cmp-filter-chevron {
  transform: rotate(180deg);
}

.cmp-filter-btn .cmp-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 1px;
}

.cmp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cmp-icon-btn:active {
  transform: scale(0.9);
  background: var(--color-border);
}

.cmp-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.cmp-page-size {
  padding: 0.3rem 0.6rem;
  border-radius: 10px;
  border: 1.5px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.cmp-page-size:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

/* View toggle */
.cmp-toolbar .view-toggle {
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-alt);
}

.cmp-toolbar .view-toggle .btn {
  padding: 0.35rem 0.55rem;
  line-height: 1;
  font-size: 0.9rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cmp-toolbar .view-toggle .btn + .btn {
  border-left: 1px solid var(--color-border);
}

.cmp-toolbar .view-toggle .btn.active {
  background: var(--color-card-bg);
  color: var(--color-primary);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.cmp-toolbar .view-toggle .btn:active {
  transform: scale(0.92);
}

/* Filter panels (accordion) */
.cmp-pasillos {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              margin 0.35s ease;
  margin-bottom: 0;
}

.cmp-pasillos.show {
  opacity: 1;
  margin-bottom: 0.75rem;
}

.cmp-pasillos-inner {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 0.85rem;
  box-shadow: 0 4px 16px var(--color-card-shadow);
}

.cmp-pasillos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--color-border);
}

.cmp-pasillos-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cmp-pasillos-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cmp-pasillos-sep {
  color: var(--color-border);
  font-size: 0.75rem;
}

.cmp-pasillo-all,
.cmp-pasillo-none {
  border: none;
  background: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cmp-pasillo-all:hover,
.cmp-pasillo-none:hover {
  background: var(--color-primary-light);
}

.cmp-pasillo-all:active,
.cmp-pasillo-none:active {
  transform: scale(0.94);
}

.cmp-pasillo-none {
  color: var(--color-text-muted);
}

.cmp-pasillo-none:hover {
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
}

.cmp-pasillos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-height: 185px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
  scrollbar-width: thin;
}

.cmp-pasillos-grid::-webkit-scrollbar {
  width: 4px;
}

.cmp-pasillos-grid::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.cmp-pasillo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cmp-pasillo-chip:active {
  transform: scale(0.92);
}

.cmp-pasillo-chip:hover {
  border-color: var(--color-primary);
}

.cmp-pasillo-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cmp-pasillo-chip.is-checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.25);
}

.cmp-pasillo-chip.is-checked:active {
  transform: scale(0.92);
}

.cmp-pasillo-chip-count {
  opacity: 0.7;
  font-weight: 500;
  font-size: 0.68rem;
}

.cmp-pasillo-chip.is-checked .cmp-pasillo-chip-count {
  opacity: 0.85;
}

/* Search bar */
.cmp-search-bar {
  position: relative;
  margin-bottom: 0.75rem;
}

.cmp-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 3;
}

.cmp-search-input {
  width: 100%;
  padding: 0.7rem 2.4rem 0.7rem 2.6rem;
  height: 46px;
  font-size: 0.9rem;
  border-radius: 14px;
  border: 1.5px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-text);
  transition: all 0.25s ease;
  outline: none;
  -webkit-appearance: none;
}

.cmp-search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.12);
}

.cmp-search-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.cmp-search-clear {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  border-radius: 8px;
  z-index: 3;
  transition: all 0.2s ease;
}

.cmp-search-clear:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.cmp-search-clear:active {
  transform: translateY(-50%) scale(0.9);
}

/* Tabs */
.cmp-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.25rem;
  background: var(--color-surface-alt);
  border-radius: 14px;
  list-style: none;
  padding-left: 0;
}

.cmp-tabs::-webkit-scrollbar { display: none; }

.cmp-tabs li {
  flex-shrink: 0;
}

.cmp-tabs button {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cmp-tabs button:active {
  transform: scale(0.94);
}

.cmp-tabs button.active {
  background: var(--color-card-bg);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cmp-tabs button i {
  font-size: 0.85rem;
}

.cmp-tabs .cmp-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: var(--color-border);
  color: var(--color-text-muted);
  line-height: 1.3;
}

.cmp-tabs button.active .cmp-badge {
  background: var(--color-primary);
  color: #fff;
}

/* Table */
.cmp-table-wrap {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--color-card-shadow);
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cmp-table {
  font-size: 0.8rem;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 700px;
}

.cmp-table thead th {
  background: var(--color-primary-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.75rem 0.85rem;
  border: none;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

.cmp-table thead th:first-child { border-radius: 16px 0 0 0; }
.cmp-table thead th:last-child { border-radius: 0 16px 0 0; }

.cmp-table td {
  padding: 0.6rem 0.85rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card-bg);
  transition: background 0.15s;
}

.cmp-table tbody tr:last-child td { border-bottom: none; }

.cmp-table tbody tr:last-child td:first-child { border-radius: 0 0 0 16px; }
.cmp-table tbody tr:last-child td:last-child { border-radius: 0 0 16px 0; }

.cmp-table tbody tr:active td {
  background: var(--color-primary-light);
}

.cmp-table .td-sku {
  font-family: 'SF Mono', 'Cascadia Code', 'Menlo', monospace;
  font-size: 0.72rem;
  white-space: nowrap;
  font-weight: 700;
  color: var(--color-text-secondary);
  letter-spacing: -0.3px;
  padding-left: 0.85rem;
}

.cmp-table .td-stock {
  font-weight: 800;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cmp-table .td-diff {
  font-size: 0.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cmp-table .td-atributo {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-warning);
}

.cmp-table .td-seccion {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-info);
}

.cmp-table .td-etiq {
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
  color: var(--color-primary);
  white-space: nowrap;
  min-width: 70px;
}

.cmp-table .etiq-mas {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--color-text-muted);
  vertical-align: super;
}

.cmp-table .td-detail {
  min-width: 100px;
}

/* Row coloring */
.cmp-table .table-danger td:first-child { border-left: 7px solid var(--color-danger); }
.cmp-table .table-warning td:first-child { border-left: 7px solid var(--color-warning); }
.cmp-table .table-info td:first-child { border-left: 7px solid var(--color-primary); }
.cmp-table .table-success td:first-child { border-left: 7px solid var(--color-success); }
.cmp-table .table-secondary td:first-child { border-left: 7px solid var(--color-text-muted); }

.cmp-table tbody tr:nth-child(even) td { background: var(--color-surface-alt); }

/* Cards View */
.cmp-cards-view {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 576px) {
  .cmp-cards-view { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 992px) {
  .cmp-cards-view { grid-template-columns: 1fr 1fr 1fr; }
}

.cmp-card {
  background: var(--color-card-bg);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 8px var(--color-card-shadow);
}

.cmp-card:active {
  transform: scale(0.98);
}

.cmp-card.table-danger { border-top: 4px solid var(--color-danger); }
.cmp-card.table-warning { border-top: 4px solid var(--color-warning); }
.cmp-card.table-info { border-top: 4px solid var(--color-primary); }
.cmp-card.table-success { border-top: 4px solid var(--color-success); }
.cmp-card.table-secondary { border-top: 4px solid var(--color-text-muted); }

.cmp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}

.cmp-card-sku {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.cmp-card-body {
  padding: 0.7rem 0.8rem;
}

.cmp-card-desc {
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cmp-card-stats {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cmp-card-stat {
  flex: 1;
  min-width: 55px;
  text-align: center;
  background: var(--color-surface-alt);
  border-radius: 10px;
  padding: 0.35rem 0.4rem;
}

.cmp-card-stat-label {
  display: block;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  font-weight: 700;
}

.cmp-card-stat-num {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.cmp-badge {
  font-size: 0.65rem !important;
  white-space: normal !important;
  text-align: left;
}

.cmp-ubic {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* List View */
.cmp-list-view {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cmp-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  background: var(--color-card-bg);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cmp-list-item:active {
  transform: scale(0.985);
}

.cmp-list-item.table-danger { border-left: 4px solid var(--color-danger); }
.cmp-list-item.table-warning { border-left: 4px solid var(--color-warning); }
.cmp-list-item.table-info { border-left: 4px solid var(--color-primary); }
.cmp-list-item.table-success { border-left: 4px solid var(--color-success); }
.cmp-list-item.table-secondary { border-left: 4px solid var(--color-text-muted); }

.cmp-list-ubic {
  flex-shrink: 0;
  background: var(--color-surface-alt);
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
  color: var(--color-text-secondary);
}

.cmp-list-body {
  flex: 1;
  min-width: 0;
}

.cmp-list-sku {
  font-family: monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.cmp-list-desc {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

.cmp-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.cmp-badge-stock {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.cmp-badge-diff {
  font-size: 0.75rem;
  font-weight: 700;
}

.cmp-badge-atributo {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-warning);
}

.cmp-badge-seccion {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-info);
}

.cmp-badge-familia {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-purple, #7c3aed);
}

/* Print & Export */
.cmp-print-export .btn {
  border-radius: 10px;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}

/* Animations */
.cmp-fade-in {
  animation: cmpFadeIn 0.3s ease-out;
}

@keyframes cmpFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.cmp-row-in {
  animation: cmpRowIn 0.25s ease-out both;
}

.cmp-row-in:nth-child(1) { animation-delay: 0.02s; }
.cmp-row-in:nth-child(2) { animation-delay: 0.04s; }
.cmp-row-in:nth-child(3) { animation-delay: 0.06s; }
.cmp-row-in:nth-child(4) { animation-delay: 0.08s; }
.cmp-row-in:nth-child(5) { animation-delay: 0.10s; }
.cmp-row-in:nth-child(6) { animation-delay: 0.12s; }
.cmp-row-in:nth-child(7) { animation-delay: 0.14s; }
.cmp-row-in:nth-child(8) { animation-delay: 0.16s; }
.cmp-row-in:nth-child(9) { animation-delay: 0.18s; }
.cmp-row-in:nth-child(10) { animation-delay: 0.20s; }
.cmp-row-in:nth-child(n+11) { animation-delay: 0.22s; }

@keyframes cmpRowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Print */
@media print {
  body * { visibility: hidden; }
  .cmp-page, .cmp-page * { visibility: visible; }
  .cmp-page { position: absolute; left: 0; top: 0; width: 100%; }
  .sidebar, .bottom-nav, .search-sticky, .cmp-resumen,
  .page-header, .cmp-tabs, .cmp-toolbar,
  .cmp-controls, .btn, .cmp-stat { display: none !important; }
  .main-content { margin: 0 !important; padding: 10px !important; }
  .cmp-table td { background: #fff !important; color: #000 !important; }
  .cmp-table .table-danger td { background: #fee !important; }
  .cmp-table .table-warning td { background: #ffe !important; }
  .cmp-table .table-info td { background: #e8f0fe !important; }
  .cmp-table .table-success td { background: #efe !important; }
  .tab-pane { display: block !important; opacity: 1 !important; visibility: visible !important; }
  #cmpTabContent { display: block !important; }
  .cmp-fade-in, .cmp-row-in { animation: none !important; }
  .cmp-table-wrap { border: none !important; box-shadow: none !important; }
  .cmp-table thead th:first-child { border-radius: 0; }
  .cmp-table thead th:last-child { border-radius: 0; }
  .cmp-table tbody tr:last-child td:first-child { border-radius: 0; }
  .cmp-table tbody tr:last-child td:last-child { border-radius: 0; }
}

/* ========== CONTROLAR ========== */

/* Selector de pasillos obligatorio (siempre visible, no es acordeón) */
.ctrl-pasillos-select {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.ctrl-pasillos-select .cmp-pasillos-grid {
  max-height: 160px;
}

/* Prompt inicial: pedí elegir pasillo */
.ctrl-prompt {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--color-text-muted);
}

.ctrl-prompt i {
  font-size: 2.5rem;
  opacity: 0.25;
  margin-bottom: 0.75rem;
  display: block;
}

/* Lista de items a controlar */
.ctrl-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ctrl-pasillo-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  padding: 0.5rem 0.2rem 0.15rem;
}

.ctrl-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ctrl-item.is-ok {
  border-color: var(--color-success);
  box-shadow: 0 0 0 1px var(--color-success) inset;
}

.ctrl-item.is-falta {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 1px var(--color-danger) inset;
}

.ctrl-item-ubic {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  background: var(--color-surface-alt);
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  text-align: center;
}

.ctrl-item-ubic-main {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.15;
}

.ctrl-item-ubic-letra {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.3px;
}

.ctrl-item-body {
  flex: 1;
  min-width: 0;
}

.ctrl-item-sku {
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.ctrl-item-desc {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctrl-item-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

.ctrl-item-meta .badge {
  font-size: 0.6rem !important;
}

.ctrl-item-stock {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.ctrl-item-boleta {
  font-size: 0.68rem;
  color: var(--color-primary);
  font-weight: 600;
}

.ctrl-item-atributo {
  font-size: 0.68rem;
  color: var(--color-warning);
  font-weight: 600;
}

.ctrl-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ctrl-btn:active {
  transform: scale(0.92);
}

.ctrl-btn-ok.is-active {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.ctrl-btn-falta.is-active {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

.ctrl-btn-ok:hover:not(.is-active) {
  border-color: var(--color-success);
  color: var(--color-success);
}

.ctrl-btn-falta:hover:not(.is-active) {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* Flash "Guardado" */
.ctrl-saved-flash {
  position: absolute;
  top: -8px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--color-success);
  background: var(--color-success-light);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ctrl-item {
  position: relative;
}

.ctrl-saved-flash.show {
  opacity: 1;
}

/* Estado guardado por otro momento (info secundaria) */
.ctrl-item-saved-by {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}

/* Historial */
.ctrl-hist-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ctrl-hist-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
}

.ctrl-hist-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
}

.ctrl-hist-icon.ok { background: var(--color-success); }
.ctrl-hist-icon.falta { background: var(--color-danger); }

.ctrl-hist-body {
  flex: 1;
  min-width: 0;
}

.ctrl-hist-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctrl-hist-title strong {
  font-family: monospace;
  font-weight: 700;
}

.ctrl-hist-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

.ctrl-hist-user {
  font-weight: 600;
  color: var(--color-primary);
}

.ctrl-hist-empty,
.ctrl-list-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--color-text-muted);
}

.ctrl-hist-empty i,
.ctrl-list-empty i {
  font-size: 2.5rem;
  opacity: 0.25;
  margin-bottom: 0.75rem;
  display: block;
}

#ctrlLoadMore {
  text-align: center;
  padding: 1.25rem 1rem 0.5rem;
}

.ctrl-loadmore-btn {
  border-radius: 999px;
}

/* Mobile: botones más grandes para dedo, menos texto secundario */
@media (max-width: 420px) {
  .ctrl-item {
    flex-wrap: wrap;
  }
  .ctrl-item-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--color-border);
  }
}

/* Stock Conteo / SAP: grandes y bien diferenciados */
.ctrl-stock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 9px;
  font-weight: 600;
  line-height: 1;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.ctrl-stock-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}
.ctrl-stock-num {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}
.ctrl-stock-conteo {
  background: var(--color-success-light);
  color: var(--color-success);
  border-color: var(--color-success);
}
.ctrl-stock-sap {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* =============================================
   CONTROLAR - Rediseño moderno
   ============================================= */

/* Hero de la página */
.ctrl-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.ctrl-hero::after,
.ctrl-hero::before {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.ctrl-hero::after { width: 220px; height: 220px; top: -90px; right: -60px; }
.ctrl-hero::before { width: 130px; height: 130px; bottom: -50px; right: 150px; background: rgba(255, 255, 255, 0.05); }
.ctrl-hero h1 { font-size: 1.35rem; font-weight: 800; margin: 0; color: #fff; display: flex; align-items: center; gap: 0.5rem; }
.ctrl-hero-sub { font-size: 0.85rem; opacity: 0.9; margin-top: 0.15rem; }
.ctrl-hero-ico {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  animation: ctrlFloat 3.2s ease-in-out infinite;
}

/* Stats */
.ctrl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.ctrl-stat {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 2px 10px var(--color-card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ctrl-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--color-card-shadow);
}
.ctrl-stat > i { font-size: 1.25rem; }
.ctrl-stat-total > i { color: var(--color-primary); }
.ctrl-stat-ok > i { color: var(--color-success); }
.ctrl-stat-falta > i { color: var(--color-danger); }
.ctrl-stat-pend > i { color: var(--color-warning); }
.ctrl-stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  display: block;
  color: var(--color-text);
}
.ctrl-stat-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}
.ctrl-stats.is-done .ctrl-stat { border-color: var(--color-success); }

/* Barra de progreso */
.ctrl-progress {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.ctrl-progress-track {
  flex: 1;
  height: 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.ctrl-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-success));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.ctrl-progress-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: ctrlShine 1.6s linear infinite;
}
.ctrl-progress-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  min-width: 44px;
  text-align: right;
}

/* Selector de pasillos */
.ctrl-pasillos-select {
  border-radius: 16px;
  box-shadow: 0 4px 16px var(--color-card-shadow);
}
.ctrl-pasillos-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-primary);
}
.ctrl-pasillos-title i {
  animation: ctrlPulse 2.2s ease-in-out infinite;
}

/* Cards de etiqueta */
.ctrl-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 0.9rem;
  box-shadow: 0 4px 16px var(--color-card-shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.ctrl-card:hover { box-shadow: 0 10px 30px var(--color-card-shadow); }
.ctrl-card-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.95rem;
  background: linear-gradient(180deg, var(--color-surface-alt) 0%, var(--color-card-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}
.ctrl-card-head::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
  border-radius: 0 4px 4px 0;
}
.ctrl-card-loc { display: flex; align-items: center; gap: 0.5rem; }
.ctrl-card-loc-ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.ctrl-card-loc-num { font-size: 1rem; font-weight: 800; color: var(--color-text); }
.ctrl-card-loc-letra {
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
}
.ctrl-card-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.ctrl-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}
.ctrl-tag i { font-size: 0.7rem; color: var(--color-primary); }
.ctrl-tag-multi {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.ctrl-card-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}
.ctrl-card-status.is-ok { background: var(--color-success-light); color: var(--color-success); }
.ctrl-card-status.is-falta { background: var(--color-danger-light); color: var(--color-danger); }
.ctrl-card-status.is-partial { background: var(--color-warning-light); color: var(--color-warning); }
.ctrl-card-body { padding: 0.15rem 0.9rem 0.4rem; }

/* Etiqueta de pasillo / grupo */
.ctrl-pasillo-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
  padding: 0.3rem 0.1rem;
}
.ctrl-pasillo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-primary);
}
.ctrl-pasillo-badge i { font-size: 0.9rem; }
.ctrl-limpiar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-danger);
  background: transparent;
  border: 1px solid transparent;
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ctrl-limpiar-btn:hover {
  background: var(--color-danger-light);
  border-color: var(--color-danger);
}

/* Items */
.ctrl-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.7rem 0.1rem;
  border-bottom: 1px dashed var(--color-border);
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
.ctrl-item:last-child { border-bottom: none; }
.ctrl-item.is-ok {
  background: var(--color-success-light);
  border-radius: 12px;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  border-bottom-color: transparent;
}
.ctrl-item.is-falta {
  background: var(--color-danger-light);
  border-radius: 12px;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  border-bottom-color: transparent;
}
.ctrl-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.ctrl-item-id { flex: 1; min-width: 0; }
.ctrl-item-sku {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
}
.ctrl-item-sku i { font-size: 0.68rem; opacity: 0.6; }
.ctrl-item-desc {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 0.3rem;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}
.ctrl-status-pill {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  margin-top: 0.1rem;
  animation: ctrlPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ctrl-status-pill.ok { background: var(--color-success); box-shadow: 0 2px 8px rgba(0, 168, 107, 0.4); }
.ctrl-status-pill.falta { background: var(--color-danger); box-shadow: 0 2px 8px rgba(229, 62, 62, 0.4); }

.ctrl-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}
.ctrl-item-meta .badge { font-size: 0.68rem !important; }
.ctrl-tag-sm {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
}
.ctrl-item-saved-by {
  font-size: 0.66rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Acciones */
.ctrl-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 110px;
}
.ctrl-btn i { font-size: 1rem; }
.ctrl-btn:hover { transform: translateY(-1px); }
.ctrl-btn:active { transform: scale(0.95); }
.ctrl-btn-ok:hover:not(.is-active) {
  border-color: var(--color-success);
  color: var(--color-success);
  background: var(--color-success-light);
}
.ctrl-btn-falta:hover:not(.is-active) {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: var(--color-danger-light);
}
.ctrl-btn-ok.is-active {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.35);
}
.ctrl-btn-falta.is-active {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.35);
}

/* Flash Guardado */
.ctrl-saved-flash {
  position: absolute;
  top: 0.4rem;
  right: 0.8rem;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--color-success);
  background: var(--color-success-light);
  border: 1px solid var(--color-success);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.ctrl-saved-flash.show { opacity: 1; transform: translateY(0); }

/* Estados vacíos / prompt */
.ctrl-prompt,
.ctrl-list-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}
.ctrl-prompt-ico,
.ctrl-list-empty i,
.ctrl-hist-empty i {
  font-size: 2.8rem;
  opacity: 0.25;
  display: block;
  margin: 0 auto 0.75rem;
}
.ctrl-empty { max-width: 420px; margin: 2rem auto; }
.ctrl-empty-ico {
  width: 74px;
  height: 74px;
  margin: 0 auto;
  border-radius: 22px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 24px var(--color-card-shadow);
  animation: ctrlFloat 3.2s ease-in-out infinite;
}

/* Loading */
#ctrlLoading .ctrl-loading-card {
  max-width: 360px;
  margin: 0 auto;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 6px 20px var(--color-card-shadow);
}
.ctrl-spinner-ring {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: ctrlSpin 0.8s linear infinite;
}
.ctrl-btn-load:disabled { opacity: 0.6; }

/* Historial */
.ctrl-hist-filtros {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.6rem;
}
.ctrl-hist-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 0.6rem 0.85rem;
  box-shadow: 0 2px 10px var(--color-card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ctrl-hist-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--color-card-shadow);
}
.ctrl-hist-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.ctrl-hist-filtros .btn { font-size: 0.74rem; }

/* Animaciones */
@keyframes ctrlFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes ctrlShine {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@keyframes ctrlSpin { to { transform: rotate(360deg); } }
@keyframes ctrlPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}
@keyframes ctrlPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 640px) {
  .ctrl-stats { grid-template-columns: repeat(2, 1fr); }
  .ctrl-hero { padding: 1rem 1.1rem; }
  .ctrl-hero-ico { width: 44px; height: 44px; font-size: 1.2rem; }
  .ctrl-card-head { padding: 0.6rem 0.7rem; }
  .ctrl-card-body { padding: 0.1rem 0.6rem 0.3rem; }
  .ctrl-btn { min-width: 92px; padding: 0.45rem 0.7rem; font-size: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ctrl-hero-ico, .ctrl-empty-ico, .ctrl-pasillos-title i, .ctrl-progress-shine { animation: none; }
}

/* =============================================
   P�gina de Documentaci�n
   ============================================= */
.doc-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}
.doc-hero {
  position: relative;
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  margin-bottom: 2.5rem;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary) 0%, #1a1a2e 100%);
  color: #fff;
}
.doc-hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.06) 0%, transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(255,255,255,0.04) 0%, transparent 50%);
  pointer-events: none;
}
.doc-hero-content { position: relative; z-index: 1; }
.doc-hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  margin-bottom: 1.2rem;
}
.doc-hero-title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.8rem;
  letter-spacing: -0.5px;
}
.doc-hero-sub {
  font-size: 1.05rem;
  opacity: 0.85;
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}
.doc-hero-actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.doc-badge-tech {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.13);
}
.doc-hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  position: relative;
  z-index: 1;
}
.doc-stat-item {
  text-align: center;
}
.doc-stat-num {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
}
.doc-stat-label {
  font-size: 0.72rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.doc-section {
  margin-bottom: 2.5rem;
}
.doc-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
}
.doc-section-title i {
  color: var(--color-primary);
  font-size: 1.1rem;
}
.doc-section-desc {
  color: var(--color-text-muted);
  line-height: 1.7;
  font-size: 0.92rem;
}
.doc-arch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.doc-arch-col { flex: 1; min-width: 0; }
.doc-arch-arrow {
  flex-shrink: 0;
  color: var(--color-primary);
  font-size: 1.2rem;
  opacity: 0.5;
}
.doc-arch-card {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: box-shadow 0.2s;
}
.doc-arch-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.doc-arch-icon {
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
}
.doc-arch-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.doc-arch-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.doc-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.doc-feature {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.doc-feature-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  background: var(--doc-fc, var(--color-primary));
}
.doc-feature-body h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.doc-feature-body p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.45;
}
.doc-stack {
  display: grid;
  gap: 0.5rem;
}
.doc-stack-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--color-surface);
}
.doc-stack-tag {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
}
.doc-profiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.doc-profile-card {
  padding: 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.doc-profile-icon {
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
}
.doc-profile-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.doc-profile-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.doc-profile-card li {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  padding: 0.2rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.doc-profile-card li span {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.7rem;
}
.doc-tables {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}
.doc-table-card {
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.doc-table-card h4 {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.doc-table-card h4 i { color: var(--color-primary); }
.doc-table-card p { font-size: 0.75rem; margin-bottom: 0.4rem; }
.doc-table-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.doc-col {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
  font-family: 'Courier New', monospace;
}
.doc-flow {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.doc-flow-step {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.82rem;
}
.doc-flow-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-primary);
  color: #fff;
}

@media (max-width: 768px) {
  .doc-hero-title { font-size: 1.8rem; }
  .doc-hero-stats { gap: 1rem; }
  .doc-arch { flex-direction: column; }
  .doc-arch-arrow { transform: rotate(90deg); }
  .doc-features { grid-template-columns: 1fr; }
  .doc-profiles { grid-template-columns: 1fr; }
  .doc-tables { grid-template-columns: 1fr; }
  .doc-flow { flex-direction: column; }
}

/* --- Particle background for hero --- */
.doc-hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.doc-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  animation: docFloat linear infinite;
  opacity: 0;
}
@keyframes docFloat {
  0%   { transform: translateY(0) scale(0); opacity: 0; }
  20%  { opacity: 0.6; }
  80%  { opacity: 0.6; }
  100% { transform: translateY(-120px) scale(1); opacity: 0; }
}

/* --- Fade-in on scroll --- */
.doc-fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: docFadeUp 0.6s ease forwards;
}
.doc-fade-in:nth-child(2) { animation-delay: 0.1s; }
.doc-fade-in:nth-child(3) { animation-delay: 0.2s; }
.doc-fade-in:nth-child(4) { animation-delay: 0.3s; }
.doc-fade-in:nth-child(5) { animation-delay: 0.4s; }
.doc-fade-in:nth-child(6) { animation-delay: 0.5s; }
.doc-fade-in:nth-child(7) { animation-delay: 0.6s; }
.doc-fade-in:nth-child(8) { animation-delay: 0.7s; }
.doc-fade-in:nth-child(9) { animation-delay: 0.8s; }
.doc-fade-in:nth-child(10) { animation-delay: 0.9s; }

@keyframes docFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Hover effects for cards --- */
.doc-feature-hover {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.doc-feature-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}
[data-theme="dark"] .doc-feature-hover:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.doc-arch-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.doc-arch-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
[data-theme="dark"] .doc-arch-card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.35);
}

.doc-arch-card-1 { transition-delay: 0s; }
.doc-arch-card-2 { transition-delay: 0.05s; }
.doc-arch-card-3 { transition-delay: 0.1s; }

.doc-profile-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.doc-profile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.08);
}
[data-theme="dark"] .doc-profile-card:hover {
  box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.doc-table-card {
  transition: transform 0.25s ease;
}
.doc-table-card:hover {
  transform: translateY(-2px);
}

.doc-flow-step {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.doc-flow-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

/* --- Changelog section --- */
.doc-changelog {
  display: grid;
  gap: 0.4rem;
}
.doc-changelog-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.doc-changelog-tag {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
}
.tag-new { background: #198754; color: #fff; }
.tag-upgrade { background: #0d6efd; color: #fff; }
.tag-fix { background: #6f42c1; color: #fff; }

/* --- Footer credit --- */
.doc-footer-credit { margin-top: 3rem; }
.doc-credit {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.doc-credit-line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.doc-credit-content {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.doc-credit-content i { font-size: 0.9rem; }
.doc-credit-content strong { color: var(--color-text); }

/* --- Dark theme refinements for doc --- */
[data-theme="dark"] .doc-hero {
  background: linear-gradient(135deg, #0a1628 0%, #1a1a2e 100%);
}
[data-theme="dark"] .doc-hero-badge {
  background: rgba(255,255,255,0.08);
}
[data-theme="dark"] .doc-badge-tech {
  background: rgba(255,255,255,0.07);
}
[data-theme="dark"] .doc-arch-card,
[data-theme="dark"] .doc-feature,
[data-theme="dark"] .doc-stack-item,
[data-theme="dark"] .doc-profile-card,
[data-theme="dark"] .doc-table-card,
[data-theme="dark"] .doc-flow-step,
[data-theme="dark"] .doc-changelog-item {
  background: var(--color-surface);
  border-color: var(--color-border);
}
[data-theme="dark"] .doc-stack-tag {
  background: var(--color-primary);
}
[data-theme="dark"] .doc-section-title {
  color: var(--color-text);
}
[data-theme="dark"] .doc-section-desc,
[data-theme="dark"] .doc-arch-desc,
[data-theme="dark"] .doc-feature-body p {
  color: var(--color-text-secondary);
}
[data-theme="dark"] .doc-flow-num {
  background: var(--color-primary);
}

/* =============================================
   DASHBOARD — STRIPE PREMIUM
   ============================================= */
.dash {
  --dash-bg: #f1f5f9;
  --dash-card-bg: #ffffff;
  --dash-border: #e2e8f0;
  --dash-text: #1e293b;
  --dash-text-muted: #64748b;
  --dash-text-dim: #94a3b8;
  --dash-accent: #6366f1;
  --dash-accent-rgb: 99,102,241;
  --dash-accent-light: rgba(99,102,241,0.08);
  --dash-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: -1rem;
  padding: 1.5rem;
  background: var(--dash-bg);
  min-height: calc(100vh - 60px);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--dash-text);
}

/* Hero */
.dash-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
  border: 1px solid var(--dash-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 8px 32px rgba(0,0,0,0.03);
}
.dash-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 40%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 85% 30%, rgba(239,68,68,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(34,197,94,0.04) 0%, transparent 45%);
  pointer-events: none;
}
.dash-hero-content {
  position: relative;
  padding: 1.25rem 1.5rem;
}
.dash-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.dash-hero-top h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #1e293b, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}
.dash-hero-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--dash-card-bg);
  border: 1px solid var(--dash-border);
  border-radius: 12px;
  padding: 0.2rem 0.4rem 0.2rem 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dash-hero-select:focus-within {
  border-color: var(--dash-accent);
  box-shadow: 0 0 0 3px rgba(var(--dash-accent-rgb), 0.1);
}
.dash-hero-select select {
  background: transparent;
  border: none;
  color: var(--dash-text);
  font-size: 0.85rem;
  padding: 0.25rem 1.5rem 0.25rem 0.25rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.25rem center;
  font-weight: 500;
}
.dash-hero-select select:focus { outline: none; }
.dash-hero-select i { color: var(--dash-accent); font-size: 0.9rem; }

.dash-hero-stat {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226,232,240,0.8);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
  transition: all 0.25s var(--dash-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-hero-stat:hover {
  transform: translateY(-3px);
  border-color: var(--dash-accent);
  box-shadow: 0 8px 28px rgba(var(--dash-accent-rgb), 0.15);
}
.dash-hero-stat:active {
  transform: translateY(-1px) scale(0.98);
}
.dash-hero-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: var(--dash-accent-light);
  color: var(--dash-accent);
  transition: transform 0.25s var(--dash-spring);
}
.dash-hero-stat:hover .dash-hero-stat-icon {
  transform: scale(1.08);
}
.dash-hero-stat-body { min-width: 0; }
.dash-hero-stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.3px;
}
.dash-hero-stat-label {
  font-size: 0.6rem;
  color: var(--dash-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 1px;
  font-weight: 600;
}

/* Tabs — iOS-style pill tabs */
.dash-tabs-wrap {
  margin-bottom: 0.75rem;
}
.dash-tabs {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.25rem;
  background: var(--dash-bg);
  border-radius: 14px;
  border: 1px solid var(--dash-border);
  list-style: none;
  padding-left: 0.25rem;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
  width: 100%;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs .nav-item { margin: 0; }
.dash-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--dash-text-muted);
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.25s var(--dash-spring);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}
.dash-tabs .nav-link:hover {
  color: var(--dash-text);
  background: rgba(0,0,0,0.03);
}
.dash-tabs .nav-link:active {
  transform: scale(0.94);
}
.dash-tabs .nav-link.active {
  color: var(--dash-accent);
  background: var(--dash-card-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.dash-tabs .nav-link .badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: var(--dash-border);
  color: var(--dash-text-muted);
  line-height: 1.3;
  transition: all 0.2s;
}
.dash-tabs .nav-link.active .badge {
  background: var(--dash-accent);
  color: #fff;
}

/* Toolbar */
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.dash-toolbar-left, .dash-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dash-toolbar .btn-outline-secondary {
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-color: var(--dash-border);
  color: var(--dash-text-muted);
  font-weight: 600;
  transition: all 0.2s var(--dash-spring);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dash-toolbar .btn-outline-secondary:active {
  transform: scale(0.94);
}
.dash-toolbar .btn-outline-secondary:hover {
  border-color: var(--dash-accent);
  color: var(--dash-accent);
  background: var(--dash-accent-light);
}
.dash-search {
  background: var(--dash-card-bg);
  border: 1.5px solid var(--dash-border);
  color: var(--dash-text);
  font-size: 0.78rem;
  border-radius: 10px;
  padding: 0.35rem 0.85rem;
  min-width: 180px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dash-search::placeholder { color: var(--dash-text-dim); font-weight: 400; }
.dash-search:focus {
  outline: none;
  border-color: var(--dash-accent);
  box-shadow: 0 0 0 3px rgba(var(--dash-accent-rgb), 0.1);
}

/* Pasillos filter chips */
.dash-pasillos {
  display: none;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem;
  background: var(--dash-card-bg);
  border: 1px solid var(--dash-border);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.dash-pasillo-chk {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  background: var(--dash-bg);
  border: 1.5px solid var(--dash-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  user-select: none;
  color: var(--dash-text-muted);
  font-weight: 500;
  transition: all 0.2s var(--dash-spring);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dash-pasillo-chk:active {
  transform: scale(0.92);
}
.dash-pasillo-chk:hover {
  border-color: var(--dash-accent);
  color: var(--dash-text);
}
.dash-pasillo-chk:has(input:checked) {
  background: var(--dash-accent-light);
  color: var(--dash-accent);
  border-color: var(--dash-accent);
  font-weight: 600;
}

/* Table */
.dash-table-wrap {
  background: var(--dash-card-bg);
  border: 1px solid var(--dash-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.dash-tbl {
  margin: 0;
  font-size: 0.78rem;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.dash-tbl thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--dash-border);
  color: var(--dash-text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  padding: 0.65rem 0.7rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.dash-tbl td {
  padding: 0.5rem 0.7rem;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}
.dash-tbl tbody tr:last-child td { border-bottom: none; }
.dash-tbl tbody tr:hover td { background: rgba(var(--dash-accent-rgb), 0.03); }
.dash-tbl tbody tr:active td { background: rgba(var(--dash-accent-rgb), 0.06); }
.dash-tbl .badge { font-size: 0.65rem; font-weight: 600; }

.dash-tr-warning { background: #fefce8; }
.dash-tr-danger { background: #fef2f2; }
.dash-tr-info { background: #ecfeff; }

.dash-timedanger { color: #dc2626 !important; font-weight: 600; }
.dash-timewarn { color: #ca8a04 !important; font-weight: 600; }

.dash-tbl-row { transition: background 0.15s; }

/* Pagination */
.dash-pagination {
  padding: 0.65rem;
  border-top: 1px solid var(--dash-border);
  display: flex;
  justify-content: center;
}
.dash-pagination .page-link {
  background: transparent;
  border: 1px solid var(--dash-border);
  color: var(--dash-text-muted);
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  margin: 0 0.15rem;
  transition: all 0.2s var(--dash-spring);
}
.dash-pagination .page-link:active {
  transform: scale(0.92);
}
.dash-pagination .page-item.active .page-link {
  background: var(--dash-accent);
  border-color: var(--dash-accent);
  color: #fff;
}

/* Grid */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
}
@media (max-width: 992px) {
  .dash-grid { grid-template-columns: 1fr; }
}
.dash-grid-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) {
  .dash-grid-main { grid-template-columns: 1fr; }
}
.dash-grid-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Cards */
.dash-card {
  background: var(--dash-card-bg);
  border: 1px solid var(--dash-border);
  border-radius: 16px;
  overflow: hidden;
  transition: box-shadow 0.25s var(--dash-spring), border-color 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 32px rgba(0,0,0,0.07);
}
.dash-card-hdr {
  padding: 0.55rem 0.85rem;
  font-weight: 700;
  font-size: 0.7rem;
  border-bottom: 1px solid var(--dash-border);
  background: #f8fafc;
  color: var(--dash-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dash-card-bd { padding: 0.85rem; }
.dash-chart-box { padding: 0.5rem; }
.dash-chart-box canvas {
  max-height: 200px;
  max-width: 100%;
}

/* Movimientos */
.dash-mov { display: flex; flex-wrap: wrap; }
.dash-mov-col {
  flex: 1;
  min-width: 140px;
  padding: 0.75rem;
}
.dash-mov-col:first-child { border-right: 1px solid var(--dash-border); }
.dash-mov-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 160px;
  overflow-y: auto;
}
.dash-mov-list li {
  padding: 0.25rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.72rem;
}
.dash-mov-list li:last-child { border-bottom: none; }
.dash-mov-list::-webkit-scrollbar { width: 4px; }
.dash-mov-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* Criticos mini */
.dash-critico-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.72rem;
  transition: background 0.15s;
}
.dash-critico-item:last-child { border-bottom: none; }
.dash-critico-item:hover { background: rgba(var(--dash-accent-rgb), 0.03); }

/* Responsive */
@media (max-width: 576px) {
  .dash { padding: 0.75rem; }
  .dash-hero-content { padding: 0.75rem; }
  .dash-hero-top h1 { font-size: 1.1rem; }
  .dash-hero-stat { padding: 0.5rem; gap: 0.5rem; }
  .dash-hero-stat-icon { width: 30px; height: 30px; font-size: 0.85rem; }
  .dash-hero-stat-num { font-size: 0.95rem; }
  .dash-hero-stat-label { font-size: 0.55rem; }
  .dash-tbl { font-size: 0.65rem; }
  .dash-tbl td, .dash-tbl th { padding: 0.3rem 0.4rem; }
  .dash-chart-box canvas { max-height: 160px; }
  .dash-tabs { border-radius: 10px; padding: 0.15rem; }
  .dash-tabs .nav-link { font-size: 0.65rem; padding: 0.3rem 0.5rem; }
  .dash-search { min-width: 120px; font-size: 0.7rem; }
  .dash-toolbar { flex-direction: column; align-items: stretch; }
  .dash-toolbar-left, .dash-toolbar-right { flex-wrap: wrap; }
  .dash-card-hdr { font-size: 0.65rem; padding: 0.45rem 0.65rem; }
  .dash-card-bd { padding: 0.65rem; }
}
.col-lg-15p { flex: 0 0 auto; width: 12.5%; }
@media (max-width: 992px) { .col-lg-15p { width: 25%; } }
@media (max-width: 576px) { .col-lg-15p { width: 50%; } }

/* =============================================
   DASHBOARD v2 — PREMIUM (Stripe / Linear / Vercel)
   ============================================= */
:root,
[data-theme="light"] {
  --dash-bg: #f6f7f9;
  --dash-card: #ffffff;
  --dash-border: #e6e8eb;
  --dash-border-soft: #f0f1f3;
  --dash-text: #101828;
  --dash-muted: #667085;
  --dash-dim: #98a2b3;
  --dash-accent: #6366f1;
  --dash-accent-soft: #eef2ff;
  --dash-success: #16a34a;
  --dash-danger: #dc2626;
  --dash-warn: #ea580c;
  --dash-amber: #d97706;
  --dash-radius: 16px;
  --dash-radius-sm: 10px;
  --dash-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --dash-shadow-lg: 0 12px 32px rgba(16,24,40,.09);
  --dash-spring: cubic-bezier(.34,1.56,.64,1);
  --dash-ease: cubic-bezier(.4,0,.2,1);
}
[data-theme="dark"] {
  --dash-bg: #0f1117;
  --dash-card: #171a21;
  --dash-border: #2b2f3a;
  --dash-border-soft: #21242e;
  --dash-text: #e7eaf0;
  --dash-muted: #9aa1ae;
  --dash-dim: #6c7483;
  --dash-accent-soft: rgba(99,102,241,.16);
}
.dash {
  --dash-bg: #f6f7f9;
  --dash-card: #ffffff;
  --dash-border: #e6e8eb;
  --dash-border-soft: #f0f1f3;
  --dash-text: #101828;
  --dash-muted: #667085;
  --dash-dim: #98a2b3;
  --dash-accent: #6366f1;
  --dash-accent-soft: #eef2ff;
  --dash-success: #16a34a;
  --dash-danger: #dc2626;
  --dash-warn: #ea580c;
  --dash-amber: #d97706;
  --dash-radius: 16px;
  --dash-radius-sm: 10px;
  --dash-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --dash-shadow-lg: 0 12px 32px rgba(16,24,40,.09);
  --dash-spring: cubic-bezier(.34,1.56,.64,1);
  --dash-ease: cubic-bezier(.4,0,.2,1);
  margin: -1.5rem;
  padding: clamp(1rem, 2.5vw, 2rem);
  padding-bottom: 110px;
  min-height: calc(100vh - 60px);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(99,102,241,.06), transparent 60%),
    var(--dash-bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--dash-text);
  letter-spacing: -0.01em;
}

/* ---------- Header ---------- */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.dash-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--dash-text);
}
.dash-subtitle {
  margin: 0.25rem 0 0;
  color: var(--dash-muted);
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
  font-weight: 450;
}
.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.dash-header-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: 12px;
  padding: 0.4rem 0.5rem 0.4rem 0.75rem;
  box-shadow: var(--dash-shadow);
  transition: border-color .2s, box-shadow .2s;
}
.dash-header-select:focus-within {
  border-color: var(--dash-accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.dash-header-select i { color: var(--dash-accent); font-size: 0.9rem; }
.dash-header-select select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--dash-text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.2rem 1.6rem 0.2rem 0.1rem;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.1rem center;
}
.dash-header-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--dash-muted);
  font-size: 0.82rem;
  font-weight: 550;
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: 12px;
  padding: 0.5rem 0.8rem;
  box-shadow: var(--dash-shadow);
  white-space: nowrap;
}
.dash-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--dash-accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(99,102,241,.4);
  transition: transform .2s var(--dash-spring), box-shadow .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 42px;
}
.dash-refresh-btn:hover { background: #5457e5; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.dash-refresh-btn:active { transform: scale(.95); }
.dash-refresh-btn:disabled { opacity: .6; pointer-events: none; }

/* ---------- Loading / Empty ---------- */
.dash-loading { text-align: center; padding: 4rem 1rem; color: var(--dash-muted); }
.dash-spinner {
  width: 34px; height: 34px;
  margin: 0 auto 0.9rem;
  border: 3px solid var(--dash-border);
  border-top-color: var(--dash-accent);
  border-radius: 50%;
  animation: dash-spin .8s linear infinite;
}
@keyframes dash-spin { to { transform: rotate(360deg); } }
.dash-empty { text-align: center; padding: 4rem 1rem; }
.dash-empty-ico {
  width: 64px; height: 64px;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; color: var(--dash-dim);
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: 18px;
  box-shadow: var(--dash-shadow);
}
.dash-empty h5 { margin: 0 0 0.3rem; font-weight: 700; }
.dash-empty p { margin: 0; color: var(--dash-muted); font-size: 0.9rem; }

/* ---------- KPI cards ---------- */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.dash-kpi {
  position: relative;
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  padding: 1rem 1.1rem 0.9rem;
  box-shadow: var(--dash-shadow);
  overflow: hidden;
  transition: transform .25s var(--dash-ease), box-shadow .25s var(--dash-ease), border-color .2s;
}
.dash-kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--dash-shadow-lg);
  border-color: #d0d3d9;
}
.dash-kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.8rem; }
.dash-kpi-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  background: var(--kpi, var(--dash-accent));
  color: #fff;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--kpi, var(--dash-accent)) 35%, transparent);
}
.dash-kpi-num { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.dash-kpi-label { margin-top: 0.2rem; font-size: 0.78rem; font-weight: 600; color: var(--dash-muted); }
.dash-kpi-hint { margin-top: 0.15rem; font-size: 0.7rem; color: var(--dash-dim); font-weight: 500; }
.dash-kpi-track {
  height: 3px;
  border-radius: 3px;
  background: var(--dash-border-soft);
  margin-top: 0.75rem;
  overflow: hidden;
}
.dash-kpi-track span { display: block; height: 100%; border-radius: 3px; }

/* ---------- Cards / rows ---------- */
.dash-row { display: grid; gap: 1rem; margin-bottom: 1rem; }
.dash-row-2 { grid-template-columns: 1fr 1fr; }
.dash-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-card {
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  overflow: hidden;
  box-shadow: var(--dash-shadow);
  transition: box-shadow .25s var(--dash-ease), border-color .2s;
}
.dash-card:hover { border-color: #d0d3d9; box-shadow: 0 6px 24px rgba(16,24,40,.07); }
.dash-card-hdr {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--dash-border-soft);
}
.dash-card-titles { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.dash-card-title { font-size: 0.9rem; font-weight: 700; color: var(--dash-text); display: inline-flex; align-items: center; gap: 0.45rem; }
.dash-card-title i { color: var(--dash-accent); font-size: 1rem; }
.dash-card-sub { font-size: 0.72rem; color: var(--dash-dim); font-weight: 500; }
.dash-card-bd { padding: 1rem; }
.dash-card-bd.p-0 { padding: 0; }
.dash-chart-box { padding: 0.65rem 0.75rem 0.9rem; }
.dash-chart-box canvas { max-height: 220px; max-width: 100%; width: 100% !important; }
.dash-hidden-canvas { display: none; }

.dash-hdr-badge {
  min-width: 24px; height: 24px;
  padding: 0 0.5rem;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.dash-hdr-badge.danger { background: #fee2e2; color: var(--dash-danger); }
.dash-hdr-badge.warn { background: #ffedd5; color: var(--dash-warn); }
.dash-hdr-badge.amber { background: #fef3c7; color: var(--dash-amber); }
.dash-hdr-badge.neutral { background: #f2f4f7; color: var(--dash-muted); }
.dash-hdr-badge.success { background: #dcfce7; color: var(--dash-success); }

/* ---------- Movimientos ---------- */
.dash-card-mov { margin-bottom: 1rem; }
.dash-mov { display: grid; grid-template-columns: 1fr 1fr; }
.dash-mov-col { padding: 0.85rem 1rem; min-width: 0; }
.dash-mov-col + .dash-mov-col { border-left: 1px solid var(--dash-border-soft); }
.dash-mov-title { margin: 0 0 0.6rem; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.dash-mov-title.in { color: var(--dash-success); }
.dash-mov-title.out { color: var(--dash-danger); }
.dash-mov-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.dash-mov-list li {
  padding: 0.45rem 0.6rem;
  background: var(--dash-bg);
  border-radius: 8px;
  font-size: 0.75rem;
  display: flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--dash-border-soft);
}
.dash-mov-list li .badge { font-size: 0.62rem; font-weight: 700; border-radius: 6px; background: var(--dash-text) !important; color: #fff; padding: 0.15rem 0.4rem; }
.dash-mov-list::-webkit-scrollbar { width: 4px; }
.dash-mov-list::-webkit-scrollbar-thumb { background: var(--dash-border); border-radius: 4px; }
.dash-muted-center { text-align: center; color: var(--dash-muted); font-size: 0.8rem; padding: 1.2rem 0.5rem; margin: 0; }

/* ---------- Alertas más antiguas ---------- */
.dash-old-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--dash-border-soft);
  transition: background .15s;
}
.dash-old-item:last-child { border-bottom: none; }
.dash-old-item:hover { background: var(--dash-bg); }
.dash-old-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.dash-old-sku { font-size: 0.78rem; font-weight: 700; color: var(--dash-text); font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.dash-old-desc { font-size: 0.7rem; color: var(--dash-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-old-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; flex-shrink: 0; }
.dash-old-dias { font-size: 0.78rem; font-weight: 800; color: var(--dash-muted); display: inline-flex; align-items: center; gap: 0.25rem; }
.dash-old-dias.danger { color: var(--dash-danger); }
.dash-old-dias.warn { color: var(--dash-warn); }
.dash-old-state { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dash-danger); background: #fee2e2; border-radius: 6px; padding: 0.1rem 0.4rem; }

.dash-old-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.dash-old-chip { font-size: 0.62rem; font-weight: 600; color: var(--dash-muted); display: inline-flex; align-items: center; gap: 0.28rem; background: var(--dash-bg); border: 1px solid var(--dash-border-soft); border-radius: 6px; padding: 0.1rem 0.45rem; white-space: nowrap; }
.dash-old-chip i { font-size: 0.62rem; }
.dash-old-chip b { color: var(--dash-text); font-weight: 700; }
.dash-old-chip-sec { color: #6366f1; }

.dash-more-wrap { padding: 0.7rem; border-top: 1px solid var(--dash-border-soft); }
.dash-card-more-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--dash-accent-soft);
  color: var(--dash-accent);
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit; font-size: 0.8rem; font-weight: 650;
  padding: 0.55rem;
  cursor: pointer;
  min-height: 44px;
  transition: all .2s var(--dash-ease);
  -webkit-tap-highlight-color: transparent;
}
.dash-card-more-btn:hover { border-color: var(--dash-accent); }
.dash-card-more-btn:active { transform: scale(.97); }

.dash-modal-backdrop {
  position: fixed; inset: 0; z-index: 1060;
  background: rgba(16,24,40,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.dash-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.dash-modal {
  width: 100%; max-width: 640px; max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(16,24,40,.35);
  transform: translateY(14px) scale(.98);
  transition: transform .25s var(--dash-ease);
  overflow: hidden;
}
.dash-modal-backdrop.open .dash-modal { transform: none; }
.dash-modal-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--dash-border-soft);
  background: var(--dash-card);
}
.dash-modal-hd .dash-drawer-title { font-size: 1rem; }
.dash-modal-count {
  font-size: 0.75rem; font-weight: 700; color: var(--dash-danger);
  background: #fee2e2; border-radius: 999px; padding: 0.15rem 0.55rem;
}
.dash-modal-body { overflow-y: auto; padding: 0.35rem 0; }
.dash-modal-body .dash-old-item { padding: 0.85rem 1.25rem; }
.dash-modal-body .dash-old-sku { font-size: 0.85rem; }
.dash-modal-body .dash-old-desc { font-size: 0.75rem; }
.dash-modal-body .dash-old-dias { font-size: 0.85rem; }

/* ---------- Modal de sistema (confirmaciones) ---------- */
.sys-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 14, 24, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.sys-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.sys-modal {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  transform: translateY(16px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.sys-modal-backdrop.open .sys-modal {
  transform: translateY(0) scale(1);
}
.sys-modal-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  color: #fff;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.3);
}
.sys-modal-icon.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.sys-modal-icon.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.sys-modal h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.5rem;
}
.sys-modal-text {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin: 0 0 1.5rem;
  word-break: break-word;
}
.sys-modal-text strong {
  color: var(--color-text);
  font-weight: 700;
}
.sys-modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}
.sys-modal-actions .btn {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  font-weight: 600;
  border-radius: 11px;
  white-space: nowrap;
}
[data-theme="dark"] .sys-modal {
  background: var(--color-surface);
  border-color: #2c2f3e;
}
[data-theme="dark"] .sys-modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

@media (max-width: 380px) {
  .sys-modal {
    padding: 1.4rem 1.1rem 1.2rem;
  }
  .sys-modal-icon {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
  }
  .sys-modal-actions {
    flex-direction: column;
  }
  .sys-modal-actions .btn {
    width: 100%;
  }
}

/* ---------- Toolbar ---------- */
.dash-table-section { margin-top: 1.25rem; }
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.dash-toolbar-left, .dash-toolbar-right { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.dash-seg {
  display: inline-flex; gap: 0.2rem;
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: 12px;
  padding: 0.2rem;
  box-shadow: var(--dash-shadow);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.dash-seg::-webkit-scrollbar { display: none; }
.dash-seg-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: none; background: transparent;
  font-family: inherit;
  font-size: 0.78rem; font-weight: 600; color: var(--dash-muted);
  padding: 0.45rem 0.7rem;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s var(--dash-spring);
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.dash-seg-btn:hover { color: var(--dash-text); background: var(--dash-bg); }
.dash-seg-btn:active { transform: scale(.94); }
.dash-seg-btn.active { color: var(--dash-accent); background: var(--dash-accent-soft); }
.dash-seg-txt { display: none; }
.dash-seg-badge {
  min-width: 20px; height: 20px; padding: 0 0.35rem;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
}
.dash-seg-badge.danger { background: #fee2e2; color: var(--dash-danger); }
.dash-seg-badge.warn { background: #ffedd5; color: var(--dash-warn); }
.dash-seg-badge.amber { background: #fef3c7; color: var(--dash-amber); }
.dash-seg-badge.neutral { background: #f2f4f7; color: var(--dash-muted); }
.dash-seg-btn.active .dash-seg-badge { color: var(--dash-accent); }
.dash-count { font-size: 0.78rem; color: var(--dash-muted); font-weight: 550; white-space: nowrap; }

.dash-pill-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--dash-border);
  background: var(--dash-card);
  color: var(--dash-muted);
  font-family: inherit; font-size: 0.8rem; font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  min-height: 40px;
  box-shadow: var(--dash-shadow);
  transition: all .2s var(--dash-ease);
  -webkit-tap-highlight-color: transparent;
}
.dash-pill-btn:hover { color: var(--dash-accent); border-color: var(--dash-accent); background: var(--dash-accent-soft); }
.dash-pill-btn:active { transform: scale(.96); }
.dash-icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--dash-border);
  background: var(--dash-card);
  color: var(--dash-muted);
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--dash-shadow);
  transition: all .2s var(--dash-ease);
  -webkit-tap-highlight-color: transparent;
}
.dash-icon-btn:hover { color: var(--dash-accent); border-color: var(--dash-accent); background: var(--dash-accent-soft); }
.dash-icon-btn:active { transform: scale(.92); }
.dash-mobile-filters-btn { display: none; }

/* ---------- Filter drawer (desktop: inline card / mobile: bottom sheet) ---------- */
.dash-filter-drawer {
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  box-shadow: var(--dash-shadow);
  margin-bottom: 0.9rem;
}
.dash-drawer-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--dash-border-soft);
}
.dash-drawer-title { font-size: 0.8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--dash-text); }
.dash-drawer-title i { color: var(--dash-accent); }
#dashDrawerClose { display: none; }
.dash-drawer-body { padding: 0.9rem; }
.dash-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.dash-field-group { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.dash-field-label { font-size: 0.7rem; font-weight: 650; color: var(--dash-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-field-wrap { position: relative; }
.dash-field-wrap > i {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 0.9rem; color: var(--dash-dim); pointer-events: none;
}
.dash-field-wrap .dash-field { padding-left: 2.2rem; }
.dash-field {
  width: 100%;
  appearance: none; -webkit-appearance: none;
  border: 1.5px solid var(--dash-border);
  background: var(--dash-card);
  color: var(--dash-text);
  font-family: inherit; font-size: 0.85rem; font-weight: 500;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.dash-field:focus { outline: none; border-color: var(--dash-accent); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.dash-field::placeholder { color: var(--dash-dim); font-weight: 450; }
select.dash-field {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}
.dash-filter-toggles { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dash-filter-panels { margin-top: 0.7rem; }

/* ---------- Pasillo / Seccion / Atributo chips ---------- */
.dash-pasillos {
  display: none;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.7rem;
  background: var(--dash-bg);
  border: 1px solid var(--dash-border-soft);
  border-radius: 12px;
  margin-bottom: 0.6rem;
}
.dash-pasillos[style*="flex"] { display: flex !important; }
.dash-pasillo-chk {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; font-weight: 550;
  background: var(--dash-card);
  border: 1.5px solid var(--dash-border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer; user-select: none;
  color: var(--dash-muted);
  transition: all .2s var(--dash-spring);
  -webkit-tap-highlight-color: transparent;
  min-height: 34px;
}
.dash-pasillo-chk input { accent-color: var(--dash-accent); width: 14px; height: 14px; }
.dash-pasillo-chk:hover { border-color: var(--dash-accent); color: var(--dash-text); }
.dash-pasillo-chk:active { transform: scale(.94); }
.dash-pasillo-chk:has(input:checked) {
  background: var(--dash-accent-soft); color: var(--dash-accent); border-color: var(--dash-accent); font-weight: 700;
}

/* ---------- Table ---------- */
.dash-table-wrap {
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  overflow: hidden;
  box-shadow: var(--dash-shadow);
}
.dash-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.dash-tbl thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--dash-card);
  border-bottom: 1px solid var(--dash-border);
  color: var(--dash-dim);
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  text-align: left;
  padding: 0.8rem 0.9rem;
  white-space: nowrap;
}
.dash-tbl td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--dash-border-soft);
  vertical-align: middle;
  white-space: nowrap;
  color: var(--dash-text);
}
.dash-tbl tbody tr { transition: background .15s var(--dash-ease); }
.dash-tbl tbody tr:hover { background: var(--dash-bg); }
.dash-tbl tbody tr:last-child td { border-bottom: none; }
.dash-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-tbl td.num { font-weight: 600; }
.dash-tbl td.num.neg { color: var(--dash-danger); }
.dash-sku {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.8rem; font-weight: 700;
  background: var(--dash-bg);
  border: 1px solid var(--dash-border-soft);
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
}
.dash-desc { color: var(--dash-muted); font-weight: 500; }
.dash-muted { color: var(--dash-muted); font-weight: 500; }
.dash-days { font-weight: 800; font-variant-numeric: tabular-nums; }
.dash-days.warn { color: var(--dash-warn); }
.dash-days.danger { color: var(--dash-danger); }

/* ---------- Badges de estado ---------- */
.dash-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 650;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
}
.dash-badge i { font-size: 0.78rem; }
.dash-badge-danger { background: #fef2f2; color: var(--dash-danger); border: 1px solid #fecaca; }
.dash-badge-warn { background: #fff7ed; color: var(--dash-warn); border: 1px solid #fed7aa; }
.dash-badge-amber { background: #fffbeb; color: var(--dash-amber); border: 1px solid #fde68a; }
.dash-badge-success { background: #f0fdf4; color: var(--dash-success); border: 1px solid #bbf7d0; }
.dash-badge-info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.dash-badge-neutral { background: #f9fafb; color: var(--dash-muted); border: 1px solid var(--dash-border); }

/* ---------- Mobile cards ---------- */
.dash-cards { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.9rem; }
.dash-card-item {
  background: var(--dash-card);
  border: 1px solid var(--dash-border);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: var(--dash-shadow);
  transition: box-shadow .2s var(--dash-ease);
}
.dash-card-item:active { box-shadow: var(--dash-shadow-lg); }
.dash-card-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.dash-card-item-title { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.dash-card-item-title .dash-sku { align-self: flex-start; }
.dash-card-desc { font-size: 0.82rem; color: var(--dash-muted); font-weight: 500; }
.dash-card-item-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0.9rem 0;
  padding: 0.7rem 0;
  border-top: 1px solid var(--dash-border-soft);
  border-bottom: 1px solid var(--dash-border-soft);
}
.dash-stat { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.dash-stat-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dash-dim); }
.dash-stat-num { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.dash-stat-num.text-danger { color: var(--dash-danger); }
.dash-stat-num.text-warning { color: var(--dash-warn); }
.dash-card-detail-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--dash-bg);
  border: 1px solid var(--dash-border);
  border-radius: 10px;
  font-family: inherit; font-size: 0.78rem; font-weight: 650; color: var(--dash-muted);
  padding: 0.55rem;
  cursor: pointer;
  min-height: 44px;
  transition: all .2s var(--dash-ease);
  -webkit-tap-highlight-color: transparent;
}
.dash-card-detail-btn i { transition: transform .25s var(--dash-ease); }
.dash-card-detail-btn.open i { transform: rotate(180deg); }
.dash-card-detail-btn:hover { color: var(--dash-accent); border-color: var(--dash-accent); }
.dash-card-detail {
  max-height: 0; overflow: hidden;
  transition: max-height .3s var(--dash-ease);
}
.dash-card-detail-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--dash-border-soft);
  font-size: 0.78rem;
}
.dash-card-detail-row:last-child { border-bottom: none; }
.dash-card-detail-row span { color: var(--dash-dim); font-weight: 550; }
.dash-card-detail-row b { color: var(--dash-text); font-weight: 650; text-align: right; }

/* ---------- Empty list ---------- */
.dash-empty-list { text-align: center; padding: 3rem 1rem; color: var(--dash-dim); }
.dash-empty-list i { font-size: 2.2rem; opacity: 0.35; }
.dash-empty-list p { margin: 0.5rem 0 0; font-size: 0.85rem; }

/* ---------- Pagination ---------- */
.dash-pagination {
  display: flex; justify-content: center; align-items: center; gap: 0.35rem;
  padding: 0.9rem;
  border-top: 1px solid var(--dash-border-soft);
}
.dash-page-btn {
  min-width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--dash-border);
  background: var(--dash-card);
  color: var(--dash-muted);
  font-family: inherit; font-size: 0.82rem; font-weight: 650;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s var(--dash-ease);
  -webkit-tap-highlight-color: transparent;
}
.dash-page-btn:hover { color: var(--dash-accent); border-color: var(--dash-accent); }
.dash-page-btn:active { transform: scale(.92); }
.dash-page-btn.active { background: var(--dash-accent); border-color: var(--dash-accent); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.dash-page-btn:disabled { opacity: .4; pointer-events: none; }

/* ---------- Print ---------- */
@media print {
  .dash { margin: 0; padding: 0; background: #fff; }
  .dash-header-actions, .dash-refresh-btn, .dash-kpis, .dash-row,
  .dash-card-mov, .dash-hidden-canvas, .dash-filter-drawer,
  .dash-toolbar-right, .sidebar, .bottom-nav-wrap, .theme-toggle,
  .dash-pagination { display: none !important; }
  .dash-table-section { margin-top: 0; }
  .dash-table-wrap { border: 1px solid #000; border-radius: 0; box-shadow: none; }
  .dash-tbl thead th { background: #fff; color: #000; border-bottom: 1px solid #000; }
  .dash-tbl td { border-bottom: 1px solid #ddd; }
  .dash-badge { border: 1px solid #999; background: #fff !important; color: #000 !important; }
  .dash-seg, .dash-count { display: none !important; }
  body { background: #fff; }
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] .dash {
  --dash-bg: #0f1117;
  --dash-card: #171a21;
  --dash-border: #2b2f3a;
  --dash-border-soft: #21242e;
  --dash-text: #e7eaf0;
  --dash-muted: #9aa1ae;
  --dash-dim: #6c7483;
  --dash-accent-soft: rgba(99,102,241,.16);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(99,102,241,.09), transparent 60%),
    var(--dash-bg);
}
[data-theme="dark"] .dash-header-select select,
[data-theme="dark"] .dash-field,
[data-theme="dark"] .dash-field-wrap > i { color: var(--dash-text); }
[data-theme="dark"] .dash-kpi:hover,
[data-theme="dark"] .dash-card:hover { border-color: #3a3f4c; }
[data-theme="dark"] .dash-tbl thead th { background: var(--dash-card); }
[data-theme="dark"] .dash-tbl tbody tr:hover { background: #1b1f28; }
[data-theme="dark"] .dash-sku { background: #1e222c; border-color: #2b2f3a; }
[data-theme="dark"] .dash-mov-list li { background: #1b1f28; }
[data-theme="dark"] .dash-pasillos { background: #13161d; }
[data-theme="dark"] .dash-pasillo-chk { background: #1e222c; }
[data-theme="dark"] .dash-badge-danger { background: rgba(220,38,38,.14); border-color: rgba(220,38,38,.4); color: #fca5a5; }
[data-theme="dark"] .dash-badge-warn { background: rgba(234,88,12,.14); border-color: rgba(234,88,12,.4); color: #fdba74; }
[data-theme="dark"] .dash-badge-amber { background: rgba(217,119,6,.14); border-color: rgba(217,119,6,.4); color: #fcd34d; }
[data-theme="dark"] .dash-badge-success { background: rgba(22,163,74,.14); border-color: rgba(22,163,74,.4); color: #86efac; }
[data-theme="dark"] .dash-badge-info { background: rgba(37,99,235,.16); border-color: rgba(37,99,235,.45); color: #93c5fd; }
[data-theme="dark"] .dash-badge-neutral { background: #1e222c; color: var(--dash-muted); border-color: #2b2f3a; }
[data-theme="dark"] .dash-hdr-badge.danger { background: rgba(220,38,38,.16); color: #fca5a5; }
[data-theme="dark"] .dash-hdr-badge.warn { background: rgba(234,88,12,.16); color: #fdba74; }
[data-theme="dark"] .dash-hdr-badge.amber { background: rgba(217,119,6,.16); color: #fcd34d; }
[data-theme="dark"] .dash-hdr-badge.neutral { background: #1e222c; color: var(--dash-muted); }
[data-theme="dark"] .dash-seg-badge.danger { background: rgba(220,38,38,.16); color: #fca5a5; }
[data-theme="dark"] .dash-seg-badge.warn { background: rgba(234,88,12,.16); color: #fdba74; }
[data-theme="dark"] .dash-seg-badge.amber { background: rgba(217,119,6,.16); color: #fcd34d; }
[data-theme="dark"] .dash-seg-badge.neutral { background: #1e222c; color: var(--dash-muted); }
[data-theme="dark"] .dash-seg-btn:hover { background: #1e222c; }
[data-theme="dark"] .dash-old-item:hover { background: #13161d; }
[data-theme="dark"] .dash-old-state { background: rgba(220,38,38,.16); color: #fca5a5; }
[data-theme="dark"] .dash-page-btn { background: #1e222c; border-color: #2b2f3a; }
[data-theme="dark"] .dash-card-detail-btn { background: #1e222c; border-color: #2b2f3a; }
[data-theme="dark"] .dash-drawer-hd { border-bottom-color: #21242e; }

/* ---------- Responsive ---------- */
@media (min-width: 769px) {
  .dash-seg-txt { display: inline; }
}
@media (max-width: 1440px) {
  .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .dash-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dash { margin: -1rem; padding: 1rem; padding-bottom: 110px; }
  .dash-header { flex-direction: column; align-items: stretch; }
  .dash-header-actions { justify-content: space-between; }
  .dash-header-date { display: none; }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .dash-row-3 { grid-template-columns: 1fr; }
  .dash-mov { grid-template-columns: 1fr; }
  .dash-mov-col + .dash-mov-col { border-left: none; border-top: 1px solid var(--dash-border-soft); }
  .dash-kpi-num { font-size: 1.3rem; }
  .dash-kpi-icon { width: 36px; height: 36px; font-size: 1rem; }

  /* Filtros -> bottom sheet */
  .dash-mobile-filters-btn { display: inline-flex; }
  .dash-filter-drawer {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    z-index: 1050;
    margin: 0;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    box-shadow: 0 -8px 40px rgba(16,24,40,.22);
    transform: translateY(110%);
    transition: transform .35s var(--dash-ease);
    max-height: 82vh;
    display: flex; flex-direction: column;
  }
  .dash-filter-drawer.open { transform: translateY(0); }
  .dash-drawer-hd { padding: 1rem 1rem 0.6rem; }
  .dash-drawer-body { overflow-y: auto; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  #dashDrawerClose { display: inline-flex; }
  .dash-seg-btn { min-height: 42px; }
  .dash-pill-btn, .dash-icon-btn, .dash-refresh-btn { min-height: 44px; }
  body.dash-drawer-open { overflow: hidden; }
  .dash-drawer-backdrop {
    position: fixed; inset: 0; z-index: 1049;
    background: rgba(16,24,40,.45);
    opacity: 0; pointer-events: none;
    transition: opacity .3s;
  }
  .dash-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
}
@media (max-width: 430px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-filter-grid { grid-template-columns: 1fr; }
  .dash-toolbar-left { width: 100%; }
  .dash-seg { width: 100%; }
  .dash-seg-btn { flex: 1; justify-content: center; }
}
@media (max-width: 360px) {
  .dash-refresh-label { display: none; }
  .dash-kpi { padding: 0.8rem; }
}
/* ============ WATERMARK ============ */


/* ============ MARCA DE AGUA ============ */

/* PC: sidebar */
.sidebar-watermark {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  user-select: none;
}
.sidebar-wm-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.sidebar-wm-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.35);
}
.sidebar-wm-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-wm-name {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-nav-text);
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-wm-sub {
  margin-top: 0.12rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-nav-text);
  opacity: 0.55;
  white-space: nowrap;
}
.sidebar-wm-mail {
  margin-top: 0.14rem;
  font-size: 0.56rem;
  font-weight: 500;
  color: var(--color-nav-text);
  opacity: 0.45;
  word-break: break-all;
  line-height: 1.3;
}
[data-theme="dark"] .sidebar-wm-mail { opacity: 0.5; }

/* Móvil: footer (debajo del bottom-nav) */
.bottom-nav-wrap {
  padding-bottom: 0;
}
.bottom-nav-watermark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
  background: var(--color-bottom-nav-bg);
  border-top: 1px solid var(--color-bottom-nav-border);
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  user-select: none;
}
.bottom-wm-name {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.bottom-wm-sub {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  opacity: 0.7;
}
[data-theme="dark"] .bottom-wm-name,
[data-theme="dark"] .bottom-wm-sub { color: var(--color-text-muted); }

/* Login: credencial corporativa debajo del formulario */
.login-wm-wrap {
  margin-top: 1.4rem;
  border-radius: 14px;
  overflow: hidden;
  user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(2, 12, 30, 0.28);
}
.login-wm-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(120deg, var(--color-primary-dark, #0a2540), var(--color-primary, #0052cc));
  color: #fff;
  position: relative;
}
.login-wm-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 60px at 90% 0%, rgba(255, 255, 255, 0.14), transparent 70%);
  pointer-events: none;
}
.login-wm-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.login-wm-head { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
.login-wm-tag {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.72;
}
.login-wm-name {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  line-height: 1.35;
  color: #fff;
  opacity: 0.96;
}
[data-theme="dark"] .login-wm-wrap {
  background: linear-gradient(180deg, var(--color-surface-alt, #1e2130), var(--color-surface, #1a1d27));
  border-color: #2c2f3e;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.login-wm-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
}
[data-theme="dark"] .login-wm-divider {
  background: linear-gradient(90deg, transparent, #2c2f3e, transparent);
}
.login-wm-detail {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-secondary);
}
.login-wm-detail .login-wm-sub,
.login-wm-detail .login-wm-mail {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.4;
  word-break: break-all;
}
.login-wm-detail i {
  font-size: 0.75rem;
  opacity: 0.7;
  flex-shrink: 0;
}
.login-wm-detail .login-wm-sub { color: var(--color-text); opacity: 0.9; }
.login-wm-detail .login-wm-mail { opacity: 0.7; }

/* ============ SECCIONES (form usuario) ============ */
.secciones-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: 0.75rem;
  background: var(--color-surface-alt, #f8f9fa);
  min-height: 56px;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.secciones-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-border, #ced4da);
  background: var(--color-surface, #fff);
  color: var(--color-text-secondary, #4b5563);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.secciones-chip:active { transform: scale(0.92); }
.secciones-chip:hover { border-color: var(--color-primary, #6366f1); }
.secciones-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.secciones-chip.is-checked {
  background: var(--color-primary, #6366f1);
  border-color: var(--color-primary, #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.secciones-chip.is-checked:active { transform: scale(0.92); }
