/* ==========================================================================
   GUARDALIBRE - DASHBOARD CORPORATE PRO MAX (TEMA CLARO)
   Inspirado en ui-ux-pro-max-skill: Limpio, Corporativo, Alto Contraste
   ========================================================================== */

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

:root {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #2563eb;
  
  --color-primary: #facc15;
  --color-primary-deep: #ca8a04;
  --color-primary-solid: #eab308;
  --color-primary-tint: #fefce8;

  --color-blue: #2563eb;
  --color-blue-hover: #1d4ed8;
  --color-blue-tint: #eff6ff;

  --color-navy: #0f172a;
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-light: #94a3b8;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 20px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-layout {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 100vw;
  flex: 1;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ==========================================================================
   SIDEBAR CORPORATIVO
/* ==============================================================================
   SIDEBAR CORPORATIVO ULTRA-CLEAN (ESTILO LINEAR / RAYCAST / VERCEL)
   ============================================================================== */
.app-sidebar {
  width: 260px;
  background-color: #ffffff;
  border-right: 1px solid #eef2f6;
  display: flex;
  flex-direction: column;
  padding: 16px 14px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: none;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* 1. Header Unificado (Brand & Workspace) */
.sidebar-header-unified {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.sidebar-brand-unified {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.sidebar-brand-unified img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
}

.sidebar-brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

/* Chip Super Admin Discreto */
.superadmin-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.superadmin-chip:hover {
  background: #fef9c3;
  border-color: #fde047;
}

/* Workspace / Store Selector estilo Linear */
.sidebar-workspace-selector {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 7px;
  padding: 5px 8px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.sidebar-workspace-selector:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.workspace-icon-box {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workspace-select-field {
  flex: 1;
  min-width: 0;
}

.workspace-select-field select {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-chevron {
  flex-shrink: 0;
  pointer-events: none;
}

/* 2. Píldoras de Módulos (Segmented PillTabs suaves) */
.sidebar-modules-pills-bar {
  display: flex;
  gap: 3px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  margin: 6px 0 10px 0;
  border: none;
}

.sidebar-module-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
}

.sidebar-module-tab-btn:hover {
  color: #0f172a;
}

.sidebar-module-tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.badge-commerce-notify {
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  line-height: 1.1;
}

/* 3. Contenedor de Paneles Modulares */
.sidebar-modules-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-module-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sidebar-module-panel.active {
  display: flex;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px;
  margin-bottom: 6px;
}

.sidebar-module-panel .sidebar-nav-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0;
  padding: 0 2px 4px 0;
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-list::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-list::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-list::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.sidebar-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #475569;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}

.sidebar-nav-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.sidebar-nav-btn.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar-nav-btn svg {
  color: #64748b;
  flex-shrink: 0;
  transition: color 0.12s ease;
}

.sidebar-nav-btn.active svg {
  color: #2563eb;
}

.sidebar-nav-btn .count-badge {
  font-size: 0.70rem;
  color: #94a3b8;
  background: transparent;
  padding: 0;
  font-weight: 500;
}

.sidebar-nav-btn.active .count-badge {
  color: #2563eb;
  font-weight: 800;
}

/* 4. Perfil Compacto y Pie del Sidebar */
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.user-profile-badge-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  border-radius: 7px;
  transition: background 0.15s ease;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.user-profile-badge-compact:hover {
  background: #f8fafc;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: #ffffff;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.65rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rbac-role-badge {
  font-size: 0.58rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 800;
  margin-top: 2px;
  align-self: flex-start;
}

.btn-logout-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-logout-icon:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Fila de Acciones Secundarias (Sincronizar y Herramientas juntas) */
.sidebar-bottom-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-tools-container {
  position: relative;
  width: 100%;
  min-width: 0;
}

.sidebar-action-footer-btn,
.sidebar-sync-btn-compact,
.sidebar-tools-trigger-compact {
  width: 100% !important;
  box-sizing: border-box !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 4px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1 !important;
}

.sidebar-action-footer-btn:hover,
.sidebar-sync-btn-compact:hover,
.sidebar-tools-trigger-compact:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

.sidebar-action-footer-btn svg,
.sidebar-sync-btn-compact svg,
.sidebar-tools-trigger-compact svg {
  flex-shrink: 0 !important;
  width: 13px !important;
  height: 13px !important;
}

.sidebar-action-footer-btn span,
.sidebar-sync-btn-compact span,
.sidebar-tools-trigger-compact span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Ocultar pills duplicadas de comercio en encabezado para máxima descongestión */
.header-commerce-quick-pills {
  display: none !important;
}

/* SELECTOR / POPOVER PROMAX DE HERRAMIENTAS */
.sidebar-tools-container {
  position: relative;
  width: 100%;
}

.sidebar-tools-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-tools-trigger:hover,
.sidebar-tools-trigger.active {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.tools-trigger-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tools-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-dim);
}

.sidebar-tools-trigger.active .tools-chevron {
  transform: rotate(180deg);
  color: var(--color-blue);
}

.sidebar-tools-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 270px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.16), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  padding: 8px;
  z-index: 100;
  animation: popoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-tools-popover.open {
  display: block;
}

.tools-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.tools-version-badge {
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
}

.tools-popover-menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tools-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: background 0.15s ease, color 0.15s ease;
}

.tools-popover-item:hover {
  background: #f8fafc;
  color: var(--color-blue);
}

.tool-item-icon-box {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tools-popover-item:hover .tool-item-icon-box {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--color-blue);
}

.tool-item-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tool-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.tools-popover-item:hover .tool-item-title {
  color: var(--color-blue);
}

.tool-item-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* BOTÓN DE CIERRE DE SESIÓN SUTIL */
.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.sidebar-logout-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* ==========================================================================
   ÁREA DE CONTENIDO PRINCIPAL
   ========================================================================== */
.app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.header-title-wrap h1 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-title-wrap p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Botones Pro */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ffe600 0%, #eab308 100%);
  color: #0f172a;
  font-weight: 700;
  border: 1px solid #eab308;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fff04d 0%, #facc15 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(234, 179, 8, 0.35);
}

.btn-blue {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-blue:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-focus);
  color: var(--color-blue);
}

.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid #fecaca;
  font-weight: 600;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* ==========================================================================
   KPI RESUMEN CORPORATIVO
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #e2e8f0;
}

.kpi-card:nth-child(1)::before { background: var(--color-blue); }
.kpi-card:nth-child(2)::before { background: var(--color-success); }
.kpi-card:nth-child(3)::before { background: #ca8a04; }
.kpi-card:nth-child(4)::before { background: var(--color-warning); }

.kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
}

.kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   PILLTABS DE CATEGORÍAS PROMAX (SEGMENTED NAVIGATION)
   ========================================================================== */
.category-pilltabs-wrapper {
  margin-top: 4px;
  margin-bottom: 2px;
  position: relative;
  width: 100%;
}

.category-pilltabs-list {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 6px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.category-pilltabs-list::-webkit-scrollbar {
  height: 4px;
}

.category-pilltabs-list::-webkit-scrollbar-track {
  background: transparent;
}

.category-pilltabs-list::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.category-pilltab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: #64748b;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.category-pilltab:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.category-pilltab.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

.category-pilltab svg {
  flex-shrink: 0;
}

.category-pilltab .pilltab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-dim);
  min-width: 18px;
  transition: all 0.18s ease;
}

.category-pilltab.active .pilltab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.category-pilltab-manage {
  border-style: dashed;
  border-color: #93c5fd;
  color: var(--color-blue);
  background: #eff6ff;
}

.category-pilltab-manage:hover {
  background: #dbeafe;
  border-color: var(--color-blue);
  color: #1d4ed8;
}

/* ==========================================================================
   CONTROLES (BÚSQUEDA Y FILTROS)
   ========================================================================== */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 6px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.search-wrap {
  flex: 1;
  min-width: 170px;
  max-width: 320px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 32px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 10px 5px 30px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.8rem;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.filter-select {
  height: 32px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-select:focus {
  border-color: var(--border-focus);
  background: #ffffff;
}

.btn-ctrl-action {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-ctrl-action:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-ctrl-action.btn-ctrl-publish {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
  font-weight: 700;
}

.btn-ctrl-action.btn-ctrl-publish:hover {
  background: #dcfce7;
  border-color: #86efac;
}

/* CONMUTADOR DE VISTAS PROMAX */
.view-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  height: 32px;
  box-sizing: border-box;
}

.btn-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius-sm) - 2px);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-view-toggle:hover {
  color: var(--text-main);
}

.btn-view-toggle.active {
  background: #ffffff;
  color: var(--color-blue);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   PRODUCTOS GRID
   ========================================================================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  position: relative;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-hover);
}

.product-thumbnail-area {
  position: relative;
  width: 100%;
  height: 145px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.product-thumbnail-area img {
  max-width: 86%;
  max-height: 86%;
  object-fit: contain;
  transition: transform 0.22s ease;
}

.product-card:hover .product-thumbnail-area img {
  transform: scale(1.06);
}

.thumb-top-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

.badge-full-tag {
  background: #16a34a;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.badge-discount-tag {
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.thumb-top-right {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.badge-folder-tag {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  color: var(--text-main);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-gallery-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
}

.badge-pending-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
}

.product-content {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 7px;
}

.product-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3em;
  margin: 0;
}

.product-title a {
  color: inherit;
  text-decoration: none;
}

.product-title a:hover {
  color: var(--color-blue);
}

/* BLOQUE FINANCIERO UNIFICADO */
.card-finance-block {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  gap: 6px;
}

.finance-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.finance-divider {
  width: 1px;
  height: 26px;
  background: var(--border-subtle);
}

.finance-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.finance-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.finance-cost {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.finance-orig {
  font-size: 0.72rem;
  color: var(--text-light);
  text-decoration: line-through;
}

.finance-sale {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: #2563eb;
}

.finance-profit {
  font-size: 0.66rem;
  font-weight: 800;
  color: #166534;
  background: #dcfce7;
  padding: 1px 4px;
  border-radius: 3px;
}

/* FILA DE METADATOS COMPACTA */
.card-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.meta-separator {
  color: var(--text-light);
}

.meta-seller {
  font-weight: 600;
  color: var(--text-dim);
  max-width: 95px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-time {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
  font-size: 0.66rem;
  margin-left: auto;
}

.badge-lowest-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
}

/* TIRA DE CATÁLOGO */
.card-catalog-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  gap: 6px;
}

.card-catalog-strip.published {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.card-catalog-strip.private {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.catalog-strip-info {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.catalog-status-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-catalog-strip.published .catalog-status-title {
  color: #166534;
}

.btn-catalog-quick-toggle {
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-catalog-quick-toggle.is-publish {
  background: #2563eb;
  color: #ffffff;
}

.btn-catalog-quick-toggle.is-publish:hover {
  background: #1d4ed8;
}

.btn-catalog-quick-toggle.is-hide {
  background: #ffffff;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.btn-catalog-quick-toggle.is-hide:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* ACCIONES DE TARJETA */
.product-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px solid var(--border-subtle);
}

.btn-card-main-action {
  flex: 1;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-card-main-action:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.btn-card-icon-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.btn-card-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-card-icon:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
  color: var(--color-blue);
}

.btn-card-icon.btn-card-icon-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.stock-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.stock-status.in-stock { color: var(--color-success); }
.stock-status.low-stock { color: var(--color-warning); }
.stock-status.out-of-stock { color: var(--color-danger); }

.stock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   VISTA DE LISTA COMPACTA PROMAX (TABLE / LIST VIEW)
   ========================================================================== */
.products-list-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  overflow-x: auto;
  width: 100%;
}

.products-list-header {
  display: grid;
  grid-template-columns: 44px minmax(200px, 1.2fr) 95px 140px 115px 140px 160px;
  align-items: center;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.67rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  gap: 10px;
  min-width: 890px;
}

.products-list-body {
  display: flex;
  flex-direction: column;
}

.product-list-row {
  display: grid;
  grid-template-columns: 44px minmax(200px, 1.2fr) 95px 140px 115px 140px 160px;
  align-items: center;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
  gap: 10px;
  min-height: 50px;
  min-width: 890px;
}

.product-list-row:last-child {
  border-bottom: none;
}

.product-list-row:hover {
  background: #f8fafc;
}

.list-col-thumb {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.list-col-thumb img {
  max-width: 86%;
  max-height: 86%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.product-list-row:hover .list-col-thumb img {
  transform: scale(1.08);
}

.badge-full-mini {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #16a34a;
  color: #ffffff;
  padding: 1px 3px;
  border-top-left-radius: 3px;
  line-height: 1;
  display: flex;
}

.list-col-info {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.list-product-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.list-product-title a {
  color: inherit;
  text-decoration: none;
}

.list-product-title a:hover {
  color: var(--color-blue);
  text-decoration: underline;
}

.list-product-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.69rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub-dot {
  color: var(--text-light);
}

.list-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0 4px;
  border-radius: 4px;
}

.badge-pending-mini {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 0.63rem;
  font-weight: 700;
}

.list-col-folder {
  display: flex;
  align-items: center;
}

.list-folder-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.list-col-catalog {
  display: flex;
  align-items: center;
}

.list-catalog-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.71rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  max-width: 100%;
}

.list-catalog-toggle-btn.published {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.list-catalog-toggle-btn.published:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.list-catalog-toggle-btn.published:hover .catalog-btn-action {
  color: #b91c1c;
}

.list-catalog-toggle-btn.private {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.list-catalog-toggle-btn.private:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.catalog-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.catalog-dot.green { background: #16a34a; }
.catalog-dot.gray { background: #94a3b8; }

.catalog-btn-action {
  font-size: 0.64rem;
  font-weight: 600;
  opacity: 0.85;
  margin-left: 2px;
}

.list-col-stock {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.list-col-stock .stock-status {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.73rem;
  font-weight: 700;
}

.list-col-price {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.list-price-main {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.list-price-main .price-current {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
}

.badge-discount-mini {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.63rem;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
}

.list-price-sub {
  display: flex;
  align-items: center;
  gap: 4px;
}

.list-profit-text {
  font-size: 0.67rem;
  font-weight: 700;
  color: #166534;
}

.badge-lowest-mini {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.63rem;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
}

.list-col-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: flex-end;
}

.btn-icon-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-icon-sm:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
  color: var(--color-blue);
}

.btn-icon-sm.btn-icon-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-xl);
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.4rem;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 24px;
  font-size: 0.92rem;
}

/* ==========================================================================
   MODALES (ENTERPRISE WHITE)
   ========================================================================== */
.modal-overlay,
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal-overlay.active,
.modal.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Auth Gate Obligatorio (Bloqueo de seguridad total sin modo demo) */
#modalAuth {
  position: fixed;
  inset: 0;
  background: #090d16 !important;
  background: radial-gradient(circle at 50% 25%, #1e293b 0%, #090d16 100%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 999999 !important;
}

#modalAuth .modal-dialog {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.05);
  max-width: 440px;
  width: 100%;
}

.modal-dialog {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  position: relative;
  animation: modalEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

@keyframes modalEnter {
  from { transform: scale(0.96) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 1.22rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin: 0;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  margin: 3px 0 0 0;
  line-height: 1.35;
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
  transform: rotate(90deg);
}

.modal-body {
  padding: 22px 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

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

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}

/* Tarjetas de Sección ProMax */
.promax-card-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.promax-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.promax-section-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #eff6ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.promax-section-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
  line-height: 1.3;
}

.form-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 14px;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-hint {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
  margin-top: 3px;
}

/* ProMax Form Layout Utilities */
.promax-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
}

.promax-image-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 16px;
  width: 100%;
}

.brand-logo-upload-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-preview-img {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.btn-promax-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
  user-select: none;
}

.btn-promax-upload:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.brand-banner-preview-box {
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  background-size: cover;
  background-position: center;
}

.btn-promax-upload-glass {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.btn-promax-upload-glass:hover {
  background: #ffffff;
}

.brand-banner-text {
  font-size: 0.74rem;
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.color-picker-input {
  width: 46px;
  height: 40px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.color-picker-input:hover {
  border-color: #94a3b8;
}

.color-hex-input {
  font-family: monospace;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.theme-preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.theme-preset-title {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 700;
}

.theme-preset-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-theme-preset {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  color: #1e293b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn-theme-preset:hover {
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.preset-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.15);
}

.badge-pro-branding {
  font-size: 0.68rem;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.dns-config-card {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 0.74rem;
  color: #334155;
  line-height: 1.5;
}

.dns-records-row {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-family: monospace;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.modal-footer-hint {
  font-size: 0.74rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-save-branding {
  background: #eab308;
  color: #0f172a;
  border: 1px solid #ca8a04;
  padding: 9px 20px;
  font-weight: 800;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-save-branding:hover {
  background: #facc15;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(234, 179, 8, 0.35);
}

/* Gráfica Modal */
.chart-container-large {
  width: 100%;
  height: 260px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
}

.chart-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-box-small {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.stat-box-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-box-val {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Auth Modal Tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   PWA & RESPONSIVE ADAPTATIONS (MOBILE iOS/ANDROID, TABLET, DESKTOP)
   ========================================================================== */

/* Barra Superior Móvil y Drawer (Ocultos en Desktop) */
.mobile-top-bar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

/* ==========================================================================
   TABLET & MOBILE (Hasta 1024px - iPad, Tablets y Pantallas Redimensionadas)
   ========================================================================== */
@media (max-width: 1024px) {
  /* 1. Barra Superior Sticky con Safe Area */
  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 800;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
  }

  .mobile-menu-btn,
  .mobile-add-btn {
    background: none;
    border: none;
    color: #0f172a;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-menu-btn:active {
    background: #f1f5f9;
  }

  .mobile-add-btn {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  }

  .mobile-add-btn:active {
    background: #1d4ed8;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
  }

  /* 2. Sidebar se transforma en Drawer Deslizable en Tablet y Móvil */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  /* 3. Contenedor Principal Ocupa el 100% del Ancho */
  .app-main {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 18px;
    box-sizing: border-box;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
  }

  .header-title-wrap {
    width: 100%;
    min-width: 0;
  }

  .header-title-wrap h1 {
    font-size: 1.7rem;
    word-break: break-word;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .header-actions button {
    width: 100%;
    justify-content: center;
  }

  /* 4. Grid de KPIs (2 Columnas en Tablet) */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
  }

  .kpi-card {
    padding: 14px 16px;
    min-width: 0;
  }

  .kpi-card .kpi-value {
    font-size: 1.45rem;
  }

  /* 5. Barra de Controles (Búsqueda y Filtros) */
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    padding: 14px;
    box-sizing: border-box;
  }

  .search-wrap {
    width: 100%;
    min-width: 0;
  }

  .filter-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .filter-select {
    width: 100%;
    min-width: 0;
  }

  /* 6. Cuadrícula de Productos en Tablet (2 Columnas) */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
  }
}

/* ==========================================================================
   SMARTPHONES MOBILE (Hasta 768px - iOS & Android)
   ========================================================================== */
@media (max-width: 768px) {
  .app-main {
    padding: 14px 12px;
    padding-bottom: calc(85px + env(safe-area-inset-bottom));
  }

  /* Cuadrícula de Productos en Smartphone (1 Columna Táctil) */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
  }

  .product-card {
    border-radius: 12px;
  }

  .product-card .card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .btn-card-action {
    height: 42px;
    font-size: 0.82rem;
    justify-content: center;
  }

  /* Vista de Lista en Pantallas Móviles */
  .products-list-header {
    display: none;
  }

  .product-list-row {
    grid-template-columns: 44px 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .list-product-sub {
    flex-wrap: wrap;
    row-gap: 4px;
    column-gap: 5px;
  }

  .list-stock-mobile {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
  }

  .list-col-folder,
  .list-col-stock {
    display: none;
  }

  .list-col-catalog {
    display: none;
  }

  .list-col-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 6px;
    border-top: 1px dashed var(--border-subtle);
  }

  /* Barra de Navegación Inferior Nativa (Bottom Nav) */
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid #e2e8f0;
    z-index: 850;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
  }

  .bottom-nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    flex: 1;
    min-height: 48px;
    touch-action: manipulation;
    transition: color 0.15s;
  }

  .bottom-nav-item.active {
    color: #2563eb;
    font-weight: 700;
  }

  .bottom-nav-item svg {
    stroke-width: 2.2;
  }

  .bottom-nav-item.bottom-nav-add {
    position: relative;
    top: -12px;
  }

  .bottom-add-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
    margin-bottom: 2px;
  }

  /* Modales Estilo ProMax en Móvil y Tablet */
  .modal-overlay {
    padding: 10px;
  }

  .modal-dialog {
    max-height: calc(100vh - 20px);
    border-radius: 16px;
    width: 100% !important;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
    gap: 12px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 10px;
    align-items: stretch;
  }

  .modal-footer-hint {
    justify-content: center;
    text-align: center;
  }

  .modal-footer > div {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .modal-footer > div > button,
  .modal-footer > div > a {
    flex: 1;
    justify-content: center;
  }

  .promax-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .promax-form-grid-2 {
    grid-template-columns: 1fr;
  }

  .promax-image-upload-grid {
    grid-template-columns: 1fr;
  }

  .order-manage-grid {
    grid-template-columns: 1fr;
  }

  .order-ticket-container {
    padding: 16px;
    width: 100%;
  }

  .ticket-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PANTALLAS EXTRA PEQUEÑAS (Hasta 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 10px 12px;
  }

  .kpi-card .kpi-label {
    font-size: 0.68rem;
  }

  .kpi-card .kpi-value {
    font-size: 1.25rem;
  }

  .controls-bar .filter-group {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .promax-kpi-grid {
    grid-template-columns: 1fr;
  }

  .brand-logo-upload-box {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   ANIMACIÓN DE ROTACIÓN Y ESTILOS DE HIDRATACIÓN / SINCRONIZACIÓN
   ========================================================================== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-icon {
  animation: spin 0.85s linear infinite;
  display: inline-block;
}

.pending-sync-banner {
  margin-top: 10px;
  padding: 8px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pending-sync-banner span {
  font-size: 0.74rem;
  color: #1d4ed8;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-pending {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   MÓDULO DE GESTIÓN DE CATEGORÍAS & EMOJI PICKER
   ========================================================================== */
.btn-emoji {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-emoji:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.btn-emoji.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.category-manager-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.category-manager-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.category-manager-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.category-manager-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #2563eb;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.category-manager-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-manager-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.category-manager-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-cat-action {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-cat-action:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.btn-cat-action.btn-cat-delete:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* ==============================================================================
   GUARDALIBRE MULTITENANT, SUPER ADMIN & DROPSHIPPING (PROMAX STYLES)
   ============================================================================== */

/* Badges Comerciales en Tarjeta de Producto */
.badge-store-published {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  font-size: 0.72rem;
  font-weight: 800;
  color: #166534;
  background: rgba(240, 253, 244, 0.95);
  border: 1px solid #bbf7d0;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.badge-store-draft {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.product-commercial-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
  font-size: 0.8rem;
}

.commercial-price-label {
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 600;
}

.commercial-price-val {
  font-weight: 800;
  color: #2563eb;
}

.commercial-profit-val {
  font-weight: 800;
  color: #16a34a;
  font-size: 0.75rem;
}

/* Super Admin Badge en Sidebar */
.superadmin-nav-item {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff !important;
  border-radius: 8px;
  margin: 6px 14px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  transition: all 0.2s ease;
}

.superadmin-nav-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
  border-color: rgba(250, 204, 21, 0.4);
}

.superadmin-crown {
  color: #facc15;
  display: flex;
  align-items: center;
}

.tenant-selector-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  margin: 4px 14px 10px;
}

.tenant-selector-pill select {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  cursor: pointer;
  width: 100%;
}

/* KPI Cards Dropshipping ProMax */
.promax-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.promax-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.promax-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.promax-kpi-card.kpi-orders { border-top: 3px solid #2563eb; }
.promax-kpi-card.kpi-sales { border-top: 3px solid #0284c7; }
.promax-kpi-card.kpi-cost { border-top: 3px solid #64748b; }
.promax-kpi-card.kpi-profit { border-top: 3px solid #16a34a; }

.promax-kpi-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.promax-kpi-value {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.promax-kpi-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 4px;
}

/* Tabla de Pedidos Dropshipping ProMax (Desktop: Cero Scroll Horizontal) */
.orders-table-wrapper {
  overflow-x: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  width: 100%;
  box-sizing: border-box;
}

.orders-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  text-align: left;
}

.orders-table th {
  background: #f8fafc;
  padding: 11px 12px;
  font-size: 0.70rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  box-sizing: border-box;
}

.orders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  box-sizing: border-box;
  overflow: hidden;
}

.orders-table tr:last-child td {
  border-bottom: none;
}

.orders-table tr:hover td {
  background: #f8fafc;
}

.order-folio-badge {
  color: #2563eb;
  font-weight: 800;
  font-family: monospace;
  font-size: 0.86rem;
  letter-spacing: 0.2px;
}

.order-date-text {
  font-size: 0.67rem;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
}

.order-customer-name {
  font-weight: 800;
  color: #0f172a;
  font-size: 0.84rem;
  line-height: 1.25;
  word-break: break-word;
}

.order-note-bubble {
  font-size: 0.68rem;
  color: #64748b;
  font-style: italic;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 2px 6px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.order-items-list-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 84px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.order-item-title-pill {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 0.74rem;
  color: #1e293b;
  line-height: 1.25;
}

.item-qty-badge {
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.67rem;
  flex-shrink: 0;
}

.item-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.order-finance-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  line-height: 1.25;
}

.lbl-fin {
  font-size: 0.66rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 3px;
}

.order-finance-sale strong {
  color: #0f172a;
  font-size: 0.88rem;
}

.order-finance-profit .profit-val {
  color: #16a34a;
  font-size: 0.84rem;
  font-weight: 900;
}

.order-finance-cost {
  color: #64748b;
  font-size: 0.69rem;
}

.order-status-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.order-status-block .status-row {
  display: flex;
  align-items: center;
}

.order-carrier-subtext {
  font-size: 0.67rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 1px;
}

.order-actions-cluster {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.btn-whatsapp-chat-pill {
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 4px 9px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-whatsapp-chat-pill:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.btn-ml-buy-promax {
  background: #ffe600;
  color: #2d3277;
  border: 1px solid #ecd500;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-ml-buy-promax:hover {
  background: #f5dc00;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.btn-order-ready-promax {
  background: #ffffff;
  color: #166534;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-order-ready-promax:hover {
  background: #f0fdf4;
  border-color: #86efac;
}

.order-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.order-badge-pending {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.order-badge-completed {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.order-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ==============================================================================
   GESTOR INTEGRAL DE PEDIDOS, ENVÍOS, COBRANZA Y TICKETS (PROMAX WORKSPACE)
   ============================================================================== */

/* Pestañas Integradas del Gestor de Pedidos - Refinadas & Compactas */
.order-mgr-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 20px;
  background: #f8fafc;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}

.order-mgr-tabs::-webkit-scrollbar {
  display: none;
}

.order-mgr-tab-btn {
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 0.80rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.order-mgr-tab-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.order-mgr-tab-btn.active {
  color: #1d4ed8;
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.order-mgr-tab-btn-pos {
  margin-left: auto;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 800;
}

.order-mgr-tab-btn-pos:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.order-mgr-tab-btn-pos.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.order-mgr-tab-btn-pos.active svg {
  stroke: #ffffff;
}

.order-tab-badge {
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
}

.order-tab-badge-sub {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.68rem;
  font-family: monospace;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

/* Barra de Búsqueda y Filtros de Pedidos */
.order-filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.order-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 7px 12px;
  flex: 1;
  min-width: 240px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: border-color 0.15s ease;
}

.order-search-box:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.order-search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.84rem;
  width: 100%;
  color: #0f172a;
}

.order-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-order-filter-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-order-filter-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-order-filter-pill.active {
  background: #eff6ff;
  color: #2563eb;
  border-color: #93c5fd;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15);
}

/* Pestañas de Contenido del Gestor de Pedidos */
.order-tab-panel {
  display: none;
  animation: fadeInOrderTab 0.18s ease-in-out;
}

.order-tab-panel.active {
  display: block;
}

@keyframes fadeInOrderTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Banner de Pedido Seleccionado */
.order-active-banner {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.order-active-banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
}

/* Badges de Estado de Envío */
.order-badge-shipping-prep {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.order-badge-shipping-transit {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.order-badge-shipping-delivered {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Badges de Estado de Pago */
.order-badge-pay-paid {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.order-badge-pay-pending {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.order-badge-pay-deposit {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Controles de Formulario del Gestor de Pedidos */
.order-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-form-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.order-form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.84rem;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.order-form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Botones de Acción de Tabla */
.btn-order-action-manage {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-order-action-manage:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  transform: translateY(-1px);
}

.btn-order-action-ticket {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-order-action-ticket:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Panel 2: Grid de Gestión de Pedido (Envío & Pagos) */
.order-manage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.order-card-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-card-panel-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.order-address-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #1e293b;
}

.btn-copy-address-promax {
  background: #ffffff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
  margin-top: 8px;
}

.btn-copy-address-promax:hover {
  background: #eff6ff;
  border-color: #60a5fa;
}

/* Panel 3: Ticket / Comprobante PDF ProMax */
.order-ticket-container {
  max-width: 540px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 26px 24px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  color: #0f172a;
}

.ticket-header {
  text-align: center;
  border-bottom: 2px dashed #cbd5e1;
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.ticket-store-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin: 6px 0 2px 0;
}

.ticket-subtitle {
  font-size: 0.76rem;
  color: #64748b;
  margin: 0;
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.78rem;
  margin-bottom: 16px;
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.ticket-items-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.ticket-items-table th {
  border-bottom: 1px solid #cbd5e1;
  padding: 7px 4px;
  text-align: left;
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ticket-items-table td {
  padding: 8px 4px;
  border-bottom: 1px dashed #e2e8f0;
  vertical-align: middle;
}

.ticket-totals-box {
  border-top: 2px dashed #cbd5e1;
  padding-top: 12px;
  margin-bottom: 16px;
  font-size: 0.84rem;
}

.ticket-shipping-badge-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.76rem;
  color: #1e40af;
  margin-bottom: 16px;
  line-height: 1.45;
}

.ticket-actions-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.btn-ticket-whatsapp {
  background: #25d366;
  color: #ffffff;
  border: 1px solid #20ba5a;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.28);
  transition: all 0.15s ease;
}

.btn-ticket-whatsapp:hover {
  background: #1eb956;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.38);
}

.btn-ticket-print {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.btn-ticket-print:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-ticket-track {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
  transition: all 0.15s ease;
}

.btn-ticket-track:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

/* Selector Flexible de Modalidad de Entrega (Mostrador, Pickup, Envío) */
.delivery-mode-toggle {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.btn-delivery-mode {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-delivery-mode:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.btn-delivery-mode.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

/* Tarjeta Informativa de Sucursal Pickup */
.pickup-details-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.pickup-details-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Sección de Código QR y Rastreo en Ticket */
.ticket-qr-section {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.ticket-qr-box {
  flex-shrink: 0;
  background: #ffffff;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ticket-qr-meta {
  flex: 1;
  min-width: 0;
}

.ticket-qr-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 3px;
}

.ticket-qr-caption {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 5px;
  line-height: 1.35;
}

.ticket-qr-url {
  font-family: monospace;
  font-size: 0.68rem;
  color: #2563eb;
  word-break: break-all;
  background: #eff6ff;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
}

/* Tarjeta Edición de Pickup en Modal */
.pickup-edit-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
}

.pickup-item-row {
  transition: all 0.15s ease;
}

.pickup-item-row:hover {
  border-color: #94a3b8 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Reglas de Impresión (@media print) para Ticket PDF */
@media print {
  body * {
    visibility: hidden !important;
  }
  #orderTicketPrintableArea,
  #orderTicketPrintableArea * {
    visibility: visible !important;
  }
  #orderTicketPrintableArea {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
  .ticket-actions-bar,
  .modal-close-btn,
  .modal-footer,
  .order-mgr-tabs {
    display: none !important;
  }
}

/* Modal Super Admin Tabs */
.sa-nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 20px;
  background: #f8fafc;
}

.sa-tab-btn {
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 0.84rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.sa-tab-btn:hover {
  color: #0f172a;
}

.sa-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #ffffff;
}

.sa-card-panel {
  padding: 20px;
}

.rbac-role-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rbac-super-admin {
  background: #fef08a;
  color: #854d0e;
  border: 1px solid #fde047;
}

.rbac-tenant-admin {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.rbac-operator {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.btn-ml-buy-direct {
  background: #ffe600;
  color: #2d3277;
  border: 1px solid #e6cf00;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ml-buy-direct:hover {
  background: #ffd600;
  transform: translateY(-1px);
}

/* Botones de Acción Rápida en Header */
.header-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-btn-action:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

/* Galería de Fotos & Miniaturas en Modal de Fijar Precio */
.gallery-thumbs-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.gallery-thumb-item {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 8px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.gallery-thumb-item.is-cover {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.gallery-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.gallery-thumb-actions {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.gallery-thumb-item:hover .gallery-thumb-actions {
  opacity: 1;
}

.btn-set-cover {
  background: #2563eb;
  color: #ffffff;
  border: none;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-del-thumb {
  background: #dc2626;
  color: #ffffff;
  border: none;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}

.badge-is-cover {
  position: absolute;
  top: 3px;
  left: 3px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 2;
}

/* Presets de Temas de Color */
.btn-theme-preset {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-theme-preset:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Badge de Fotos Múltiples en Tarjeta */
.badge-photos-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 4;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
}

/* Barra de Catálogo Rápido en Tarjetas */
.product-catalog-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.product-catalog-bar:hover {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ==============================================================================
   PROPORCIONES DINÁMICAS (1:1 & 4:5) Y OPTIMIZADOR PROMAX DE IMÁGENES
   ============================================================================== */
.product-aspect-ratio-selector {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.btn-aspect-ratio {
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-aspect-ratio:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-aspect-ratio.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

.gallery-thumb-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.gallery-thumb-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.gallery-thumb-item.ratio-1-1 {
  width: 72px;
  height: 72px;
}

.gallery-thumb-item.ratio-4-5 {
  width: 64px;
  height: 80px;
}

.gallery-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-thumb-badge-cover {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.gallery-thumb-btn-del {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  transition: background 0.15s ease;
}

.gallery-thumb-btn-del:hover {
  background: #ef4444;
}

/* ==============================================================================
   VISTAS PRINCIPALES INTEGRADAS (BÓVEDA VS GESTOR INTEGRAL DE PEDIDOS)
   ============================================================================== */
.app-main-view {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.app-main-view.active {
  display: flex !important;
  animation: fadeInAppView 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInAppView {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.order-workspace-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  width: 100%;
}

.order-workspace-body {
  padding: 22px;
  width: 100%;
  box-sizing: border-box;
}

.order-view-header {
  border-bottom: none;
  padding-bottom: 4px;
}

/* ==============================================================================
   VISTA MÓVIL / TABLET: TARJETAS DE PEDIDOS (CERO SCROLL HORIZONTAL)
   ============================================================================== */
.orders-cards-container {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.order-mobile-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 15px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.order-mobile-card:hover {
  box-shadow: 0 4px 14px rgba(15,23,42,0.06);
}

.order-mcard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.order-mcard-folio-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-mcard-date {
  font-size: 0.68rem;
  color: #94a3b8;
}

.order-mcard-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.order-mcard-customer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-mcard-customer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.order-mcard-customer-name {
  font-size: 0.90rem;
  font-weight: 800;
  color: #0f172a;
}

.order-mcard-items-block {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 9px 12px;
}

.order-mcard-section-label {
  font-size: 0.67rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 5px;
}

.order-mcard-items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Grilla Financiera Móvil de 3 Columnas */
.order-mcard-finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  box-sizing: border-box;
}

.order-mcard-fin-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.mfin-label {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.mfin-val {
  font-size: 0.84rem;
  font-weight: 800;
  color: #0f172a;
}

.mfin-sale { color: #0f172a; }
.mfin-cost { color: #475569; }

.mfin-item-profit {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 3px 4px;
}

.mfin-profit {
  color: #16a34a !important;
  font-weight: 900 !important;
}

.order-mcard-logistics-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  padding: 2px 0;
  border-top: 1px dashed #e2e8f0;
  padding-top: 6px;
}

.order-mcard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.btn-mcard-action {
  height: 38px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-mcard-manage {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.btn-mcard-manage:hover {
  background: #dbeafe;
}

.btn-mcard-ml {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.btn-mcard-ml:hover {
  background: #fef3c7;
}

.btn-mcard-ticket {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-mcard-ticket:hover {
  background: #e2e8f0;
}

.btn-mcard-ready {
  background: #16a34a;
  color: #ffffff;
}
.btn-mcard-ready:hover {
  background: #15803d;
}

/* ==============================================================================
   CONMUTACIÓN RESPONSIVA Y REFINAMIENTO DE ESPACIOS
   ============================================================================== */
@media (min-width: 861px) {
  .orders-table-wrapper {
    display: block !important;
  }
  .orders-cards-container {
    display: none !important;
  }
}

@media (max-width: 860px) {
  .orders-table-wrapper {
    display: none !important;
  }
  .orders-cards-container {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .order-workspace-body {
    padding: 12px 10px;
  }

  .order-workspace-container {
    border-radius: 12px;
  }

  .order-view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .order-view-header .header-actions {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 8px;
  }

  .order-view-header .header-actions button {
    flex: 1;
    justify-content: center;
  }

  .order-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .order-search-box {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .order-filter-pills {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .order-filter-pills::-webkit-scrollbar {
    display: none;
  }

  #btnRefreshOrdersList {
    align-self: flex-end;
  }

  .promax-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .promax-kpi-card {
    padding: 10px 10px !important;
  }

  .promax-kpi-value {
    font-size: 1.15rem !important;
  }
}

/* ==============================================================================
   PUNTO DE VENTA (POS) INTEGRADO & CATÁLOGO DE MOSTRADOR
   ============================================================================== */
.pos-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.pos-header-banner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pos-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pos-main-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}

/* Columna Izquierda: Catálogo y Buscador */
.pos-catalog-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pos-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.pos-search-wrapper:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.pos-search-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 10px 10px 10px;
  font-size: 0.85rem;
  color: #0f172a;
  outline: none;
}

.pos-search-input::placeholder {
  color: #94a3b8;
}

.pos-categories-pills-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.pos-categories-pills-bar::-webkit-scrollbar {
  display: none;
}

.pos-cat-pill {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.pos-cat-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.pos-cat-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* Shelf de Productos */
.pos-products-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  width: 100%;
}

.pos-product-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.pos-product-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
}

.pos-product-card.in-cart {
  border-color: #3b82f6;
  background: #fafcff;
}

.pos-product-img-box {
  position: relative;
  width: 100%;
  height: 130px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #f1f5f9;
}

.pos-product-img-box img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.pos-product-card:hover .pos-product-img-box img {
  transform: scale(1.05);
}

.pos-product-qty-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.pos-product-stock-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.pos-product-stock-tag.out-stock {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

.pos-product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pos-product-cat {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.pos-product-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.2rem;
}

.pos-product-prices {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 10px;
}

.pos-product-price-sale {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e40af;
}

.pos-product-price-cost {
  font-size: 0.68rem;
  color: #94a3b8;
  font-family: monospace;
}

.btn-pos-add {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-pos-add:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.btn-pos-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-pos-add.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.btn-pos-add.active:hover {
  background: #2563eb;
  color: #ffffff;
}

.pos-catalog-empty {
  grid-column: 1 / -1;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Columna Derecha: Ticket de Venta y Checkout */
.pos-ticket-side {
  position: sticky;
  top: 16px;
  min-width: 0;
}

.pos-ticket-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-ticket-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}

.pos-cart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.pos-cart-empty {
  padding: 24px 12px;
  text-align: center;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pos-cart-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.pos-cart-item-thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.pos-cart-item-thumb img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.pos-cart-item-details {
  flex: 1;
  min-width: 0;
}

.pos-cart-item-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-cart-item-unitprice {
  font-size: 0.68rem;
  color: #64748b;
}

.pos-cart-item-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 4px;
}

.btn-qty {
  width: 20px;
  height: 20px;
  border: none;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-qty:hover {
  background: #e2e8f0;
}

.qty-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f172a;
  min-width: 16px;
  text-align: center;
}

.pos-cart-item-subtotal {
  font-size: 0.82rem;
  font-weight: 800;
  color: #1e40af;
  min-width: 60px;
  text-align: right;
}

.btn-pos-remove-row {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-pos-remove-row:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Totales Financieros */
.pos-totals-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pos-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #334155;
}

.pos-totals-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  border-top: 1px solid #cbd5e1;
  padding-top: 6px;
  margin-top: 4px;
}

/* Bloques de Formulario POS */
.pos-form-block {
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  margin-top: 4px;
}

.pos-form-block-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.btn-pos-quick {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pos-quick:hover {
  background: #2563eb;
  color: #ffffff;
}

.btn-pos-complete-sale {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-pos-complete-sale:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

@media (max-width: 900px) {
  .pos-main-grid {
    grid-template-columns: 1fr;
  }
  .pos-ticket-side {
    position: static;
  }
}
