/* ==========================================================================
   SISTEMA DE DISEÑO CORPORATIVO MOBILE-FIRST (SOFT DEPTH)
   Paleta: Fondo gris ultra suave (#F8FAFC), superficies #FFFFFF, bordes sutiles (#E2E8F0)
   Escala de espaciado: múltiplos estrictos de 8px (8, 16, 24, 32, 40px)
   Tipografías: Plus Jakarta Sans (UI) + JetBrains Mono (precios, códigos, specs)
   ========================================================================== */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.92);

  --border: #e2e8f0;
  --border-ink: #cbd5e1;
  --border-soft: #e2e8f0;
  --border-input: #cbd5e1;

  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.04),
    0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-card-hover: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 20px 44px rgba(15, 23, 42, 0.14),
    0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.14);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ======================== RESET Y BASE ======================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
}

body.has-bottom-nav {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

body.has-cart {
  padding-bottom: calc(160px + env(safe-area-inset-bottom));
}

body.modal-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1184px;
  margin-inline: auto;
  padding-inline: var(--space-2);
}

.container-narrow {
  max-width: 784px;
}

/* Lucide icon sizing: grosor uniforme en toda la app */
svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
  flex-shrink: 0;
}

.icon-sm svg.lucide {
  width: 15px;
  height: 15px;
}

.mono-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

/* ======================== SHIMMER SKELETON LOADERS ======================== */
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton,
.animate-pulse {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-card.animate-pulse,
.skeleton-row-card.animate-pulse {
  background: var(--surface);
  animation: none;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.skeleton-media {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}

.skeleton-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.skeleton-line {
  height: 14px;
}

.skeleton-line-lg {
  width: 85%;
  height: 16px;
}

.skeleton-line-md {
  width: 62%;
}

.skeleton-line-sm {
  width: 42%;
}

.skeleton-btn {
  height: 40px;
  width: 100%;
  margin-top: var(--space-1);
}

.skeleton-row-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  box-shadow: var(--shadow-card);
}

.skeleton-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.skeleton-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* ======================== TOP NAV & LOGO EMPRESA ======================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 45;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
}

.top-nav-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text);
}

.company-logo-img,
.brand-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 168px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.brand-fallback-text {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: #4f46e5;
  line-height: 1;
}

.brand-fallback-text[hidden] {
  display: none;
}

.brand-logo--nav {
  height: 32px;
}

.brand-logo--auth {
  height: 56px;
  max-width: 220px;
  margin: 0 auto;
}

.brand-logo--sidebar {
  height: 36px;
  max-width: 180px;
}

.brand-logo--compact {
  height: 28px;
  max-width: 132px;
}

.brand-logo--mini {
  height: 20px;
  max-width: 96px;
}

.brand-logo--footer {
  height: 32px;
  max-width: 150px;
}

.auth-brand-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.page-brand-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 20px 16px 28px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.page-brand-footer a {
  color: var(--text-muted);
  font-weight: 600;
}

.page-brand-footer a:hover {
  color: var(--primary);
}

.chat-sidebar-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.footer-copyright {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dash-sidebar-brand {
  display: flex;
  align-items: center;
  padding: 2px 10px 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.dash-mobile-brand {
  display: inline-flex;
}

@media (min-width: 768px) {
  .brand-logo--nav {
    height: 36px;
  }

  .dash-mobile-brand {
    display: none;
  }

  .dash-body .top-nav-inner {
    justify-content: flex-end;
  }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mode-badge.is-supabase {
  background-color: var(--success-soft);
  border-color: #bbf7d0;
  color: #166534;
}

/* ======================== BOTONES ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease, transform 0.12s ease;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #0f172a;
  border: 1px solid transparent;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #e2e8f0;
}

.btn-text-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  color: var(--danger);
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.btn-text-danger:hover {
  background-color: var(--danger-soft);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background-color: #e2e8f0;
  color: var(--text);
}

/* ======================== PIE DE PÁGINA ======================== */
.site-footer {
  margin-top: var(--space-5);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  background-color: var(--surface);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ======================== LANDING DE ROLES Y PLANES (index.html) ======================== */
.hero-gateway {
  padding: var(--space-4) 0 var(--space-3);
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-title {
  margin: var(--space-2) auto var(--space-1);
  max-width: 740px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero-subtitle {
  margin: 0 auto;
  max-width: 620px;
  font-size: 0.98rem;
  color: var(--text-muted);
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.role-grid.is-single-role {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.role-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.role-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.role-icon-box {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background-color: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #dbeafe;
}

.role-card-title {
  margin: var(--space-2) 0 var(--space-1);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.role-card-desc {
  margin: 0 0 var(--space-2);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.role-bullets {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 0.86rem;
  color: var(--text);
}

.role-bullets li {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.role-bullets li svg {
  color: var(--success);
}

.role-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.rubros-strip {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.rubros-strip-title {
  margin: 0 0 var(--space-2);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1);
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.session-banner {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

/* ======================== SECCIÓN PLANES EN LANDING Y DASHBOARD ======================== */
.plans-section-wrap {
  padding: var(--space-4) 0;
}

.plans-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.plans-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  align-items: stretch;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.plan-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.plan-card.is-recommended {
  border: 1.5px solid #2563eb;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.12);
}

.plan-card.is-current {
  border: 1.5px solid #2563eb;
}

.plan-card.is-pro-max {
  background-color: #0f172a;
  color: #ffffff;
  border: 1px solid #1e293b;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.plan-card.is-pro-max h2,
.plan-card.is-pro-max h3,
.plan-card.is-pro-max .plan-price {
  color: #ffffff;
}

.plan-card.is-pro-max .modal-subtitle,
.plan-card.is-pro-max .plan-price small {
  color: #cbd5e1;
}

.plan-card.is-pro-max .role-bullets li {
  color: #e2e8f0;
}

.plan-card.is-pro-max .role-bullets svg {
  color: #60a5fa;
}

.plan-promax-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background-color: #1e293b;
  border: 1px solid #334155;
  color: #93c5fd;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-price-soon {
  font-family: var(--font-sans);
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.btn-promax-disabled {
  background-color: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  cursor: not-allowed;
}

.pro-trial-banner,
.explorer-phase2-banner,
.inventory-limit-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
}

.pro-trial-banner {
  background-color: #ffffff;
  border: 1px solid #bfdbfe;
  box-shadow: var(--shadow-card);
}

.pro-trial-content,
.explorer-phase2-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.pro-trial-icon,
.explorer-phase2-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background-color: #eff6ff;
  color: #2563eb;
  flex-shrink: 0;
}

.pro-trial-text {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.explorer-phase2-banner {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  box-shadow: var(--shadow-card);
}

.explorer-phase2-icon {
  background-color: #ffffff;
  border: 1px solid #bfdbfe;
}

.explorer-phase2-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inventory-limit-banner {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
}

.coupon-card.is-paused {
  opacity: 0.78;
}

.plan-recommended-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-price {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.plan-price small {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Binance Checkout Box */
.binance-box {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-top: var(--space-3);
}

.binance-details-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.binance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px 16px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.binance-row-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.binance-row-value {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

/* ======================== AUTH TABS ======================== */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  padding: 4px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  margin-bottom: var(--space-2);
}

.auth-tab {
  min-height: 38px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.auth-tab.is-active {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* ======================== ONBOARDING WIZARD ======================== */
.wizard-container {
  padding-top: var(--space-3);
}

.wizard-header {
  margin-bottom: var(--space-2);
}

.wizard-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wizard-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.wizard-step {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.wizard-step.is-active {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.wizard-step.is-done {
  background-color: var(--success-soft);
  border-color: #bbf7d0;
  color: #166534;
}

.wizard-card {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.rubro-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-1);
}

.rubro-card {
  position: relative;
}

.rubro-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rubro-card-inner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.rubro-card input:checked + .rubro-card-inner {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.rubro-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rubro-card-name {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
}

.rubro-card-desc {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rubro-preview-box {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.slug-input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--surface);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.slug-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.slug-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background-color: var(--surface-subtle);
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.slug-input-group .form-control {
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.slug-input-group .form-control:focus {
  box-shadow: none;
}

.wizard-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

/* ======================== SUBIDA REAL DE ARCHIVOS ======================== */
.file-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-input);
  background-color: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.file-dropzone:hover {
  border-color: var(--primary);
  background-color: var(--primary-soft);
}

.file-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.media-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.media-preview-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
}

.media-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.video-preview-player {
  width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: #0f172a;
  margin-top: var(--space-1);
}

/* ======================== DASHBOARD VENDEDOR ======================== */
.dash-shell {
  display: block;
}

.dash-sidebar {
  display: none;
}

.dash-main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 28px;
  min-width: 0;
}

.dash-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-nav-group-label {
  padding: 0 12px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.dash-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  background-color: transparent;
  border: 1px solid transparent;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.dash-nav-item:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.dash-nav-item.is-active {
  background-color: #eff6ff;
  color: #2563eb;
  font-weight: 700;
}

.dash-nav-item .tab-badge {
  margin-left: auto;
}

.dash-more-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-more-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 600;
}

.dash-more-item.is-active {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.dash-more-item-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.dash-page {
  padding-top: var(--space-2);
}

.dash-store-card {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.dash-store-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.dash-store-id {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.dash-store-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.dash-store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

@media (max-width: 520px) {
  .dash-store-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .dash-store-actions > * {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding-inline: 10px;
  }

  .dash-store-actions > :last-child {
    grid-column: 1 / -1;
  }
}

.dash-tabs {
  display: none;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: var(--space-2);
  padding-bottom: 4px;
}

.dash-tabs::-webkit-scrollbar {
  display: none;
}

.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.dash-tab:hover {
  color: var(--text);
  background-color: var(--surface-subtle);
}

.dash-tab.is-active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.tab-badge.has-count {
  background-color: var(--danger);
  border-color: transparent;
  color: #ffffff;
}

.dash-tab.is-active .tab-badge:not(.has-count) {
  background-color: rgba(255, 255, 255, 0.22);
  border-color: transparent;
  color: #ffffff;
}

.bottom-nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  min-width: 17px;
  height: 17px;
  padding-inline: 4px;
  border-radius: var(--radius-pill);
  background-color: var(--danger);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* KPIs Interactivos */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.kpi-card {
  text-align: left;
  width: 100%;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card.kpi-clickable {
  cursor: pointer;
}

.kpi-card.kpi-clickable:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 1.38rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.kpi-warn {
  border-color: #fde68a;
  background-color: #fffbeb;
}

.kpi-warn .kpi-value {
  color: var(--warning);
}

.kpi-danger {
  border-color: #fecaca;
  background-color: #fef2f2;
}

.kpi-danger .kpi-value {
  color: var(--danger);
}

/* Finanzas & Chart */
.finance-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.chart-card,
.insight-card {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-2);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 240px;
  margin-top: var(--space-1);
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.top-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.top-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

/* Inventario */
.dash-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.dash-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.dash-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.filter-pill.is-active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.inv-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.inv-card.is-low-stock {
  border-color: #fde68a;
  background-color: #fffdf5;
}

.inv-card.is-out-of-stock {
  border-color: #fecaca;
  background-color: #fff8f8;
}

.inv-card-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.inv-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
}

.inv-info {
  flex: 1;
  min-width: 0;
}

.inv-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.inv-name {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.inv-meta {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.stock-alert-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
}

.stock-alert-banner.is-low {
  background-color: var(--warning-soft);
  color: #92400e;
}

.stock-alert-banner.is-out {
  background-color: var(--danger-soft);
  color: #991b1b;
}

.stock-alert-banner.is-ok {
  background-color: var(--success-soft);
  color: #166534;
}

.inv-card-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}

.stock-quick-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.stock-step-btn {
  min-width: 40px;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  background-color: var(--surface);
  border: 1px solid var(--border);
}

.stock-step-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.stock-step-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stock-count-label {
  min-width: 64px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
}

.inv-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ======================== AJUSTES ======================== */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.settings-card {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.settings-card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
}

.settings-card-sub {
  margin: 0 0 var(--space-2);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.switch-toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

/* ======================== PEDIDOS, CHAT, CUPONES, CRM ======================== */
.orders-list,
.coupons-list,
.crm-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.order-card,
.coupon-card,
.crm-card {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.order-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.order-code {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 700;
}

.order-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pendiente {
  background-color: var(--warning-soft);
  color: #92400e;
}

.status-confirmado {
  background-color: var(--primary-soft);
  color: var(--primary);
}

.status-enviado {
  background-color: #e0f2fe;
  color: #0369a1;
}

.status-completado {
  background-color: var(--success-soft);
  color: #166534;
}

.status-cancelado {
  background-color: var(--danger-soft);
  color: #991b1b;
}

.order-items-box {
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}

/* Order Tracker */
.order-tracker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
  margin: var(--space-2) 0;
}

.tracker-step {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-subtle);
}

.tracker-step.is-done {
  background-color: var(--success-soft);
  border-color: #bbf7d0;
  color: #166534;
}

.tracker-step.is-active {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* Chat interno */
.floating-chat-fab {
  position: fixed;
  right: var(--space-2);
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 42;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background-color: var(--text);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

body.has-cart .floating-chat-fab {
  bottom: calc(148px + env(safe-area-inset-bottom));
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 224px;
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-bubble.is-customer {
  align-self: flex-end;
  background-color: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.chat-bubble.is-merchant {
  align-self: flex-start;
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  color: var(--text);
  border-bottom-left-radius: 3px;
}

.chat-bubble-meta {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  opacity: 0.78;
}

.chat-send-form {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.chat-inbox-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.chat-thread-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chat-thread-item {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.chat-thread-item.is-active {
  background-color: var(--primary-soft);
  border-color: var(--primary);
}

.chat-window-card {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* ======================== EXPLORADOR Y CATÁLOGO MARKETPLACE ======================== */
.market-sticky-bar {
  position: relative;
  top: auto;
  z-index: 1;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-2) 0;
}

.controls-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
  display: inline-flex;
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 40px;
  background-color: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.clear-search-btn {
  position: absolute;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}

.explorer-filters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
}

.category-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.category-tab.is-active {
  background-color: var(--text);
  border-color: var(--text);
  color: #ffffff;
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  margin: var(--space-3) 0 var(--space-2);
}

.results-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.results-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.explorer-grid,
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.market-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.market-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.market-card.is-out {
  opacity: 0.72;
}

.market-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background-color: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.market-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.market-media-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.market-media-bottom {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
}

.stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
}

.stock-chip.is-ok {
  background-color: var(--success-soft);
  color: #166534;
}

.stock-chip.is-low {
  background-color: var(--warning-soft);
  color: #92400e;
}

.stock-chip.is-out {
  background-color: var(--danger-soft);
  color: #991b1b;
}

.featured-badge,
.video-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  background-color: rgba(15, 23, 42, 0.82);
  color: #ffffff;
}

.featured-badge {
  background-color: var(--primary);
}

.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  color: var(--text-muted);
}

.fav-btn.is-active {
  color: var(--danger);
  border-color: #fecaca;
}

.market-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.product-name {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.product-desc {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.product-price-bs {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.spec-chip {
  padding: 2px 8px;
  border-radius: 6px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.explorer-store-box {
  margin-top: auto;
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-actions {
  padding: 0 var(--space-2) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* ======================== PLANTILLAS ADAPTATIVAS POR RUBRO (store.html) ======================== */
body[data-rubro="tech"] .market-media {
  aspect-ratio: 4 / 3;
}

.tech-specs-table {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.72rem;
}

.tech-spec-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tech-spec-key {
  color: var(--text-muted);
  font-weight: 600;
}

.tech-spec-val {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

body[data-rubro="food"] .products-grid,
body[data-rubro="treats"] .products-grid {
  grid-template-columns: 1fr;
}

body[data-rubro="food"] .market-card,
body[data-rubro="treats"] .market-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  grid-template-rows: 1fr auto;
}

body[data-rubro="food"] .market-media,
body[data-rubro="treats"] .market-media {
  grid-row: 1 / span 2;
  aspect-ratio: auto;
  height: 100%;
  min-height: 140px;
  border-bottom: none;
  border-right: 1px solid var(--border);
}

body[data-rubro="food"] .market-actions,
body[data-rubro="treats"] .market-actions {
  flex-direction: row;
  flex-wrap: wrap;
}

body[data-rubro="food"] .market-actions .btn,
body[data-rubro="treats"] .market-actions .btn {
  flex: 1;
}

body[data-rubro="services"] .market-media {
  aspect-ratio: 16 / 10;
}

.service-meta-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.74rem;
}

/* ======================== HEADER TIENDA PÚBLICA (store.html) ======================== */
.store-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.store-banner-wrap {
  position: relative;
  height: 160px;
  overflow: hidden;
  background-color: var(--surface-subtle);
}

.store-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.35),
    rgba(15, 23, 42, 0.08)
  );
}

.banner-top-bar {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  max-width: 1184px;
  margin-inline: auto;
  padding-inline: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.status-pill,
.rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.status-pill.is-open {
  color: #166534;
}

.status-pill.is-closed {
  color: #991b1b;
}

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

.store-card {
  position: relative;
  padding: var(--space-2) 0;
}

.store-identity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.store-logo {
  width: 68px;
  height: 68px;
  margin-top: -36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-card);
  background-color: var(--surface);
}

.store-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.store-slogan {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.store-location-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text);
}

.store-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.qty-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* ======================== BARRA FLOTANTE CARRITO & BOTTOM NAV ======================== */
.floating-cart {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 41;
  padding: 8px 0;
  pointer-events: none;
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.28s var(--ease-out), opacity 0.2s ease;
}

.floating-cart.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.floating-cart-btn {
  pointer-events: auto;
  width: 100%;
  min-height: 56px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
}

.floating-cart-left {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding-inline: 7px;
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.22);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
}

.floating-cart-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.floating-cart-total {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
}

.floating-cart-bs {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.9;
}

/* Tab bar fija en móvil */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 44;
  min-height: 60px;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.04);
  padding: 4px 8px calc(6px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
}

.bottom-nav-item {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.bottom-nav-item.is-active {
  color: var(--primary);
  background-color: var(--primary-soft);
}

/* ======================== MODALES Y DRAWERS ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-modal);
  transform: translateY(30px);
  transition: transform 0.26s var(--ease-out);
}

#auth-modal .modal-sheet {
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-modal);
}

.modal-overlay.is-open .modal-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 10px auto 2px;
  border-radius: var(--radius-pill);
  background-color: var(--border-input);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.modal-title-inline {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.modal-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding-inline: 7px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.modal-footer {
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background-color: var(--surface);
}

/* ======================== FORMULARIOS Y CHECKOUT ======================== */
.stack-form,
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checkout-form {
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.form-hint {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.required-mark {
  color: var(--danger);
}

.optional-mark {
  color: var(--text-subtle);
  font-weight: 500;
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  background-color: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  resize: vertical;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-error {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
}

#checkout-modality-options {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.segment-option {
  position: relative;
}

.segment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.segment-option input:checked + .segment-label {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.pickup-info-box {
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.84rem;
}

.payment-methods-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-1);
}

.payment-card {
  position: relative;
}

.payment-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.payment-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
}

.payment-card-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
}

.payment-card-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.payment-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-input);
  flex-shrink: 0;
}

.payment-card input:checked + .payment-card-inner {
  background-color: var(--primary-soft);
  border-color: var(--primary);
}

.payment-card input:checked + .payment-card-inner .payment-radio-dot {
  border-color: var(--primary);
  background-color: var(--primary);
  box-shadow: inset 0 0 0 3px #ffffff;
}

.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 10px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.cart-item-img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}

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

.cart-item-controls {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.cart-qty-btn {
  width: 30px;
  height: 30px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.cart-qty-val {
  min-width: 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
}

.order-summary {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.summary-total {
  margin-top: 4px;
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--text);
}

.coupon-row {
  display: flex;
  gap: var(--space-1);
}

.coupon-applied-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  margin-top: var(--space-1);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--success-soft);
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.82rem;
  font-weight: 600;
}

.closed-notice {
  margin-bottom: var(--space-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--warning-soft);
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.84rem;
}

.empty-state,
.checkout-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 36px 20px;
  background-color: var(--surface);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 14px;
  background-color: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.empty-state-icon > svg {
  width: 22px;
  height: 22px;
}

.empty-state h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.empty-state .modal-subtitle {
  margin: 0;
  max-width: 400px;
}

.empty-state-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ======================== RESEÑAS & QR ======================== */
.reviews-section {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.reviews-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.review-card {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.star-picker {
  display: inline-flex;
  gap: 6px;
}

.star-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.star-btn.is-filled {
  color: #d97706;
  border-color: #fde68a;
  background-color: #fffbeb;
}

.qr-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  text-align: center;
}

/* ======================== TOASTS Y ALERTAS EN TIEMPO REAL ======================== */
.toast-container {
  position: fixed;
  right: 16px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 130;
  width: calc(100% - 32px);
  max-width: 380px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

body.has-cart .toast-container {
  bottom: calc(148px + env(safe-area-inset-bottom));
}

.toast {
  width: 100%;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #16a34a;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.toast-success {
  border-left-color: #16a34a;
}

.toast.toast-success .toast-icon {
  background-color: #dcfce7;
  color: #16a34a;
}

.toast.toast-error,
.toast.toast-warn {
  border-left-color: #dc2626;
}

.toast.toast-error .toast-icon,
.toast.toast-warn .toast-icon {
  background-color: #fee2e2;
  color: #dc2626;
}

.toast.toast-info {
  border-left-color: #2563eb;
}

.toast.toast-info .toast-icon {
  background-color: #eff6ff;
  color: #2563eb;
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast-icon > svg {
  width: 16px;
  height: 16px;
}

.toast-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.toast-close:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.toast-close > svg {
  width: 15px;
  height: 15px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Alertas flotantes arriba a la derecha (Dashboard Realtime) */
.alert-toast-container {
  position: fixed;
  top: 72px;
  right: var(--space-2);
  z-index: 125;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: 360px;
  width: calc(100% - 32px);
  pointer-events: none;
}

@media (max-width: 767px) {
  .alert-toast-container {
    top: calc(8px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    width: auto;
    max-width: 440px;
    margin: 0 auto;
  }

  .alert-toast-container .alert-toast {
    padding: 10px 12px;
    gap: 10px;
  }
}

.alert-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px var(--space-2);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-hover);
  cursor: pointer;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.22s ease, transform 0.22s var(--ease-out);
}

.alert-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.alert-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-soft);
  border: 1px solid #dbeafe;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.alert-toast-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
}

.alert-toast-body {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alert-toast-close {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

/* ======================== RESPONSIVE (TABLET & DESKTOP) ======================== */
@media (min-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }

  .role-grid,
  .rubro-grid,
  .insights-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .plans-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-main .plans-grid {
    grid-template-columns: 1fr;
  }

  .plan-card.is-recommended {
    transform: translateY(-4px);
  }

  .explorer-grid,
  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
  }

  body[data-rubro="food"] .products-grid,
  body[data-rubro="treats"] .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inv-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .inv-card-controls {
    border-top: none;
    padding-top: 0;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
  }
}

@media (min-width: 1024px) {
  .dash-main .plans-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  body.has-bottom-nav {
    padding-bottom: var(--space-4);
  }

  body.has-cart {
    padding-bottom: 96px;
  }

  .bottom-nav {
    display: none;
  }

  .dash-body .top-nav-inner {
    max-width: none;
    padding-inline: 20px;
  }

  .dash-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
    min-height: calc(100dvh - 65px);
  }

  .dash-sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 65px;
    height: calc(100dvh - 65px);
    overflow-y: auto;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 12px 10px 14px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }

  .dash-sidebar:hover {
    scrollbar-color: #cbd5e1 transparent;
  }

  .dash-sidebar::-webkit-scrollbar {
    width: 5px;
    height: 5px;
  }

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

  .dash-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
  }

  .dash-sidebar:hover::-webkit-scrollbar-thumb {
    background: #cbd5e1;
  }

  .dash-sidebar-brand {
    padding: 0 10px 10px;
    margin-bottom: 10px;
  }

  .dash-sidebar-nav {
    gap: 12px;
  }

  .dash-nav-group {
    gap: 2px;
  }

  .dash-nav-group-label {
    padding: 0 10px 3px;
    font-size: 0.67rem;
  }

  .dash-nav-item {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.85rem;
    gap: 9px;
  }

  .dash-main {
    padding: 24px 28px 48px;
  }

  .dash-tabs {
    display: flex;
  }

  .floating-cart {
    bottom: var(--space-2);
  }

  .floating-chat-fab {
    bottom: 24px;
  }

  body.has-cart .floating-chat-fab {
    bottom: 96px;
  }

  .toast-container {
    right: 24px;
    bottom: 24px;
  }

  body.has-cart .toast-container {
    bottom: 96px;
  }

  .controls-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .search-box {
    width: 320px;
  }

  .reviews-grid {
    grid-template-columns: 1fr 1.3fr;
  }

  .chat-inbox-layout {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }

  .crm-card,
  .coupon-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .modal-overlay {
    align-items: center;
    padding: var(--space-3);
  }

  .modal-sheet-sm,
  .modal-sheet-md,
  .modal-sheet-lg {
    max-width: 480px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: var(--shadow-modal);
  }

  .modal-sheet-md {
    max-width: 620px;
  }

  .modal-sheet-lg {
    max-width: 720px;
  }

  .sheet-handle {
    display: none;
  }

  .drawer-overlay {
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
  }

  .drawer-sheet {
    width: 100%;
    max-width: 456px;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border-top: none;
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-modal);
    transform: translateX(100%);
  }

  .drawer-overlay.is-open .drawer-sheet {
    transform: translateX(0);
  }
}

@media (min-width: 1024px) {
  .explorer-grid,
  .products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ======================== FAT FOOTER, LEGAL, CONSENTIMIENTO Y AVISOS ======================== */
.fat-footer {
  padding: var(--space-4) 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  align-items: start;
}

.footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.footer-desc {
  margin: 0;
  max-width: 380px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-links-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.footer-heading {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.footer-links a,
.footer-links .footer-link-btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.footer-links a:hover,
.footer-links .footer-link-btn:hover {
  color: var(--primary);
  text-decoration: underline;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr;
  }
}

/* Checkbox obligatorio de registro */
.auth-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
}

.auth-consent-label input[type="checkbox"] {
  margin-top: 2px;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.auth-consent-label a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

/* Aviso visible en el Checkout de store.html */
.checkout-safety-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
}

.checkout-safety-notice svg {
  color: var(--primary);
  margin-top: 2px;
}

/* Página Legal (legal.html) */
body.page-legal {
  background-color: var(--bg);
}

.legal-container {
  padding-top: var(--space-3);
}

.legal-header {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

.legal-page-title {
  margin: var(--space-2) 0 var(--space-1);
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.legal-page-subtitle {
  margin: 0;
  max-width: 680px;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.legal-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  align-items: start;
}

.legal-sidebar {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.legal-sidebar::-webkit-scrollbar {
  display: none;
}

.legal-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.legal-nav-btn:hover {
  color: var(--text);
}

.legal-nav-btn.is-active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.legal-card {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.legal-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-2);
}

.legal-section-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.legal-article {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.legal-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.legal-callout svg {
  color: var(--primary);
  margin-top: 2px;
}

.legal-block {
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface);
}

.legal-block h3 {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0 0 var(--space-1);
  font-size: 0.98rem;
  font-weight: 700;
}

.legal-block p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.legal-list {
  margin: var(--space-1) 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.safety-tips-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.safety-tip-card {
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.safety-tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.safety-tip-card h3 {
  margin: 0 0 6px;
  font-size: 0.96rem;
  font-weight: 700;
}

.safety-tip-card p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .legal-shell {
    grid-template-columns: 260px 1fr;
  }

  .legal-sidebar {
    position: sticky;
    top: 88px;
    flex-direction: column;
    overflow: visible;
    padding-bottom: 0;
  }

  .legal-nav-btn {
    width: 100%;
    justify-content: flex-start;
  }

  .safety-tips-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ======================== PÁGINA DEDICADA DE PRODUCTO & ESCALABILIDAD ======================== */
.plan-coming-soon-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: var(--space-3);
}

.product-page {
  padding-top: var(--space-3);
}

.product-back-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.product-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  align-items: start;
}

.product-gallery-card,
.product-info-card,
.product-seller-card {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.product-main-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
}

.product-main-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumbs-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.product-thumb-btn {
  width: 68px;
  height: 68px;
  padding: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  background-color: var(--surface-subtle);
  transition: border-color 0.16s ease, transform 0.12s ease;
}

.product-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb-btn.is-active {
  border-color: var(--primary);
}

.product-page-title {
  margin: var(--space-1) 0;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.product-page-desc {
  margin: var(--space-2) 0;
  font-size: 0.94rem;
  color: var(--text-muted);
  white-space: pre-line;
}

.product-seller-card {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .product-page-grid {
    grid-template-columns: 1.05fr 1fr;
    gap: var(--space-3);
  }

  .product-gallery-card,
  .product-info-card {
    padding: var(--space-3);
  }
}

/* ======================== ONBOARDING NICHO & DASHBOARD INCOMPLETO ======================== */
.custom-niche-box {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.wizard-skip-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: var(--surface-subtle);
  border: 1px dashed var(--border-input);
}

@media (min-width: 640px) {
  .wizard-skip-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.setup-warning-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: var(--space-2);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  box-shadow: var(--shadow-card);
}

.setup-warning-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.setup-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background-color: #fef3c7;
  color: #b45309;
}

.setup-warning-content strong {
  display: block;
  font-size: 0.94rem;
  color: #78350f;
}

.setup-warning-content p {
  margin: 0;
  color: #92400e;
}

@media (min-width: 768px) {
  .setup-warning-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.is-disabled-link {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* ======================== SERVICIOS LOCALES: MODALIDAD, SWITCH Y METADATOS ======================== */
.mode-selector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .mode-selector-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-choice-card {
  display: block;
  cursor: pointer;
}

.mode-choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-choice-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.mode-choice-card input:checked + .mode-choice-inner {
  border-color: var(--primary);
  background-color: var(--primary-soft);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.mode-choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  color: var(--primary);
}

.mode-choice-card input:checked + .mode-choice-inner .mode-choice-icon {
  background-color: var(--primary);
  color: #ffffff;
}

.mode-choice-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
}

.mode-choice-desc {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.exp-mode-tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-md);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 420px;
}

.exp-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.exp-mode-btn.is-active {
  background-color: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-card);
}

.service-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.service-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

/* ======================== TIENDA EXCLUSIVA MARCA BLANCA (PRO) ======================== */
.exclusive-shop-card {
  margin-bottom: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.exclusive-shop-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exclusive-shop-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.exclusive-shop-actions > * {
  width: 100%;
  justify-content: center;
  text-align: center;
  padding-inline: 10px;
}

.exclusive-shop-actions > :last-child {
  grid-column: 1 / -1;
}

@media (min-width: 900px) {
  .exclusive-shop-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .exclusive-shop-actions {
    display: flex;
    flex-wrap: nowrap;
    width: auto;
    flex-shrink: 0;
  }

  .exclusive-shop-actions > * {
    width: auto;
  }
}

.exclusive-url-pill {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--primary);
}

.exclusive-locked-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .exclusive-locked-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.exclusive-lock-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.exclusive-lock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.shop-white-footer {
  margin-top: var(--space-4);
  padding: 20px 0 92px;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
}

.shop-white-footer-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 640px) {
  .shop-white-footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.shop-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-footer-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
}

.shop-footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.shop-footer-legal a:hover {
  color: var(--primary);
}

/* ======================== CHAT MODERNO ESTILO WHATSAPP ======================== */
.chat-messages {
  background-color: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 260px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chat-bubble-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  touch-action: pan-y;
}

.chat-bubble-row.is-outgoing {
  justify-content: flex-end;
}

.chat-bubble-row.is-incoming {
  justify-content: flex-start;
}

.chat-swipe-hint {
  position: absolute;
  left: 4px;
  opacity: 0;
  color: var(--primary);
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.chat-bubble-row.is-swipe-ready .chat-swipe-hint {
  opacity: 1;
}

.chat-bubble {
  position: relative;
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  word-break: break-word;
}

.chat-bubble.is-outgoing,
.chat-bubble.is-customer {
  background-color: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.18);
}

.chat-bubble.is-incoming,
.chat-bubble.is-merchant {
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 16px 16px 16px 4px;
}

.chat-msg-text {
  white-space: pre-wrap;
}

.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.chat-bubble.is-outgoing .chat-bubble-meta,
.chat-bubble.is-customer .chat-bubble-meta {
  color: rgba(255, 255, 255, 0.84);
}

.chat-read-status {
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.78);
}

.chat-read-status.is-read {
  color: #ffffff;
}

.chat-read-status svg {
  width: 14px;
  height: 14px;
}

.chat-quoted-box {
  padding: 6px 10px;
  border-radius: 10px;
  background-color: var(--bg);
  border-left: 3px solid var(--primary);
  font-size: 0.76rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-bubble.is-outgoing .chat-quoted-box,
.chat-bubble.is-customer .chat-quoted-box {
  background-color: rgba(255, 255, 255, 0.16);
  border-left-color: #ffffff;
}

.chat-quoted-sender {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

.chat-bubble.is-outgoing .chat-quoted-sender,
.chat-bubble.is-customer .chat-quoted-sender {
  color: #ffffff;
}

.chat-quoted-text {
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-bubble.is-outgoing .chat-quoted-text,
.chat-bubble.is-customer .chat-quoted-text {
  color: rgba(255, 255, 255, 0.9);
}

.chat-msg-img {
  width: 100%;
  max-width: 260px;
  max-height: 240px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: zoom-in;
}

.chat-bubble.is-outgoing .chat-msg-img,
.chat-bubble.is-customer .chat-msg-img {
  border-color: rgba(255, 255, 255, 0.25);
}

.chat-reply-trigger {
  opacity: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background-color: var(--surface);
  border: 1px solid var(--border);
  transition: opacity 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.chat-bubble-row.is-outgoing .chat-reply-trigger {
  order: -1;
}

.chat-bubble-row:hover .chat-reply-trigger,
.chat-reply-trigger:focus-visible {
  opacity: 1;
}

.chat-reply-trigger:hover {
  color: var(--primary);
}

.chat-composer-wrap {
  position: relative;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-top: 1px solid #dbeafe;
  border-right: 1px solid #dbeafe;
  border-bottom: 1px solid #dbeafe;
}

.chat-reply-preview-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-reply-preview-sender {
  font-size: 0.74rem;
  color: var(--primary);
}

.chat-reply-preview-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-send-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.chat-tool-btn:hover {
  color: var(--primary);
  background-color: var(--primary-soft);
  border-color: #bfdbfe;
}

.chat-send-circle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
  transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.chat-send-circle-btn:hover {
  background-color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.34);
}

.chat-send-circle-btn:active {
  transform: scale(0.95);
}

.chat-send-circle-btn svg {
  width: 18px;
  height: 18px;
}

.chat-emoji-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.chat-emoji-item {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-emoji-item:hover {
  background-color: var(--surface-subtle);
}

.chat-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background-color: rgba(15, 23, 42, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chat-lightbox-img {
  max-width: 94vw;
  max-height: 88dvh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  object-fit: contain;
}

.chat-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.my-chats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.my-chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

.my-chat-row:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.my-chat-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
}

/* ======================== PÁGINA DEDICADA DE CHAT (100dvh SPLIT-SCREEN) ======================== */
body.chat-app-page {
  height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
  background-color: var(--bg);
}

.chat-app-shell {
  height: 100dvh;
  display: flex;
  overflow: hidden;
  background-color: var(--surface);
}

.chat-sidebar {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 12px 16px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-sidebar-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.chat-back-icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.chat-back-icon-btn:hover {
  background-color: var(--surface-subtle);
  color: var(--primary);
}

.chat-sidebar-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-sidebar-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sidebar-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-link-device-btn {
  white-space: nowrap;
  padding: 6px 10px;
  font-size: 0.76rem;
  gap: 6px;
}

.chat-link-device-btn svg {
  width: 15px;
  height: 15px;
}

.chat-device-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-device-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 164px;
  padding: 6px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.chat-device-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--danger);
  text-align: left;
  transition: background-color 0.14s ease;
}

.chat-device-menu-item:hover {
  background-color: var(--danger-soft);
}

.chat-device-menu-item svg {
  width: 16px;
  height: 16px;
}

.chat-sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface);
  flex-shrink: 0;
}

.chat-sidebar-search .search-input {
  border-radius: var(--radius-pill);
  background-color: var(--bg);
  border: 1px solid var(--border);
  padding-top: 9px;
  padding-bottom: 9px;
}

.chat-conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-convo-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  transition: background-color 0.14s ease;
}

.chat-convo-item:hover {
  background-color: var(--bg);
}

.chat-convo-item.is-active {
  background-color: #f1f5f9;
  box-shadow: inset 3px 0 0 var(--primary);
}

.chat-avatar-wrap {
  flex-shrink: 0;
}

.chat-avatar,
.chat-avatar-initial {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.chat-avatar {
  object-fit: cover;
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
}

.chat-avatar-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-soft);
  border: 1px solid #dbeafe;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.96rem;
}

.chat-convo-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-convo-top,
.chat-convo-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-convo-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-convo-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.chat-convo-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-unread-pill {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background-color: var(--primary);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-stage {
  display: none;
  flex: 1;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  background-color: var(--bg);
}

.chat-stage-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.chat-stage-empty-card {
  max-width: 380px;
  text-align: center;
  padding: 32px 24px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.chat-stage-empty-card h2 {
  margin: 12px 0 8px;
  font-size: 1.05rem;
}

.chat-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-stage-active {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-active-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-active-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.chat-guest-name-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: #fffbeb;
  border-bottom: 1px solid #fde68a;
  flex-shrink: 0;
}

.chat-messages-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-stage-composer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-stage-composer .chat-composer-wrap {
  margin-top: 0;
}

.chat-stage-composer .chat-send-form {
  gap: 8px;
}

.chat-pill-input {
  border-radius: var(--radius-pill) !important;
  min-height: 44px;
  padding: 10px 18px !important;
  background-color: var(--bg) !important;
}

.chat-pill-input:focus {
  background-color: var(--surface) !important;
}

/* Modal Vincular Teléfono por QR + Aviso de Dispositivo Revocado */
.link-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.link-qr-box {
  width: 216px;
  height: 216px;
  padding: 12px;
  border-radius: 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.link-qr-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.link-qr-countdown {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.link-qr-countdown.is-expired {
  background-color: #fef2f2;
  color: var(--danger);
}

.link-qr-copy-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.link-qr-url-preview {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-qr-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-qr-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text);
}

.link-qr-step-badge {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-revoked-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.chat-revoked-card {
  max-width: 400px;
  width: 100%;
  padding: 32px 24px;
  text-align: center;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Móvil: 2 pantallas (Lista o Chat Activo) */
.chat-app-shell.is-thread-open .chat-sidebar {
  display: none;
}

.chat-app-shell.is-thread-open .chat-stage {
  display: flex;
}

/* Escritorio: Split-screen 360px + ventana activa */
@media (min-width: 768px) {
  .chat-sidebar {
    width: 360px;
    display: flex !important;
  }

  .chat-stage {
    display: flex !important;
  }

  .chat-messages-area {
    padding: 24px;
  }

  .chat-mobile-back {
    display: none;
  }

  .install-pwa-btn {
    display: none !important;
  }
}

/* ======================== PANTALLA EXPLORADOR PRÓXIMAMENTE ======================== */
.explorer-coming-soon {
  padding: 40px 0;
  display: flex;
  justify-content: center;
}

.explorer-coming-soon-card {
  max-width: 520px;
  width: 100%;
  padding: 32px 24px;
  text-align: center;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.explorer-coming-soon-card h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.explorer-coming-soon-card .modal-subtitle {
  margin: 0;
  max-width: 420px;
}

/* ======================== MÓDULO DE DELIVERY Y REPARTIDORES ======================== */
.delivery-portal-body {
  background-color: var(--bg);
}

.delivery-page-shell {
  padding-top: 24px;
  padding-bottom: 40px;
  max-width: 720px;
}

.delivery-header-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delivery-header-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-card,
.delivery-order-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.driver-url-row {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.order-delivery-meta {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.delivery-customer-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.delivery-items-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.delivery-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.delivery-qty-pill {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.delivery-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.delivery-actions-grid > * {
  flex: 1 1 180px;
}

.delivery-pin-input {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  min-height: 54px;
}

.customer-pin-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.customer-pin-digits {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: var(--primary);
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid #dbeafe;
}

.delivery-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
}

.delivery-sin-asignar {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
}

.delivery-asignado {
  background-color: var(--primary-soft);
  color: var(--primary);
}

.delivery-en-camino {
  background-color: var(--warning-soft);
  color: var(--warning);
}

.delivery-entregado {
  background-color: var(--success-soft);
  color: var(--success);
}

.delivery-incidencia {
  background-color: var(--danger-soft);
  color: var(--danger);
}

.delivery-proof-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ======================== REDISEÑO APP REPARTIDOR & CHAT DE ENTREGA ======================== */
.delivery-order-card {
  border-radius: 16px;
}

.driver-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--success-soft);
  color: var(--success);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background-color: var(--success);
  flex-shrink: 0;
  animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

.delivery-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.delivery-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  color: var(--text-subtle);
}

.delivery-step-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background-color: #cbd5e1;
}

.delivery-step.is-done .delivery-step-dot {
  background-color: var(--success);
}

.delivery-step.is-current .delivery-step-dot {
  background-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

.delivery-step.is-done .delivery-step-label {
  color: var(--success);
  font-weight: 700;
}

.delivery-step.is-current .delivery-step-label {
  color: var(--primary);
  font-weight: 700;
}

.delivery-step-label {
  font-size: 0.7rem;
  line-height: 1.15;
}

.delivery-connecting-box {
  padding: 12px 14px;
  border-radius: 12px;
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
}

.delivery-connecting-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 0.9rem;
}

.delivery-connecting-head .live-pulse-dot {
  background-color: var(--primary);
}

.delivery-inline-pin-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.delivery-inline-pin-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.delivery-inline-pin-input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  background-color: var(--surface) !important;
}

.delivery-primary-cta {
  min-height: 48px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
}

.chat-delivery-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--warning-soft);
  border: 1px solid #fde68a;
  color: var(--warning);
}

.chat-delivery-avatar svg {
  width: 20px;
  height: 20px;
}

.chat-readonly-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.chat-readonly-bar svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.customer-arrival-card {
  padding: 16px;
  border-radius: 12px;
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 560px) {
  .driver-live-pill span:last-child {
    display: none;
  }
}

/* ======================== PESTAÑAS REPARTIDOR, SEGUIMIENTO LEAFLET Y PIE VIRAL ======================== */
.driver-tabs-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.driver-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.driver-tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.driver-tab-btn.is-active {
  background-color: var(--primary);
  color: #ffffff;
}

.driver-tab-btn .tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background-color: var(--danger);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.driver-queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.driver-queue-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.tracking-page-shell {
  padding-top: 20px;
  padding-bottom: 40px;
  max-width: 720px;
}

.tracking-confirm-banner {
  padding: 16px;
  border-radius: 16px;
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tracking-map-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

#map,
.tracking-map-box {
  width: 100%;
  height: 320px;
  border-radius: 14px;
  background-color: var(--surface-subtle);
  z-index: 1;
}

.tracking-cancelled-banner {
  padding: 14px 16px;
  border-radius: 16px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.cancel-policy-box {
  padding: 12px 14px;
  border-radius: 12px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.btn-danger-outline {
  background-color: #ffffff;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger-outline:hover:not(:disabled) {
  background-color: #fef2f2;
  border-color: #fca5a5;
}

.chat-delivery-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.chat-delivery-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.chat-delivery-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.active-delivery-store-banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tracking-map-caption {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background-color: var(--surface);
}

.tracking-chat-panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tracking-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface);
}

.tracking-chat-messages {
  min-height: 340px;
  max-height: 55dvh;
  border: none;
  border-radius: 0;
  background-color: var(--bg);
}

.map-pin-customer,
.map-pin-driver {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.28);
}

.map-pin-customer {
  width: 34px;
  height: 34px;
  background-color: var(--text);
}

.map-pin-driver {
  width: 40px;
  height: 40px;
  background-color: var(--primary);
}

.free-viral-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.free-viral-footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
}

.free-viral-footer strong {
  color: var(--text);
}

.free-viral-footer-cta {
  color: var(--primary);
  font-weight: 700;
}

.free-viral-footer a {
  color: var(--primary);
  font-weight: 700;
}

.free-viral-footer a:hover {
  text-decoration: underline;
}

/* ======================== MEJORAS: CHAT DELETE, EDICIÓN PEDIDO, CRM & BCV ======================== */
.chat-convo-row {
  position: relative;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.14s ease;
}

.chat-convo-row .chat-convo-item {
  flex: 1;
  min-width: 0;
  border-bottom: none;
}

.chat-convo-row.is-active {
  background-color: #f1f5f9;
}

.chat-convo-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.chat-convo-row:hover .chat-convo-delete-btn,
.chat-convo-row:focus-within .chat-convo-delete-btn {
  opacity: 1;
  pointer-events: auto;
}

.chat-convo-delete-btn:hover {
  background-color: #fef2f2;
  color: #dc2626;
}

.chat-convo-delete-btn svg {
  width: 16px;
  height: 16px;
}

@media (hover: none) {
  .chat-convo-delete-btn {
    display: none;
  }
}

.chat-delete-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.bcv-rate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.bcv-rate-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bcv-rate-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.edit-order-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-order-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.edit-order-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.edit-order-add-row .form-control {
  flex: 1;
  min-width: 0;
}

.edit-order-summary-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
}

.edit-order-manual-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.edit-order-manual-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.edit-order-switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background-color: #cbd5e1;
  transition: background-color 0.16s ease;
  flex-shrink: 0;
}

.edit-order-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.16s ease;
}

.edit-order-manual-switch input[type="checkbox"]:checked + .edit-order-switch-track {
  background-color: #2563eb;
}

.edit-order-manual-switch input[type="checkbox"]:checked + .edit-order-switch-track::after {
  transform: translateX(14px);
}

.edit-order-sync-hint {
  margin: 0 0 6px;
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 500;
}

.edit-order-sync-hint[hidden] {
  display: none;
}

#edit-order-total-input.is-auto-total {
  background-color: #f8fafc;
  color: #0f172a;
  font-weight: 700;
  cursor: default;
}

.order-edit-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-edit-footer .order-edit-cancel-btn {
  margin-left: auto;
}

.kpi-value.is-kpi-skeleton {
  color: transparent !important;
  position: relative;
  display: inline-block;
  min-width: 78px;
  height: 1.55rem;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  user-select: none;
}

#gateway-home-section.auth-hydrating #session-banner,
#gateway-home-section.auth-hydrating #role-grid,
#nav-session-box.auth-hydrating {
  display: none !important;
}

.gateway-session-skeleton {
  max-width: 560px;
  margin: 18px auto 0;
  padding: 20px;
  border-radius: 16px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gateway-session-skeleton[hidden] {
  display: none;
}

.gateway-session-skeleton .skeleton-bar {
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.gateway-session-skeleton .skeleton-bar-lg {
  width: 72%;
  height: 20px;
}

.gateway-session-skeleton .skeleton-bar-md {
  width: 48%;
}

.crm-card-clickable {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

.crm-card-clickable:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.crm-detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.crm-stat-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.crm-stat-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.crm-stat-value {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.crm-edit-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.crm-detail-orders-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crm-detail-order-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
}

/* ======================== SAAS CRM DRAWER, STOCK PICKER, SAFE DELETE & PASSWORD ======================== */
.crm-saas-sheet {
  overflow: hidden;
}

.crm-saas-header {
  padding: 18px 22px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.crm-saas-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: var(--primary);
  font-weight: 800;
  font-size: 1.05rem;
  border: 1px solid #bfdbfe;
}

.crm-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 0.72rem;
  font-weight: 700;
}

.crm-saas-phone {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.crm-saas-body {
  padding: 20px 22px;
  background-color: var(--bg);
}

.crm-saas-sheet .crm-detail-stats {
  gap: 12px;
  margin-bottom: 16px;
}

.crm-saas-sheet .crm-stat-card {
  background-color: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
}

.crm-saas-sheet .crm-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.crm-saas-sheet .crm-stat-value {
  font-size: 1.18rem;
  margin-top: 6px;
}

.crm-saas-sheet .crm-edit-card {
  background-color: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.crm-section-head {
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.crm-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.crm-history-block {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.order-stock-picker {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.order-stock-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 210px;
  overflow-y: auto;
}

.order-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
}

.edit-order-remove-btn {
  color: var(--text-muted);
  border-color: transparent;
}

.edit-order-remove-btn:hover {
  background-color: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.edit-order-total-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-order-currency-prefix {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.edit-order-total-input-wrap .form-control {
  max-width: 150px;
  font-weight: 700;
  font-size: 1rem;
  background-color: var(--surface);
}

.pw-forgot-link {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.pw-forgot-link:hover {
  text-decoration: underline;
}

.pw-forgot-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.safe-delete-overlay {
  z-index: 95;
}

.safe-delete-sheet {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
}

.safe-delete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.safe-delete-message {
  margin: 0 0 8px;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.safe-delete-progress-track {
  width: 100%;
  height: 5px;
  border-radius: var(--radius-pill);
  background-color: #e2e8f0;
  overflow: hidden;
}

.safe-delete-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--radius-pill);
  background-color: #dc2626;
}

.safe-delete-footer {
  display: flex;
  gap: 10px;
}

.safe-delete-confirm-btn {
  background-color: #e2e8f0;
  color: #64748b;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  cursor: not-allowed;
}

.safe-delete-confirm-btn.is-ready {
  background-color: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  cursor: pointer;
}

.safe-delete-confirm-btn.is-ready:hover:not(:disabled) {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

/* ======================== PROMOCIONES Y ATAJOS DE TECLADO ======================== */
.promo-config-box {
  padding: 14px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
}

.promo-savings-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
}

.promo-savings-pill.is-invalid {
  background-color: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.promo-badge-inline {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background-color: var(--primary);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.inv-price-old {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-right: 4px;
}

.promo-media-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background-color: #2563eb;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
  margin-left: auto;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.product-price-old {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: line-through;
}

.product-price.is-promo {
  color: var(--primary);
}

.category-tab-promo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: #bfdbfe;
  color: var(--primary);
  background-color: #eff6ff;
}

.category-tab-promo.is-active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.dash-shortcuts-btn {
  display: none;
}

@media (min-width: 768px) {
  .dash-shortcuts-btn {
    display: inline-flex;
  }
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.shortcut-keys {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.2;
}

/* ======================== CABECERA URL TIENDA, RECUPERACIÓN Y RESET ======================== */
.dash-store-url-sub {
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.dash-store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.auth-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.form-success-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.45;
}

.reset-pw-shell {
  min-height: calc(100dvh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 48px;
}

.reset-pw-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 24px;
}

.reset-pw-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 20px;
}

.reset-pw-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  color: var(--primary);
}

.reset-pw-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.reset-pw-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.reset-pw-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.reset-pw-expired-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ======================== CENTRO DE AYUDA Y SOPORTE ======================== */
.support-modal-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.support-modal-sheet {
  width: 100%;
  max-width: 920px;
  max-height: 88vh;
  margin: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.support-modal-header {
  flex-shrink: 0;
  padding: 18px 24px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.support-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.support-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background-color: var(--primary-soft);
  border: 1px solid #bfdbfe;
  color: var(--primary);
}

.support-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background-color: var(--bg);
  overscroll-behavior: contain;
}

.support-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.support-col-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.support-col-head > svg {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--primary);
}

.support-col-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.support-col-head p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.support-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-accordion-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background-color: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.support-accordion-item:hover {
  border-color: #cbd5e1;
}

.support-accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border: none;
  background-color: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.89rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.support-accordion-trigger:hover {
  background-color: #f8fafc;
}

.support-accordion-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.15s ease;
}

.support-accordion-trigger[aria-expanded="true"] .support-accordion-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.support-accordion-panel {
  padding: 12px 16px 14px;
  border-top: 1px solid #e2e8f0;
  background-color: #f8fafc;
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.55;
}

.support-steps-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-form-card {
  padding: 20px;
  border-radius: 12px;
  background-color: var(--surface);
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.support-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.support-form-row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.support-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.support-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.support-input,
.support-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.support-input {
  height: 42px;
  padding: 0 12px;
}

.support-textarea {
  min-height: 112px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

.support-input:focus,
.support-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.support-submit-btn {
  width: 100%;
  min-height: 44px;
  background-color: #2563eb;
  border-color: #2563eb;
  font-weight: 600;
}

.support-submit-btn:hover:not(:disabled) {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.support-btn-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.support-btn-inner[hidden] {
  display: none;
}

.support-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: support-spin 0.7s linear infinite;
}

@keyframes support-spin {
  to {
    transform: rotate(360deg);
  }
}

.support-success-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 24px 18px;
  border-radius: 12px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

.support-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #16a34a;
}

.support-success-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--text);
}

.support-success-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.support-ticket-badge-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid #bfdbfe;
}

.support-ticket-code {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.04em;
}

.support-success-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.support-success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

@media (min-width: 600px) {
  .support-form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 820px) {
  .support-grid {
    grid-template-columns: 1fr 1.08fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .support-modal-overlay {
    padding: 10px;
  }

  .support-modal-sheet {
    max-height: 90vh;
  }

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

  .support-modal-body {
    padding: 16px;
  }

  .support-form-card {
    padding: 16px;
  }
}

/* ======================== UX POLISH: SPINNERS, COPIADO, CONFIRM Y OFFLINE ======================== */
.ux-spin {
  animation: ux-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes ux-spin {
  to {
    transform: rotate(360deg);
  }
}

.is-btn-loading {
  opacity: 0.85;
  cursor: wait !important;
}

.btn.is-copied,
.btn-secondary.is-copied {
  color: #15803d !important;
  border-color: #86efac !important;
  background-color: #f0fdf4 !important;
}

.confirm-modal-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 105;
}

.confirm-modal-overlay .modal-backdrop {
  backdrop-filter: blur(4px);
}

.confirm-modal-sheet {
  width: 100%;
  max-width: 440px;
  margin: auto;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.confirm-modal-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 16px;
}

.confirm-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.confirm-modal-icon.is-primary {
  background-color: var(--primary-soft);
  border-color: #bfdbfe;
  color: var(--primary);
}

.confirm-modal-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--text);
}

.confirm-modal-desc {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.confirm-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.btn-danger-solid {
  background-color: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  font-weight: 600;
}

.btn-danger-solid:hover:not(:disabled) {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 16px;
  background-color: #0f172a;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.offline-banner[hidden] {
  display: none;
}

.offline-banner > svg {
  width: 15px;
  height: 15px;
  color: #fbbf24;
  flex-shrink: 0;
}

body.is-offline {
  padding-top: 36px;
}

/* ==========================================================================
   ACABADOS FINALES: TABULAR NUMS, ONBOARDING CHECKLIST, 404/PAUSA Y RECIBO
   ========================================================================== */
.price-tag,
.price-usd,
.price-bs,
.kpi-value,
.inv-kpi-value,
.cart-btn,
.floating-cart-pill,
.summary-row,
.bs-pill,
.bs-subline,
.order-items-box,
.order-item-row,
.receipt-box,
.receipt-row,
.receipt-amount,
.stock-badge,
.results-count,
.dash-item-price,
.dash-item-stock,
.fin-kpi-value,
.onboarding-pct,
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Checklist de Bienvenida (Onboarding en Panel) */
.onboarding-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.onboarding-card[hidden] {
  display: none;
}

.onboarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.onboarding-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.onboarding-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #2563eb;
}

.onboarding-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

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

.onboarding-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.onboarding-pct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: #eff6ff;
  color: #1d4ed8;
  font-size: 0.8125rem;
  font-weight: 700;
}

.onboarding-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background-color: #e2e8f0;
  overflow: hidden;
  margin-bottom: 16px;
}

.onboarding-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background-color: #2563eb;
  transition: width 0.25s ease;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.onboarding-step:hover {
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.onboarding-step.is-done {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.onboarding-step-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.onboarding-step-check {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background-color: #ffffff;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.onboarding-step.is-done .onboarding-step-check {
  border-color: #16a34a;
  background-color: #16a34a;
  color: #ffffff;
}

.onboarding-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.onboarding-step.is-done .onboarding-step-label {
  text-decoration: line-through;
  opacity: 0.85;
}

.onboarding-step-arrow {
  color: #64748b;
  flex-shrink: 0;
}

.onboarding-step.is-done .onboarding-step-arrow {
  color: #16a34a;
}

@media (max-width: 720px) {
  .onboarding-steps {
    grid-template-columns: 1fr;
  }

  .onboarding-header {
    flex-direction: column;
    align-items: stretch;
  }

  .onboarding-header-actions {
    justify-content: space-between;
  }
}

/* Pantalla dedicada 404 y Tienda Pausada */
.status-page-body {
  min-height: 100vh;
  margin: 0;
  background-color: #f8fafc;
  color: #0f172a;
  font-family: "Inter", "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

.status-page-shell {
  min-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background-color: #f8fafc;
}

.status-page-shell[hidden] {
  display: none;
}

.status-page-card {
  width: 100%;
  max-width: 460px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

.status-page-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.status-page-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.status-page-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-page-code {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}

.status-page-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.status-page-desc {
  margin: 0 0 24px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #475569;
}

.status-page-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Recibo Visual de Pedido + Respaldo WhatsApp */
.receipt-summary-card {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receipt-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.8125rem;
}

.receipt-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receipt-meta-label {
  color: #64748b;
  font-size: 0.75rem;
}

.receipt-meta-value {
  color: #0f172a;
  font-weight: 600;
}

.receipt-totals-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
}

.receipt-totals-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.receipt-totals-values {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receipt-total-usd {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.receipt-total-bs {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
}

.receipt-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.receipt-wa-btn {
  background-color: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.receipt-wa-btn:hover:not(:disabled) {
  background-color: #15803d;
  border-color: #15803d;
}

/* ==========================================================================
   SEGUIMIENTO DE PEDIDO FLOTANTE + HILO DE RESPUESTA DIRECTA
   ========================================================================== */
.floating-order-pill {
  position: fixed;
  left: 16px;
  bottom: 20px;
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background-color: #0f172a;
  color: #ffffff;
  border: 1px solid #1e293b;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.floating-order-pill[hidden] {
  display: none;
}

.floating-order-pill:hover {
  transform: translateY(-1px);
  background-color: #1e293b;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}

.floating-order-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-color: #ef4444;
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.28);
  flex-shrink: 0;
}

.floating-order-dot[hidden] {
  display: none;
}

@media (max-width: 768px) {
  body.has-bottom-nav .floating-order-pill {
    left: 12px;
    bottom: 84px;
    padding: 9px 14px;
    font-size: 0.8125rem;
  }
}

.order-thread-card {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #0f172a;
}

.order-thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 2px;
}

.order-thread-list--compact {
  max-height: 150px;
}

.order-thread-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.45;
}

.order-thread-msg {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  font-size: 0.84rem;
}

.order-thread-msg.is-merchant {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  align-self: flex-start;
  max-width: 92%;
}

.order-thread-msg.is-customer {
  background-color: #ffffff;
  border-color: #e2e8f0;
  align-self: flex-end;
  max-width: 92%;
}

.order-thread-msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
  font-size: 0.75rem;
  color: #64748b;
}

.order-thread-msg-meta strong {
  color: #0f172a;
  font-weight: 600;
}

.order-thread-msg-body {
  margin: 0;
  color: #0f172a;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.order-thread-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-thread-form .form-control {
  flex: 1;
  min-width: 0;
}

/* Barra rápida, resumen de entregados y paginación en Pedidos */
.orders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.orders-quick-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.orders-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.orders-tab-btn:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.orders-tab-btn.is-active {
  background-color: #2563eb;
  color: #ffffff;
}

.orders-tab-count {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background-color: #f1f5f9;
  color: #0f172a;
}

.orders-tab-btn.is-active .orders-tab-count {
  background-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.orders-subfilter-select {
  width: auto;
  min-width: 170px;
  max-width: 210px;
  min-height: 38px;
}

.orders-subfilter-select[hidden] {
  display: none;
}

.orders-delivered-summary {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orders-delivered-summary[hidden] {
  display: none;
}

.orders-delivered-metrics {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.orders-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.orders-summary-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
}

.orders-summary-amounts {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.orders-summary-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

.orders-summary-bs {
  font-size: 0.82rem;
  font-weight: 600;
  color: #2563eb;
  white-space: nowrap;
}

.orders-delivered-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.orders-date-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

.orders-date-pill {
  padding: 5px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.orders-date-pill:hover {
  color: #0f172a;
}

.orders-date-pill.is-active {
  background-color: #eff6ff;
  color: #2563eb;
}

.orders-search-wrap {
  position: relative;
  flex: 1 1 220px;
  max-width: 300px;
  min-width: 0;
}

.orders-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.orders-search-input {
  padding-left: 32px;
  min-height: 36px;
  font-size: 0.84rem;
}

.orders-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.orders-pagination[hidden] {
  display: none;
}

/* Caja de respuesta colapsable en el Panel del Vendedor */
.order-reply-box {
  margin-top: 10px;
  padding: 0;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.order-reply-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.order-reply-toggle:hover {
  background-color: #f1f5f9;
}

.order-reply-chevron {
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.order-reply-box.is-open .order-reply-chevron {
  transform: rotate(180deg);
}

.order-reply-body {
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-reply-body[hidden] {
  display: none;
}

.order-reply-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
}

.btn-deliver-quick {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-weight: 700;
}

.btn-deliver-quick:hover:not(:disabled) {
  background-color: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.order-reply-input-row,
.order-reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-reply-input-row .form-control {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 38px;
}

.order-reply-input-row .btn {
  min-height: 38px;
  white-space: nowrap;
}

.order-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-quick-actions .btn,
.order-quick-actions .icon-btn {
  min-height: 34px;
}

.order-status-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.order-status-select-wrap .form-control {
  min-height: 34px;
  padding: 4px 10px;
  width: auto;
  font-size: 0.82rem;
}

/* Jerarquía estricta de capas para modales del panel */
#crm-customer-modal {
  z-index: 90;
}

#order-edit-modal {
  z-index: 95;
}

.safe-delete-overlay,
.confirm-modal-overlay {
  z-index: 105;
}

.order-edit-sheet .modal-body {
  padding: 16px 20px;
}

#order-edit-form.stack-form {
  gap: 12px;
}

/* ==========================================================================
   RECUPERACIÓN OTP (6 DÍGITOS) + MEDIDOR DE CONTRASEÑA + SEGURIDAD DE CUENTA
   ========================================================================== */
.otp-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.otp-step-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.otp-step-pill.is-active {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.otp-step-pill.is-done {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.otp-email-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 14px;
}

.otp-email-label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
}

.otp-email-value {
  display: block;
  font-size: 0.875rem;
  color: #0f172a;
  word-break: break-all;
}

.otp-inputs-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.otp-digit-input {
  width: 100%;
  height: 50px;
  padding: 0;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background-color: #ffffff;
  color: #0f172a;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (max-width: 480px) {
  .otp-inputs-grid {
    gap: 4px;
  }

  .otp-digit-input {
    height: 46px;
    font-size: 1.1rem;
    border-radius: 8px;
  }
}

.otp-digit-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.otp-resend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-input-wrap .form-control {
  padding-right: 42px;
}

.pw-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pw-toggle-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.pw-strength-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pw-strength-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
}

.pw-strength-title {
  color: #475569;
  font-weight: 600;
}

.pw-strength-label {
  font-weight: 700;
  color: #64748b;
}

.pw-strength-label.is-weak {
  color: #dc2626;
}

.pw-strength-label.is-medium {
  color: #d97706;
}

.pw-strength-label.is-strong {
  color: #16a34a;
}

.pw-strength-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.pw-strength-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background-color: #94a3b8;
  transition: width 0.2s ease, background-color 0.2s ease;
}

.pw-strength-bar-fill.is-weak {
  background-color: #ef4444;
}

.pw-strength-bar-fill.is-medium {
  background-color: #f59e0b;
}

.pw-strength-bar-fill.is-strong {
  background-color: #16a34a;
}

.pw-req-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.pw-req-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: #64748b;
}

.pw-req-item.is-met {
  color: #166534;
  font-weight: 600;
}

.security-subsection {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid #e2e8f0;
}

.security-subsection:first-of-type {
  padding-top: 4px;
  margin-top: 4px;
  border-top: none;
}

.security-subsection-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.security-sessions-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.security-email-card {
  margin: 12px 0 6px;
  padding: 12px 14px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.security-email-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.security-email-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.security-email-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex-shrink: 0;
}

.security-email-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.security-email-value {
  font-size: 0.94rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.security-email-note {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #64748b;
}

.security-email-card + .security-subsection {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   ASISTENTE DE IA POR TIENDA (BYOK PLAN PRO) + PAUSA POR CHAT + PLANES
   ========================================================================== */
.pro-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.pro-mini-badge[hidden] {
  display: none;
}

.plan-card.is-coming-soon {
  opacity: 0.88;
}

.ai-locked-card {
  margin-top: 12px;
  padding: 26px 20px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ai-locked-card[hidden] {
  display: none;
}

.ai-locked-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.ai-locked-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
}

.ai-locked-desc {
  margin: 0 0 16px;
  max-width: 460px;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
}

.ai-locked-bullets {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  width: 100%;
  max-width: 440px;
}

.ai-locked-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: #0f172a;
  font-weight: 500;
}

.ai-locked-bullets svg {
  color: #2563eb;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-master-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.ai-master-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-master-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ai-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.ai-status-pill.is-active {
  background-color: #dcfce7;
  color: #166534;
}

.ai-status-pill.is-paused {
  background-color: #f1f5f9;
  color: #475569;
}

.ai-accordions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-accordion {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background-color: #ffffff;
  overflow: hidden;
}

.ai-accordion-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  background-color: #ffffff;
  transition: background-color 0.15s ease;
}

.ai-accordion-summary::-webkit-details-marker {
  display: none;
}

.ai-accordion-summary:hover {
  background-color: #f8fafc;
}

.ai-accordion-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.ai-accordion-title svg {
  color: #2563eb;
  flex-shrink: 0;
}

.ai-accordion-chevron {
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.ai-accordion[open] .ai-accordion-chevron {
  transform: rotate(180deg);
}

.ai-accordion-body {
  padding: 14px 16px 16px;
  border-top: 1px solid #e2e8f0;
}

.ai-conn-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-conn-status-bar {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: #0f172a;
  font-size: 0.82rem;
  line-height: 1.4;
}

.ai-conn-status-bar[hidden] {
  display: none;
}

.ai-conn-status-bar.is-ok {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.ai-conn-status-bar.is-warn {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.ai-conn-status-bar.is-error {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.ai-conn-status-bar.is-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.ai-conn-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-conn-status-content {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ai-conn-status-msg {
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-conn-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background-color: #ffffff;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.ai-conn-retry-btn:hover {
  background-color: #f8fafc;
  opacity: 0.92;
}

.ai-role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ai-role-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.ai-role-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ai-role-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background-color: #f8fafc;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ai-role-inner strong {
  font-size: 0.85rem;
  color: #0f172a;
}

.ai-role-inner span {
  font-size: 0.77rem;
  color: #64748b;
  line-height: 1.4;
}

.ai-role-card input:checked + .ai-role-inner {
  border-color: #2563eb;
  background-color: #eff6ff;
}

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

.ai-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

.ai-switch-title {
  display: block;
  font-size: 0.86rem;
  color: #0f172a;
}

.ai-sim-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-sim-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-sim-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.ai-sim-chip:hover {
  border-color: #2563eb;
  background-color: #eff6ff;
  color: #2563eb;
}

.ai-sim-messages {
  min-height: 170px;
  max-height: 290px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-sim-msg {
  display: flex;
}

.ai-sim-msg.is-user {
  justify-content: flex-end;
}

.ai-sim-msg.is-ai {
  justify-content: flex-start;
}

.ai-sim-bubble {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-sim-msg.is-user .ai-sim-bubble {
  background-color: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-sim-msg.is-ai .ai-sim-bubble {
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.ai-sim-bubble.is-typing {
  color: #64748b;
  font-style: italic;
}

.ai-sim-handoff-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: #fef3c7;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 700;
}

.ai-sim-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-sim-form .form-control {
  flex: 1;
  min-width: 0;
}

.ai-footer-save {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* Badges y botón Pausa IA en Mensajes */
.chat-ai-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.chat-header-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-header-ai-btn.is-paused {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

.chat-header-ai-btn.is-resume {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.chat-header-ai-btn.is-resume:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.chat-header-human-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background-color: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-header-human-badge[hidden] {
  display: none;
}

.chat-header-ai-btn[hidden] {
  display: none;
}

.chat-thread-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.chat-thread-menu-item:hover {
  background-color: #f8fafc;
}

.chat-thread-menu-item[hidden] {
  display: none;
}

.chat-thread-ai-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-thread-ai-pill.is-paused {
  background-color: #f1f5f9;
  color: #475569;
}

.chat-thread-ai-pill.is-human {
  background-color: #fef3c7;
  color: #92400e;
}

.chat-thread-ai-pill.is-error {
  background-color: #fef2f2;
  color: #b91c1c;
}

.chat-ai-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: #334155;
}

.chat-ai-status-banner[hidden] {
  display: none;
}

.chat-ai-status-banner.is-warn {
  background-color: #fffbeb;
  border-bottom-color: #fde68a;
  color: #92400e;
}

.chat-ai-status-banner.is-error {
  background-color: #fef2f2;
  border-bottom-color: #fecaca;
  color: #991b1b;
}

.chat-ai-status-banner.is-human {
  background-color: #fffbeb;
  border-bottom-color: #fcd34d;
  color: #92400e;
}

.chat-ai-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-ai-banner-btn.is-primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.chat-ai-banner-btn.is-primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.order-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.order-schedule-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 0.8rem;
  line-height: 1.3;
  flex-wrap: wrap;
}

.order-schedule-chip svg {
  color: #2563eb;
  flex-shrink: 0;
}

.chat-ai-banner-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 220px;
}

.chat-ai-banner-text i,
.chat-ai-banner-text svg {
  flex-shrink: 0;
}

.chat-ai-banner-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-ai-banner-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.chat-ai-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background-color: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 0.82rem;
  font-weight: 500;
}

.chat-ai-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-ai-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background-color: #94a3b8;
  animation: loclip-ai-dot-pulse 1.2s infinite ease-in-out;
}

.chat-ai-typing-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.chat-ai-typing-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes loclip-ai-dot-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* ==========================================================================
   RENDIMIENTO SPA, CABECERA COMPACTA, SOPORTE SÓLIDO Y USABILIDAD MÓVIL
   ========================================================================== */
.whitespace-nowrap {
  white-space: nowrap;
}

/* 1. Modal Centro de Ayuda y Soporte con fondo blanco sólido y capa superior */
.support-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 200 !important;
  isolation: isolate;
}

.support-modal-overlay[hidden] {
  display: none !important;
}

.support-modal-overlay .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: rgba(15, 23, 42, 0.62) !important;
  backdrop-filter: blur(4px);
}

.support-modal-sheet,
.support-modal-header,
.support-modal-body {
  position: relative;
  z-index: 2;
  background-color: #ffffff !important;
  opacity: 1 !important;
}

.support-modal-body {
  background-color: #f8fafc !important;
}

/* 2. Portada simplificada con sesión iniciada */
.session-banner.is-primary-hero-card {
  padding: 20px 22px;
  border-color: #bfdbfe;
  background-color: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 24px;
}

/* 3. Cabecera de Tienda instantánea, skeletons y fila horizontal móvil */
.dash-store-logo-fallback {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-store-logo-fallback[hidden],
.dash-store-logo[hidden],
.dash-store-skeleton[hidden] {
  display: none;
}

.dash-store-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-store-card.is-loading .dash-store-title-row,
.dash-store-card.is-loading .dash-store-meta-text,
.dash-store-card.is-loading .dash-store-actions {
  display: none;
}

.dash-store-actions .label-mobile {
  display: none;
}

@media (max-width: 900px) {
  .dash-body .top-nav #logout-btn {
    display: none;
  }
}

@media (max-width: 640px) {
  .dash-store-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .dash-store-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .dash-store-logo,
  .dash-store-logo-fallback {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .dash-store-card .store-name {
    font-size: 1rem;
    line-height: 1.25;
  }

  .dash-store-meta-text,
  .dash-store-url-sub {
    display: none !important;
  }

  .dash-store-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .dash-store-actions > * {
    width: 100%;
    padding: 7px 8px;
    font-size: 0.78rem;
    min-height: 36px;
    justify-content: center;
    white-space: nowrap;
  }

  .dash-store-actions > :last-child {
    grid-column: auto;
  }

  .dash-store-actions .label-desktop {
    display: none;
  }

  .dash-store-actions .label-mobile {
    display: inline;
  }
}

/* 4. Sub-pestañas limpias en Configuración */
.settings-subtabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: 14px;
}

.settings-subtabs::-webkit-scrollbar {
  display: none;
}

.settings-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #475569;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.settings-subtab:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}

.settings-subtab.is-active {
  background-color: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

/* 5. KPIs compactos en Catálogo móvil */
@media (max-width: 640px) {
  .kpi-grid--compact {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
  }

  .kpi-grid--compact .kpi-card {
    padding: 8px 6px;
    border-radius: 10px;
    gap: 2px;
  }

  .kpi-grid--compact .kpi-label {
    font-size: 0.66rem;
    line-height: 1.15;
    justify-content: center;
    text-align: center;
  }

  .kpi-grid--compact .kpi-label svg {
    display: none;
  }

  .kpi-grid--compact .kpi-value {
    font-size: 0.88rem;
    text-align: center;
  }
}

/* 6. Mensajes SPA dentro del Panel (móvil + desktop) */
.chat-mobile-back-btn {
  display: none;
}

.chat-threads-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-threads-pane-header {
  display: none;
}

.chat-threads-pane-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.chat-threads-count {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background-color: #f1f5f9;
  color: #475569;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background-color: #e2e8f0;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chat-thread-avatar--sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.chat-thread-item.is-active .chat-thread-avatar {
  background-color: #dbeafe;
  color: #2563eb;
}

.chat-thread-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-thread-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-thread-preview {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-thread-unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background-color: #2563eb;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-active-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.chat-active-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

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

#panel-messages .chat-thread-list,
#panel-messages .chat-messages {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

#panel-messages .chat-thread-list:hover,
#panel-messages .chat-messages:hover {
  scrollbar-color: #cbd5e1 transparent;
}

#panel-messages .chat-thread-list::-webkit-scrollbar,
#panel-messages .chat-messages::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

#panel-messages .chat-thread-list::-webkit-scrollbar-track,
#panel-messages .chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#panel-messages .chat-thread-list::-webkit-scrollbar-thumb,
#panel-messages .chat-messages::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

#panel-messages .chat-thread-list:hover::-webkit-scrollbar-thumb,
#panel-messages .chat-messages:hover::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

#panel-messages .chat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  box-shadow: none;
  gap: 4px;
}

#panel-messages .chat-bubble.is-incoming,
#panel-messages .chat-bubble.is-merchant {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

#panel-messages .chat-bubble.is-outgoing,
#panel-messages .chat-bubble.is-customer {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: none;
}

#panel-messages .chat-bubble-meta {
  font-size: 0.68rem;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
}

#panel-messages .chat-send-form {
  margin-top: 0;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 5px 6px 5px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

#panel-messages .chat-send-form:focus-within {
  background-color: #ffffff;
  border-color: #2563eb;
}

#panel-messages .chat-tool-btn {
  width: 34px;
  height: 34px;
  background-color: transparent;
  border: none;
  color: #64748b;
  border-radius: 9px;
}

#panel-messages .chat-tool-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

#panel-messages .chat-send-form input[type="text"] {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 6px 8px;
  font-size: 0.9rem;
}

#panel-messages .chat-send-form input[type="text"]:focus {
  outline: none;
  box-shadow: none;
}

#panel-messages .chat-send-form button[type="submit"] {
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.chat-bubble-row.is-outgoing .chat-msg-actions {
  order: -1;
}

.chat-bubble-row:hover .chat-msg-actions,
.chat-bubble-row.is-actions-visible .chat-msg-actions,
.chat-bubble-row:focus-within .chat-msg-actions {
  opacity: 1;
}

.chat-msg-actions .chat-reply-trigger {
  opacity: 1;
  order: 0;
}

.chat-delete-trigger {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background-color: var(--surface);
  border: 1px solid var(--border);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.chat-delete-trigger:hover,
.chat-delete-trigger:focus-visible {
  color: #dc2626;
  background-color: #fef2f2;
  border-color: #fecaca;
}

.chat-delete-trigger svg,
.chat-reply-trigger svg {
  width: 14px;
  height: 14px;
}

.chat-header-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-header-delete-btn:hover {
  background-color: #fee2e2;
  border-color: #fca5a5;
}

@media (max-width: 520px) {
  .chat-header-delete-btn span {
    display: none;
  }
}

.chat-thread-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 10px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.chat-thread-row.is-active {
  background-color: var(--primary-soft);
  border-color: var(--primary);
}

.chat-thread-row .chat-thread-item {
  flex: 1;
  min-width: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.chat-thread-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-right: 6px;
  flex-shrink: 0;
}

.chat-thread-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chat-thread-menu-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.chat-thread-menu {
  position: absolute;
  right: 6px;
  top: calc(100% + 4px);
  z-index: 25;
  min-width: 190px;
  padding: 4px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.chat-thread-menu[hidden] {
  display: none;
}

.chat-thread-menu-delete {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.chat-thread-menu-delete:hover {
  background-color: #fef2f2;
}

@media (min-width: 821px) {
  html.dash-messages-active,
  body.dash-messages-active {
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 0 !important;
  }

  body.dash-messages-active .dash-shell {
    height: calc(100dvh - 65px);
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
  }

  body.dash-messages-active .dash-main {
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.dash-messages-active #panel-messages:not([hidden]) {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.dash-messages-active #panel-messages > .finance-header-row {
    display: none;
  }

  body.dash-messages-active #panel-messages .chat-inbox-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff;
  }

  body.dash-messages-active #panel-messages .chat-threads-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    border-right: 1px solid #e2e8f0;
    background-color: #ffffff;
  }

  body.dash-messages-active #panel-messages .chat-threads-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    height: 56px;
    padding: 0 18px;
    border-bottom: 1px solid #e2e8f0;
  }

  body.dash-messages-active #panel-messages .chat-thread-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
    gap: 2px;
  }

  body.dash-messages-active #panel-messages .chat-thread-row {
    border: none;
    box-shadow: none;
    background-color: transparent;
    border-radius: 10px;
  }

  body.dash-messages-active #panel-messages .chat-thread-row:hover {
    background-color: #f8fafc;
  }

  body.dash-messages-active #panel-messages .chat-thread-row.is-active {
    background-color: #eff6ff;
  }

  body.dash-messages-active #panel-messages .chat-thread-item {
    border: none;
    box-shadow: none;
    border-radius: 10px;
    background-color: transparent;
    padding: 10px 6px 10px 12px;
    gap: 10px;
  }

  body.dash-messages-active #panel-messages .chat-window-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background-color: #f8fafc;
  }

  body.dash-messages-active #panel-messages #chat-empty-thread:not([hidden]) {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    box-shadow: none;
    margin: 0;
  }

  body.dash-messages-active #panel-messages #chat-active-window:not([hidden]) {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.dash-messages-active #panel-messages .chat-active-header {
    flex-shrink: 0;
    height: 56px;
    padding: 0 20px;
    margin-bottom: 0;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
  }

  body.dash-messages-active #panel-messages .chat-messages {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    border: none;
    border-radius: 0;
    background-color: #f8fafc;
    padding: 20px 24px;
    gap: 8px;
  }

  body.dash-messages-active #panel-messages .chat-composer-wrap {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 20px;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
  }
}

@media (max-width: 820px) {
  .chat-mobile-back-btn {
    display: inline-flex;
  }

  #panel-messages .chat-window-card {
    display: none;
  }

  #panel-messages.is-chat-open .chat-threads-pane {
    display: none;
  }

  #panel-messages.is-chat-open .chat-window-card {
    display: block;
  }

  #panel-messages .chat-messages {
    max-height: 46dvh;
  }
}

/* 7. Botón Salir en menú Más */
.dash-more-item--danger {
  color: #dc2626;
  border-color: #fecaca;
  background-color: #fef2f2;
  margin-top: 6px;
}

.dash-more-item--danger:hover {
  background-color: #fee2e2;
}

/* ==========================================================================
   TIENDA PÚBLICA Y DETALLE INSTANTÁNEO (0 CHOCANTES, 3 TABS, BANNER, CARRITO)
   ========================================================================== */
.store-banner-wrap {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 52%, #1e3a8a 100%);
}

.store-banner[hidden],
.store-logo[hidden],
.store-logo-fallback[hidden] {
  display: none;
}

.store-logo-fallback {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background-color: #0f172a;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.store-logo-fallback--sm {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .store-logo-fallback {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    font-size: 1.15rem;
  }
}

.store-last-order-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background-color: #ffffff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.store-last-order-banner[hidden] {
  display: none;
}

.store-last-order-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.store-last-order-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background-color: #eff6ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.store-last-order-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.store-last-order-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.store-last-order-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.store-last-order-sub {
  font-size: 0.78rem;
  color: #64748b;
  white-space: normal;
  line-height: 1.3;
  word-break: break-word;
}

.bottom-nav-badge[hidden] {
  display: none !important;
}

.bottom-nav-item.is-busy {
  opacity: 0.72;
  pointer-events: none;
}

.bottom-order-dot,
.store-last-order-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background-color: #ef4444;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
  flex-shrink: 0;
}

.bottom-order-dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
}

.bottom-order-dot[hidden],
.store-last-order-dot[hidden] {
  display: none;
}

.bottom-nav--3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bottom-nav--3 .bottom-nav-item {
  position: relative;
}

.checkout-safety-notice--inline {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.checkout-sticky-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
}

.checkout-sticky-total-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #475569;
}

.checkout-sticky-total-values {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.checkout-sticky-total-usd {
  font-size: 1.08rem;
  font-weight: 800;
  color: #0f172a;
}

.checkout-sticky-total-bs {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

/* Modal Detalle de Producto instantáneo en página */
.pd-modal-gallery {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.pd-modal-main-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 280px;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pd-modal-main-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pd-modal-thumbs {
  display: flex;
  gap: 8px;
  padding: 8px;
  overflow-x: auto;
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.pd-modal-thumbs:empty {
  display: none;
}

.pd-modal-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 0;
  overflow: hidden;
  background-color: #f8fafc;
  cursor: pointer;
  flex-shrink: 0;
}

.pd-modal-thumb.is-active {
  border-color: #2563eb;
}

.pd-modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   AJUSTES EXCLUSIVOS PARA MÓVIL (max-width: 767px) — PANEL VENDEDOR
   ========================================================================== */
.chat-header-mobile-menu-wrap,
.settings-mobile-bar {
  display: none;
}

@media (max-width: 767px) {
  /* 1. Chat móvil: pantalla completa adaptada al teclado virtual + Enviar siempre visible */
  body.dash-mobile-chat-open.dash-messages-active {
    overflow: hidden;
    padding-bottom: 0;
  }

  body.dash-mobile-chat-open.dash-messages-active .top-nav,
  body.dash-mobile-chat-open.dash-messages-active #dash-bottom-nav {
    display: none !important;
  }

  body.dash-mobile-chat-open.dash-messages-active .dash-main {
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  #panel-messages.is-chat-open {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  #panel-messages.is-chat-open > .finance-header-row {
    display: none;
  }

  #panel-messages.is-chat-open .chat-inbox-layout {
    position: fixed;
    top: var(--chat-vv-top, 0px);
    left: 0;
    right: 0;
    z-index: 55;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: var(--chat-vv-height, 100dvh);
    background-color: #f8fafc;
    overflow: hidden;
  }

  #panel-messages.is-chat-open .chat-window-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    background-color: #f8fafc;
  }

  #panel-messages.is-chat-open #chat-active-window:not([hidden]) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  #panel-messages .chat-active-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    margin: 0;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.chat-keyboard-open #panel-messages .chat-active-header {
    padding-top: 10px;
  }

  #panel-messages .chat-active-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  #panel-messages .chat-mobile-back-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
  }

  #panel-messages .chat-mobile-back-btn span {
    display: none;
  }

  #panel-messages .chat-active-name {
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #panel-messages #chat-delete-thread-btn {
    display: none;
  }

  #panel-messages .chat-header-mobile-menu-wrap {
    display: inline-flex;
    position: relative;
    flex-shrink: 0;
  }

  .chat-header-more-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }

  .chat-header-more-btn:hover {
    background-color: #f8fafc;
  }

  #panel-messages.is-chat-open .chat-messages {
    flex: 1;
    min-height: 0;
    max-height: none;
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: none;
    border-radius: 0;
    padding: 14px 12px;
    box-sizing: border-box;
  }

  #panel-messages.is-chat-open .chat-composer-wrap {
    flex-shrink: 0;
    margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.chat-keyboard-open #panel-messages.is-chat-open .chat-composer-wrap {
    padding-bottom: 8px;
  }

  #panel-messages .chat-send-form {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 5px 4px 6px;
    box-sizing: border-box;
  }

  #panel-messages .chat-tool-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  #panel-messages .chat-send-form input[type="text"] {
    min-width: 0;
    flex: 1;
    width: 0;
    font-size: 0.88rem;
    padding: 6px;
  }

  #panel-messages .chat-send-form button[type="submit"] {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  /* 2. Configuración móvil: menú de tres puntos sin scroll horizontal */
  #settings-subtabs {
    display: none;
  }

  .settings-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 14px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .settings-mobile-current {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .settings-mobile-current-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background-color: #eff6ff;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .settings-mobile-current-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .settings-mobile-menu-wrap {
    position: relative;
    flex-shrink: 0;
  }

  .settings-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 34px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
  }

  .settings-mobile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 210px;
    padding: 6px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .settings-mobile-menu[hidden] {
    display: none;
  }

  .settings-mobile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #0f172a;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }

  .settings-mobile-menu-item:hover {
    background-color: #f8fafc;
  }

  .settings-mobile-menu-item.is-active {
    background-color: #eff6ff;
    color: #2563eb;
  }

  .settings-mobile-check {
    margin-left: auto;
    color: #2563eb;
    opacity: 0;
  }

  .settings-mobile-menu-item.is-active .settings-mobile-check {
    opacity: 1;
  }

  /* 3a. Modal Editar Pedido: filas de producto en bloque de 2 filas */
  .edit-order-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    row-gap: 10px;
    column-gap: 10px;
    padding: 10px 12px;
  }

  .edit-order-item-info {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .edit-order-item-row .edit-order-remove-btn {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .edit-order-item-row .qty-stepper {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .edit-order-item-subtotal {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    text-align: right;
    font-weight: 700;
    min-width: 0 !important;
  }

  /* 3b. Modal Ver Ficha: botón Enviar mensaje ancho completo debajo */
  #crm-customer-modal .crm-saas-header {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  #crm-customer-modal .crm-saas-identity {
    padding-right: 40px;
  }

  #crm-customer-modal .crm-saas-header-actions {
    width: 100%;
    display: block;
  }

  #crm-customer-modal .crm-saas-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
  }

  #crm-detail-chat-btn {
    width: 100%;
    justify-content: center;
  }

  /* 3c. Footer Modal Editar Pedido móvil: Guardar cambios arriba + Cancelar/Eliminar lado a lado */
  .order-edit-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .order-edit-footer #save-order-edit-btn {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    justify-content: center;
  }

  .order-edit-footer .order-edit-cancel-btn {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .order-edit-footer #delete-order-modal-btn {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    justify-content: center;
  }

  /* 4. Barra de Pedidos, resumen de entregados y controles en móvil */
  .orders-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .orders-quick-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    box-sizing: border-box;
  }

  .orders-tab-btn {
    padding: 7px 4px;
    font-size: 0.78rem;
    gap: 4px;
  }

  .orders-subfilter-select {
    width: 100%;
    max-width: 100%;
  }

  .orders-delivered-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .orders-delivered-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .orders-date-pills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    box-sizing: border-box;
  }

  .orders-date-pill {
    text-align: center;
  }

  .orders-search-wrap {
    width: 100%;
    max-width: 100%;
  }

  /* 5. Asistente IA y control de chat en móvil */
  #panel-messages #chat-ai-toggle-btn {
    display: none;
  }

  .ai-role-grid {
    grid-template-columns: 1fr;
  }

  .ai-footer-save .btn {
    width: 100%;
    justify-content: center;
  }
}

.ai-key-saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  margin-top: 6px;
  border-radius: 8px;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  word-break: break-word;
}

.ai-key-saved-badge[hidden] {
  display: none;
}

.ai-dirty-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.ai-dirty-bar[hidden] {
  display: none;
}

.ai-dirty-bar-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

.btn.is-unsaved-highlight {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
