/* ==========================================================================
   BÁEZ POS - SAAS UI CORE DESIGN SYSTEM (Stripe / Vercel Standard)
   Alexander Baez - 2026
   ========================================================================== */

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

:root {
  /* Tipografía y Fuentes */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* Paleta Base Light Premium */
  --saas-bg-main: #f8fafc;
  --saas-surface: #ffffff;
  --saas-border: #e2e8f0;
  --saas-border-subtle: #f1f5f9;
  
  /* Textos */
  --saas-text-heading: #0f172a;
  --saas-text-body: #334155;
  --saas-text-muted: #64748b;
  --saas-text-subtle: #94a3b8;

  /* Colores de Marca y Acción */
  --saas-primary: #2563eb;
  --saas-primary-hover: #1d4ed8;
  --saas-primary-subtle: #eff6ff;
  --saas-primary-border: #bfdbfe;

  --saas-success: #16a34a;
  --saas-success-subtle: #f0fdf4;
  --saas-danger: #e11d48;
  --saas-danger-subtle: #fff1f2;
  --saas-warning: #f59e0b;
  --saas-warning-subtle: #fffbeb;

  /* Sombras Modernas Multinivel (Vercel / Stripe Style) */
  --saas-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --saas-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
  --saas-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --saas-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --saas-shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --saas-shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.18);

  /* Radios de curvatura estándar */
  --saas-radius-sm: 8px;
  --saas-radius-md: 12px;
  --saas-radius-lg: 16px;
  --saas-radius-xl: 20px;

  --sidebar-width: 250px;
}

/* ==========================================================================
   RESETEOS GLOBALES Y TIPOGRAFÍA
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--saas-bg-main) !important;
  color: var(--saas-text-body);
  font-family: var(--font-sans) !important;
  letter-spacing: -0.011em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-sans) !important;
  color: var(--saas-text-heading);
  font-weight: 700;
  letter-spacing: -0.025em;
}

button, input, select, textarea {
  font-family: var(--font-sans) !important;
}

/* Tipografía Tabular para Números e Importes Financieros */
.amount-num, .font-mono-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
}

/* ==========================================================================
   LAYOUT PRINCIPAL (#content)
   ========================================================================== */
#content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: var(--saas-bg-main);
  overflow-x: hidden;
}

/* ==========================================================================
   CARDS Y CONTENEDORES ELEVADOS
   ========================================================================== */
.card, .stat-card, .table-card, .data-card, .card-saas {
  background-color: var(--saas-surface) !important;
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-md) !important;
  box-shadow: var(--saas-shadow) !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover, .stat-card:hover, .data-card:hover, .card-saas:hover {
  box-shadow: var(--saas-shadow-md) !important;
}

.table-card {
  border-radius: var(--saas-radius-lg) !important;
  overflow: hidden;
}

/* Stat Cards con Borde Lateral Acentuado */
.stat-card {
  border-start-width: 4px !important;
}

/* ==========================================================================
   BOTONES PREMIUM
   ========================================================================== */
.btn {
  border-radius: var(--saas-radius-sm) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  padding: 0.55rem 1.15rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1) !important;
  letter-spacing: -0.01em;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--saas-primary) !important;
  border-color: var(--saas-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background-color: var(--saas-primary-hover) !important;
  border-color: var(--saas-primary-hover) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28) !important;
  transform: translateY(-1px);
}

.btn-action {
  border: 1px solid var(--saas-border) !important;
  background: var(--saas-surface) !important;
  width: 34px;
  height: 34px;
  border-radius: var(--saas-radius-sm) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--saas-text-muted) !important;
  transition: all 0.15s ease;
  padding: 0 !important;
}

.btn-action:hover {
  background: var(--saas-border-subtle) !important;
  color: var(--saas-text-heading) !important;
  border-color: var(--saas-text-subtle) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   NAV PILLS Y TABS SAAS PREMIUM
   ========================================================================== */
.nav-pills .nav-link {
  border-radius: var(--saas-radius-sm) !important;
  color: var(--saas-text-muted) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  padding: 0.5rem 1.15rem !important;
  transition: all 0.18s ease !important;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-pills .nav-link:hover {
  color: var(--saas-text-heading) !important;
  background-color: var(--saas-border-subtle) !important;
}

.nav-pills .nav-link.active {
  background-color: var(--saas-primary) !important;
  color: #ffffff !important;
  box-shadow: var(--saas-shadow-sm) !important;
}

/* ==========================================================================
   INPUTS Y FORMULARIOS (DISEÑO CLARO, CONTRASTE ÓPTIMO Y FOCUS PREMIUM)
   ========================================================================== */
label.form-label, .form-label, .form-group label {
  color: #334155 !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  margin-bottom: 0.4rem !important;
  display: inline-block;
}

.form-control, .form-select {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: var(--saas-radius-sm) !important;
  padding: 0.55rem 0.85rem !important;
  font-size: 0.875rem !important;
  font-weight: 500;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

.form-control:focus, .form-select:focus {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
  outline: none !important;
}

.form-select option {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

/* Compatibilidad precisa para Bootstrap 5 form-floating */
.form-floating > .form-control {
  height: calc(3.5rem + 2px) !important;
  line-height: 1.25 !important;
  padding: 1rem 0.75rem !important;
}

.form-floating > .form-control::placeholder {
  color: transparent !important;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) {
  padding-top: 1.625rem !important;
  padding-bottom: 0.625rem !important;
}

.form-floating > label {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 2 !important;
  height: 100% !important;
  padding: 1rem 0.75rem !important;
  margin-bottom: 0 !important;
  font-size: 0.875rem !important;
  pointer-events: none !important;
  transform-origin: 0 0 !important;
  transition: opacity .15s ease-in-out, transform .15s ease-in-out !important;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  opacity: .75 !important;
  transform: scale(.85) translateY(-.5rem) translateX(.15rem) !important;
}

.form-control:disabled, .form-control[readonly],
.form-select:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  border-color: #e2e8f0 !important;
  opacity: 1;
}

.input-group-text {
  border-radius: var(--saas-radius-sm) !important;
  border-color: #cbd5e1 !important;
  background-color: #f8fafc !important;
  color: #475569 !important;
  font-size: 0.875rem !important;
}

/* ==========================================================================
   TABLAS PULIDAS Y MINIMALISTAS
   ========================================================================== */
.table, .custom-table {
  color: var(--saas-text-body);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin-bottom: 0 !important;
}

.table thead th, .custom-table thead th {
  background-color: #f8fafc !important;
  color: var(--saas-text-muted) !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 0.85rem 1rem !important;
  border-top: none !important;
  border-bottom: 1px solid var(--saas-border) !important;
  white-space: nowrap;
}

.table tbody td, .custom-table tbody td {
  padding: 0.95rem 1rem !important;
  border-bottom: 1px solid var(--saas-border-subtle) !important;
  border-top: none !important;
  vertical-align: middle;
  font-size: 0.875rem;
  transition: background-color 0.15s ease;
}

.table tbody tr:hover td, .custom-table tbody tr:hover td {
  background-color: rgba(241, 245, 249, 0.6) !important;
}

.table tbody tr:last-child td, .custom-table tbody tr:last-child td {
  border-bottom: none !important;
}

/* ==========================================================================
   MODALES PREMIUM (ESTILO VERCEL / STRIPE)
   ========================================================================== */
.modal-content {
  border: 1px solid var(--saas-border) !important;
  border-radius: var(--saas-radius-lg) !important;
  box-shadow: var(--saas-shadow-modal) !important;
  overflow: hidden;
  background-color: #ffffff !important;
}

.modal-backdrop.show {
  opacity: 0.45;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-header {
  border-bottom: 1px solid var(--saas-border) !important;
  padding: 1.25rem 1.5rem !important;
}

.modal-body {
  padding: 1.5rem !important;
}

.modal-footer {
  border-top: 1px solid var(--saas-border) !important;
  padding: 1rem 1.5rem !important;
  background-color: #f8fafc;
}

/* ==========================================================================
   BADGES, ROLES Y AVATARS
   ========================================================================== */
.badge {
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  padding: 0.35rem 0.65rem !important;
  border-radius: 9999px !important;
  letter-spacing: 0.02em;
}

.balance-badge {
  padding: 0.35rem 0.75rem !important;
  border-radius: 9999px !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--saas-primary-subtle);
  color: var(--saas-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.role-badge.admin { background: #fee2e2; color: #dc2626; }
.role-badge.vendedor { background: #dbeafe; color: #2563eb; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--saas-border);
  background: #fff;
  color: var(--saas-text-muted);
  transition: all 0.15s ease;
}
.btn-icon:hover { background: var(--saas-border-subtle); color: var(--saas-text-heading); }
.btn-icon.delete:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* ==========================================================================
   COMPONENTE: PUNTO DE VENTA (POS VIEW)
   ========================================================================== */
.navbar,
nav.navbar,
.navbar.sticky-top {
  z-index: 1030 !important;
}

.card-pos {
  height: calc(100vh - 90px);
  border: 1px solid var(--saas-border);
  border-radius: var(--saas-radius-lg);
  background: var(--saas-surface);
}

.total-display {
  font-size: 3rem;
  font-weight: 800;
  color: var(--saas-text-heading);
  line-height: 1;
  letter-spacing: -0.03em;
}

.table-responsive-pos {
  height: calc(100vh - 210px);
  overflow-y: auto;
}

.metodo-pago {
  cursor: pointer;
  border: 2px solid var(--saas-border);
  border-radius: var(--saas-radius-sm);
  transition: all 0.18s ease;
  padding: 10px 6px;
  text-align: center;
  background: #ffffff;
  user-select: none;
}
.metodo-pago:active {
  transform: scale(0.97);
}
.metodo-pago.active {
  border-color: var(--saas-primary);
  background: var(--saas-primary-subtle);
  color: var(--saas-primary);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}
.metodo-pago i {
  font-size: 1.35rem;
  display: block;
  margin-bottom: 2px;
}

/* ==========================================================================
   DROPDOWN DE BÚSQUEDA Y SUGERENCIAS (POS / AUTOCOMPLETE)
   Accesibilidad y Contraste Óptimo (WCAG AAA) en Navegación por Teclado
   ========================================================================== */
.sugerencias-box {
  z-index: 1050;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  border-radius: var(--saas-radius-sm);
  border: 1px solid var(--saas-border);
  box-shadow: var(--saas-shadow-lg);
  background-color: #ffffff;
}

.sugerencias-box .list-group-item {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Estado activo / seleccionado mediante teclado o interacción */
.sugerencias-box .list-group-item.active,
.sugerencias-box .list-group-item.active:hover,
.sugerencias-box .list-group-item.active:focus,
#listaSugerencias .list-group-item.active,
#listaSugerencias .list-group-item.active:hover,
#listaSugerencias .list-group-item.active:focus {
  background-color: var(--saas-primary, #2563eb) !important;
  border-color: var(--saas-primary, #2563eb) !important;
  color: #ffffff !important;
}

/* Forzar color blanco (#ffffff) con alta especificidad sobre clases utilitarias de Bootstrap */
.sugerencias-box .list-group-item.active *,
.sugerencias-box .list-group-item.active .text-primary,
.sugerencias-box .list-group-item.active .text-muted,
.sugerencias-box .list-group-item.active .text-dark,
.sugerencias-box .list-group-item.active .fw-bold,
.sugerencias-box .list-group-item.active .fw-semibold,
.sugerencias-box .list-group-item.active .item-busqueda,
.sugerencias-box .list-group-item.active .item-busqueda div,
.sugerencias-box .list-group-item.active .item-busqueda small,
.sugerencias-box .list-group-item.active .h6,
.sugerencias-box .list-group-item.active small,
.sugerencias-box .list-group-item.active span,
.sugerencias-box .list-group-item.active i,
#listaSugerencias .list-group-item.active *,
#listaSugerencias .list-group-item.active .text-primary,
#listaSugerencias .list-group-item.active .text-muted,
#listaSugerencias .list-group-item.active .text-dark,
#listaSugerencias .list-group-item.active .fw-bold,
#listaSugerencias .list-group-item.active .fw-semibold,
#listaSugerencias .list-group-item.active .item-busqueda,
#listaSugerencias .list-group-item.active .item-busqueda div,
#listaSugerencias .list-group-item.active .item-busqueda small,
#listaSugerencias .list-group-item.active .h6,
#listaSugerencias .list-group-item.active small,
#listaSugerencias .list-group-item.active span,
#listaSugerencias .list-group-item.active i {
  color: #ffffff !important;
}

/* Badges de stock en ítem activo: contraste WCAG AAA y diferenciación visual */
.sugerencias-box .list-group-item.active .badge,
#listaSugerencias .list-group-item.active .badge {
  color: #ffffff !important;
}

.sugerencias-box .list-group-item.active .badge.bg-light,
#listaSugerencias .list-group-item.active .badge.bg-light {
  background-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
}

.sugerencias-box .list-group-item.active .badge.bg-danger,
#listaSugerencias .list-group-item.active .badge.bg-danger {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
}

/* Fila de venta anulada en historial de ventas */
tr.status-anulada {
  background-color: rgba(248, 249, 250, 0.65) !important;
}

tr.status-anulada td {
  color: var(--saas-text-muted, #64748b);
}

.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--saas-border);
  padding: 10px 16px;
  z-index: 1040;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   COMPONENTE: LOGIN SAAS
   ========================================================================== */
body.login-page {
  background: radial-gradient(circle at top right, #3b82f6, #1e3a8a) !important;
  height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: var(--saas-radius-xl) !important;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4) !important;
  overflow: hidden;
}

.card-header-custom {
  padding: 36px 20px 12px;
  text-align: center;
}

.logo-text {
  font-weight: 800;
  font-size: 2.25rem;
  color: #1e3a8a;
  letter-spacing: -0.04em;
  margin-bottom: 0.25rem;
}

.btn-login {
  background: linear-gradient(135deg, #1e3a8a, #2563eb) !important;
  border: none !important;
  border-radius: var(--saas-radius-sm) !important;
  padding: 0.75rem 1rem !important;
  font-weight: 700 !important;
  color: white !important;
  transition: all 0.2s ease !important;
}

.btn-login:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3) !important;
}

.text-id-display {
  font-family: monospace;
  font-size: 0.85rem;
  background: #eef2ff;
  color: #1e40af;
  border: 1px dashed #3b82f6;
}

/* ==========================================================================
   VISTA PREVIA TICKET TÃ‰RMICO
   ========================================================================== */
.sticky-ticket-container {
  position: sticky;
  top: 2rem;
  z-index: 10;
}

.preview-ticket {
  font-family: 'Courier New', Courier, monospace !important;
  border: 2px dashed #cbd5e1 !important;
  background-color: #ffffff !important;
  border-radius: var(--saas-radius-sm) !important;
}

.style-subtext {
  font-size: 11px;
}

/* ==========================================================================
   ESTADO VACÍO PROFESIONAL (.empty-state)
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  margin: 0 auto;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--saas-border-subtle);
  color: var(--saas-text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--saas-shadow-sm);
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--saas-text-heading);
  margin-bottom: 0.35rem;
}

.empty-state-message {
  font-size: 0.875rem;
  color: var(--saas-text-muted);
  max-width: 380px;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.empty-state-action {
  margin-top: 0.25rem;
}

/* ==========================================================================
   SCROLLBAR ELEGANTE
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   SIDEBAR Y BACKDROP MOBILE
   ========================================================================== */
#sidebar {
  z-index: 1050 !important;
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040 !important;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVIDAD Y MOBILE FIRST BREAKPOINTS (@media (max-width: 768px))
   ========================================================================== */
@media (max-width: 768px) {
  #content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Respiración Móvil / Padding Seguro (Mínimo 15px en teléfono) */
  .container-fluid {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  .card, .stat-card, .table-card, .card-saas {
    padding: 15px !important;
    border-radius: var(--saas-radius-md) !important;
    margin-bottom: 1rem !important;
  }

  .card-body {
    padding: 15px !important;
  }

  /* Títulos y Tipografía Mobile */
  h1, .h1 { font-size: 1.4rem !important; }
  h2, .h2 { font-size: 1.25rem !important; }
  h3, .h3 { font-size: 1.1rem !important; }
  h4, .h4 { font-size: 1rem !important; }
  h5, .h5 { font-size: 0.95rem !important; }

  /* Tablas en Mobile */
  .table thead th {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.68rem !important;
  }
  .table tbody td {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.8125rem !important;
  }

  /* POS en Mobile */
  .card-pos {
    height: auto !important;
    min-height: initial;
    border-radius: var(--saas-radius-md);
  }

  .table-responsive-pos {
    height: auto;
    max-height: 380px;
  }

  .total-display {
    font-size: 2.25rem;
  }

  /* Empleados Mobile Transformation */
  .data-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .custom-table thead { display: none !important; }
  .custom-table, .custom-table tbody, .custom-table tr, .custom-table td {
    display: block !important;
    width: 100% !important;
  }
  .custom-table tbody tr {
    background: #ffffff !important;
    border: 1px solid var(--saas-border) !important;
    border-radius: var(--saas-radius-md) !important;
    padding: 15px !important;
    margin-bottom: 0.75rem !important;
    box-shadow: var(--saas-shadow-sm) !important;
  }
  .custom-table td {
    padding: 0 !important;
    border: none !important;
  }
  .mobile-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }
  .mobile-card-middle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px dashed var(--saas-border);
  }
  .mobile-card-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
  }

  /* Modales en Mobile: Respiración y padding mínimo de 15px */
  .modal-dialog {
    margin: 15px !important;
  }
  .modal-content {
    border-radius: var(--saas-radius-md) !important;
    padding: 0 !important;
  }
  .modal-header {
    padding: 15px !important;
  }
  .modal-body {
    padding: 15px !important;
  }
  .modal-footer {
    padding: 15px !important;
    flex-direction: column-reverse !important;
    gap: 0.75rem !important;
  }
  .modal-footer .btn {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Botones de acción */
  .btn-action {
    width: 32px;
    height: 32px;
  }

  .sticky-ticket-container {
    position: static !important;
  }
}

/* ==========================================================================
   PANEL MAESTRO SUPER ADMIN - TEMA OSCURO EXCLUSIVO (.master-theme-dark)
   ========================================================================== */
.master-theme-dark {
  --bs-body-bg: #0f172a;
  --bs-body-color: #f8fafc;
  --bs-tertiary-bg: #1e293b;
  --bs-secondary-bg: #1e293b;
  --bs-border-color: #334155;
  --bs-table-bg: transparent;
  --bs-table-color: #f8fafc;
  --bs-table-hover-bg: #1e293b;
  --bs-table-hover-color: #ffffff;
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

.master-theme-dark .card {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

.master-theme-dark h1,
.master-theme-dark h2,
.master-theme-dark h3,
.master-theme-dark h4,
.master-theme-dark h5,
.master-theme-dark h6,
.master-theme-dark label,
.master-theme-dark .form-label,
.master-theme-dark .form-group label {
  color: #f8fafc !important;
}

.master-theme-dark .text-muted,
.master-theme-dark .kpi-label,
.master-theme-dark .text-subtext {
  color: #94a3b8 !important;
}

.master-theme-dark .form-control,
.master-theme-dark .form-select {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

.master-theme-dark .form-control:focus,
.master-theme-dark .form-select:focus {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

.master-theme-dark .form-control::placeholder {
  color: #64748b !important;
}

.master-theme-dark .form-select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* Evitar fondo blanco por autofill de Chrome/Edge en tema oscuro */
.master-theme-dark input:-webkit-autofill,
.master-theme-dark input:-webkit-autofill:hover, 
.master-theme-dark input:-webkit-autofill:focus, 
.master-theme-dark input:-webkit-autofill:active,
.master-theme-dark textarea:-webkit-autofill,
.master-theme-dark select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc !important;
  transition: background-color 5000s ease-in-out 0s;
}

.master-theme-dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

.master-theme-dark .btn-outline-secondary {
  color: #cbd5e1 !important;
  border-color: #475569 !important;
}
.master-theme-dark .btn-outline-secondary:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
  border-color: #64748b !important;
}

.master-theme-dark .table {
  color: #f8fafc !important;
}

.master-theme-dark .table thead th {
  background-color: #0f172a !important;
  color: #cbd5e1 !important;
  border-bottom: 1px solid #334155 !important;
}

.master-theme-dark .table tbody td {
  border-bottom: 1px solid rgba(51, 65, 85, 0.5) !important;
  color: #f8fafc !important;
}

.master-theme-dark .table tbody tr:hover td {
  background-color: rgba(51, 65, 85, 0.4) !important;
}

.master-theme-dark .modal-content {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

.master-theme-dark .modal-header {
  border-bottom: 1px solid #334155 !important;
}

.master-theme-dark .modal-footer {
  border-top: 1px solid #334155 !important;
  background-color: #0f172a !important;
}

.master-theme-dark .page-link {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

.master-theme-dark .page-item.active .page-link {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

.master-theme-dark .page-item.disabled .page-link {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #64748b !important;
}

/* SweetAlert2 en Tema Oscuro Master Admin */
.master-theme-dark .swal2-container .swal2-popup,
.master-theme-dark .swal2-popup,
body.master-theme-dark .swal2-popup {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
}

.master-theme-dark .swal2-title,
body.master-theme-dark .swal2-title {
  color: #f8fafc !important;
  font-weight: 700 !important;
}

.master-theme-dark .swal2-html-container,
body.master-theme-dark .swal2-html-container {
  color: #cbd5e1 !important;
}

.master-theme-dark .swal2-input,
.master-theme-dark .swal2-textarea,
.master-theme-dark .swal2-select,
body.master-theme-dark .swal2-input {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
  border-radius: 8px !important;
}

.master-theme-dark .swal2-input:focus,
.master-theme-dark .swal2-textarea:focus,
.master-theme-dark .swal2-select:focus,
body.master-theme-dark .swal2-input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
  color: #ffffff !important;
}

.master-theme-dark .swal2-validation-message,
body.master-theme-dark .swal2-validation-message {
  background-color: #1e293b !important;
  color: #f87171 !important;
  border: 1px solid #7f1d1d !important;
}

.master-theme-dark .swal2-close,
body.master-theme-dark .swal2-close {
  color: #94a3b8 !important;
}
.master-theme-dark .swal2-close:hover,
body.master-theme-dark .swal2-close:hover {
  color: #ffffff !important;
}

/* ==========================================================================
   MODALES PREMIUM (Estilo SaaS Moderno)
   ========================================================================== */
.modal-content.rounded-4 {
  border-radius: 1.25rem !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25) !important;
}

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}

.btn-check:checked + .btn-outline-success {
  background-color: #16a34a !important;
  border-color: #16a34a !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25) !important;
}

.btn-check:checked + .btn-outline-success * {
  color: #ffffff !important;
}

.btn-check:checked + .btn-outline-primary {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

.btn-check:checked + .btn-outline-primary * {
  color: #ffffff !important;
}

.btn-outline-success:hover,
.btn-outline-success:hover *,
.btn-outline-success:focus,
.btn-outline-success:focus * {
  color: #ffffff !important;
}

/* ==========================================================================
   ARQUITECTURA DE IMPRESIÓN NATIVA DUAL (POS80 / A4)
   ========================================================================== */
#print-section {
  display: none;
}

@media print {
  body > *:not(#print-section) {
    display: none !important;
  }

  #print-section {
    display: block !important;
    position: relative !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
  }

  /* Plantilla A4 Tabular */
  #print-section.layout-a4,
  #print-section .layout-a4,
  #print-section:has(.layout-a4) {
    width: 100% !important;
    max-width: 210mm !important;
    padding: 8mm !important;
    font-size: 10pt;
  }

  /* Plantilla Ticket Térmico POS80 */
  #print-section.layout-ticket,
  #print-section .layout-ticket,
  #print-section:has(.layout-ticket),
  #print-section:not(.layout-a4):not(:has(.layout-a4)) {
    width: 100% !important;
    max-width: 76mm !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    padding: 0 2mm !important;
    font-size: 9pt;
  }

  #print-section * {
    color: #000000 !important;
    box-sizing: border-box !important;
  }

  @page {
    margin: 0;
    size: auto;
  }
}

/* ==========================================================================
   TOOLTIPS & UTILIDADES DE INTERACCIÓN
   ========================================================================== */
.cursor-pointer {
  cursor: pointer;
}

.tooltip .tooltip-inner {
  background-color: var(--saas-text-heading, #0f172a);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--saas-radius-sm, 6px);
  box-shadow: var(--saas-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
  max-width: 260px;
}

/* ==========================================================================
   SPLASH SCREEN GLOBAL (#baez-splash-screen)
   ========================================================================== */
#baez-splash-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #0f172a;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

#baez-splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-brand-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: splashFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.splash-logo-badge {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  color: #ffffff;
  box-shadow: 0 12px 28px -6px rgba(37, 99, 235, 0.55);
  margin-bottom: 1.25rem;
  position: relative;
}

.splash-logo-badge::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), transparent);
  z-index: -1;
  animation: splashPulse 2s infinite ease-in-out;
}

.splash-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff !important;
  margin: 0;
  line-height: 1.1;
}

.splash-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 0.35rem;
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
}

.splash-loader-bar {
  width: 180px;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.splash-loader-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 45%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 999px;
  animation: splashIndeterminate 1.5s infinite ease-in-out;
}

.splash-status-text {
  margin-top: 0.9rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.02em;
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes splashPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.1;
  }
}

@keyframes splashIndeterminate {
  0% {
    left: -45%;
  }
  50% {
    left: 40%;
    width: 60%;
  }
  100% {
    left: 100%;
    width: 45%;
  }
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES Y TABLETS (< 992px / < 768px)
   ========================================================================== */

/* Reglas aplicadas a Tablets y Móviles (< 991px) */
@media (max-width: 991px) {
  /* Punto de Venta: Altura controlada del carrito en Tablets */
  .table-responsive-pos {
    height: auto !important;
    max-height: 360px !important;
  }

  /* Convivencia Sidebar & Ayuda: Ocultar #btnAyudaGlobal si el sidebar o backdrop están visibles */
  #sidebar.active ~ #btnAyudaGlobal,
  #sidebar.show ~ #btnAyudaGlobal,
  body:has(#sidebar.active) #btnAyudaGlobal,
  body:has(#sidebar.show) #btnAyudaGlobal,
  body:has(.sidebar-backdrop.show) #btnAyudaGlobal,
  body:has(.sidebar-overlay.show) #btnAyudaGlobal,
  body:has(.sidebar-backdrop.active) #btnAyudaGlobal,
  body:has(.sidebar-overlay.active) #btnAyudaGlobal {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8) !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
  }
}

/* Reglas aplicadas a Dispositivos Móviles (< 768px) */
@media (max-width: 768px) {
  /* 1. Modales Operativos con Teclado Virtual */
  .modal-dialog {
    margin: 10px auto !important;
    max-height: calc(100dvh - 20px) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .modal-dialog-centered {
    min-height: calc(100dvh - 20px) !important;
    align-items: flex-start !important; /* Evita que el header se desborde fuera del viewport */
  }
  .modal-content {
    max-height: calc(100dvh - 20px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .modal-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 1 auto !important;
  }

  /* 2. Punto de Venta: Resguardo para la barra fija */
  #content {
    padding-bottom: 85px !important;
  }

  /* Touch Targets en Carrito POS (mínimo 44x44px) */
  .table-pos-mobile .btn-group-sm > .btn {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
  }

  .table-pos-mobile button[onclick*="eliminarItem"],
  .table-pos-mobile .btn-link.text-danger {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Botones de caja del Navbar con interacción táctil cómoda */
  #btnAbrirCajaUI, #btnCerrarCajaUI, #btnSyncPendingSales {
    min-height: 38px !important;
    padding: 6px 12px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* 3. Botón Flotante de Ayuda elevado para no solapar la barra fija */
  #btnAyudaGlobal {
    bottom: 85px !important;
  }

  /* 4. Columna de Fecha/Hora en Historial visible y compacta */
  .col-fecha-hora,
  #listaVentas td:nth-child(2) {
    display: table-cell !important;
    font-size: 0.75rem !important;
    line-height: 1.25 !important;
    max-width: 95px !important;
    white-space: normal !important;
  }

  /* 5. Escáner Móvil Inline Split-Screen: Viewport y Scroll Independiente */
  .scanner-inline-container {
    max-height: 35vh !important;
    max-height: 35dvh !important;
  }

  .scanner-inline-viewport {
    height: calc(35vh - 44px) !important;
    height: calc(35dvh - 44px) !important;
    min-height: 140px !important;
  }

  #scanner-inline-reader {
    height: 100% !important;
    min-height: 140px !important;
  }

  #scanner-inline-reader video {
    height: 100% !important;
    max-height: calc(35vh - 44px) !important;
    max-height: calc(35dvh - 44px) !important;
    object-fit: cover !important;
  }

  .scanner-inline-container .scanner-reticle-box {
    width: 85% !important;
    max-width: 270px !important;
    height: 85px !important;
  }

  /* Scroll independiente y continuo del carrito mientras el escáner inline está abierto */
  body.scanner-inline-active .table-responsive-pos {
    max-height: calc(65vh - 140px) !important;
    max-height: calc(65dvh - 140px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Scroll independiente general en móviles para carrito de compras */
  .table-responsive-pos {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* ==========================================================================
   COMPONENTE: ESCÁNER INLINE SPLIT-SCREEN (MÓVIL / RETAIL)
   ========================================================================== */
.scanner-inline-container {
  position: sticky;
  top: 0;
  z-index: 1025;
  background: #0f172a;
  border-radius: var(--saas-radius-md, 12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.scanner-inline-header {
  min-height: 44px;
  background: #0f172a !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  user-select: none;
}

.scanner-inline-viewport {
  position: relative;
  width: 100%;
  height: 220px;
  background-color: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scanner-inline-reader {
  width: 100% !important;
  height: 100% !important;
  min-height: 180px;
  border: none !important;
  background: #000;
}

#scanner-inline-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block;
}

#scanner-inline-reader #scanner-inline-reader__scan_region {
  background: transparent !important;
}

#scanner-inline-reader #scanner-inline-reader__dashboard {
  display: none !important;
}

/* Botones de control de cámara inline */
.scanner-control-btn {
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  transition: all 0.15s ease !important;
}

.scanner-control-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.scanner-control-btn.active {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: #000000 !important;
}

/* Botón de pulgar: Escanear Siguiente (Ergonomía Táctil 56px, Alto Contraste) */
.scanner-quick-trigger-wrapper {
  position: sticky;
  top: 0;
  z-index: 1020;
}

.btn-scan-next {
  min-height: 56px !important;
  height: 56px !important;
  padding: 10px 20px !important;
  border-radius: var(--saas-radius-md, 12px) !important;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  border: 2px solid #34d399 !important;
  color: #ffffff !important;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.6px !important;
  text-transform: uppercase !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35) !important;
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease !important;
}

.btn-scan-next:active {
  transform: scale(0.98) !important;
  filter: brightness(0.92) !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}

.btn-scan-next i {
  font-size: 1.5rem !important;
}

/* ==========================================================================
   MEJORAS POS & PRODUCTOS: CANTIDAD EDITABLE Y RESGUARDO DE BOTÓN DE AYUDA
   ========================================================================== */

/* Input numérico editable de cantidad en carrito POS */
.input-cant-pos {
  width: 58px !important;
  min-width: 48px !important;
  text-align: center !important;
  font-weight: 700 !important;
  background: transparent !important;
  border: none !important;
  padding: 0 4px !important;
  box-shadow: none !important;
  outline: none !important;
  font-size: 0.95rem !important;
  -moz-appearance: textfield;
}

.input-cant-pos::-webkit-outer-spin-button,
.input-cant-pos::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-cant-pos:focus {
  background-color: #f1f5f9 !important;
  border-radius: 4px;
}

/* Paginación Productos: Resguardo para no solapar botón flotante de ayuda (#btnAyudaGlobal / #btn-ayuda) */
.paginacion-productos-footer {
  padding-bottom: 3.5rem !important;
  margin-bottom: 1.5rem !important;
}

.paginacion-productos-nav {
  margin-right: 5.5rem !important;
}

@media (max-width: 768px) {
  .paginacion-productos-footer {
    padding-bottom: 6rem !important;
    margin-bottom: 2rem !important;
  }
  .paginacion-productos-nav {
    margin-right: 0 !important;
  }
}

