/* ═══════════════════════════════════════════════════════════
   FARMACODOSIS 2.0 — DESIGN SYSTEM
   Colores: Azul #0A2463 / Naranja #FF6B2B
═══════════════════════════════════════════════════════════ */

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

:root {
  /* Palette principal */
  --blue-900: #040f2b;
  --blue-800: #0A2463;
  --blue-700: #1337A0;
  --blue-600: #1a4bc4;
  --blue-500: #2563eb;
  --blue-400: #3b82f6;
  --blue-200: #bfdbfe;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;

  --orange-600: #c2410c;
  --orange-500: #FF6B2B;
  --orange-400: #fb923c;
  --orange-300: #fdba74;
  --orange-100: #ffedd5;
  --orange-50:  #fff7ed;

  /* Neutros */
  --gray-950: #030712;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white:    #ffffff;

  /* Semánticos */
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     var(--blue-500);

  /* Sombras */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.18);
  --shadow-blue: 0 8px 32px rgba(10,36,99,.25);
  --shadow-orange: 0 8px 32px rgba(255,107,43,.30);

  /* Radios */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transiciones */
  --transition: all .25s cubic-bezier(.4,0,.2,1);
  --transition-fast: all .15s ease;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Tipografía ── */
h1,h2,h3,h4,h5,h6 { font-family: 'Outfit', sans-serif; line-height: 1.2; font-weight: 700; }

/* ── Utilidades ── */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 2rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; } .gap-4 { gap: 2rem; }
.grid { display: grid; }
.mt-1{margin-top:.5rem} .mt-2{margin-top:1rem} .mt-3{margin-top:1.5rem} .mt-4{margin-top:2rem}
.mb-1{margin-bottom:.5rem} .mb-2{margin-bottom:1rem} .mb-3{margin-bottom:1.5rem}

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.5rem; border-radius: var(--radius-md);
  font-weight: 600; font-size: .9rem; transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--orange-500); color: var(--white);
  box-shadow: var(--shadow-orange);
}
.btn-primary:hover { background: var(--orange-600); transform: translateY(-2px); box-shadow: 0 12px 36px rgba(255,107,43,.4); }

.btn-secondary {
  background: var(--blue-800); color: var(--white);
  box-shadow: var(--shadow-blue);
}
.btn-secondary:hover { background: var(--blue-700); transform: translateY(-2px); }

.btn-outline {
  border: 2px solid var(--blue-800); color: var(--blue-800); background: transparent;
}
.btn-outline:hover { background: var(--blue-800); color: var(--white); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #059669; }

.btn-sm { padding: .4rem 1rem; font-size: .8rem; }
.btn-lg { padding: .9rem 2.2rem; font-size: 1rem; }

/* ── Inputs ── */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-weight: 600; font-size: .875rem; color: var(--gray-700); }
.form-control {
  padding: .7rem 1rem; border: 2px solid var(--gray-200);
  border-radius: var(--radius-md); font-family: inherit; font-size: .9rem;
  color: var(--gray-800); background: var(--white);
  transition: var(--transition);
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }

/* ── Cards ── */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1.05rem; color: var(--blue-800); }
.card-body { padding: 1.5rem; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; padding: .25rem .75rem;
  border-radius: var(--radius-full); font-size: .75rem; font-weight: 700;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: var(--blue-100); color: var(--blue-800); }
.badge-orange  { background: var(--orange-100); color: var(--orange-600); }
.badge-gray    { background: var(--gray-100); color: var(--gray-700); }

/* ── Alertas ── */
.alert {
  padding: 1rem 1.25rem; border-radius: var(--radius-md);
  font-size: .9rem; font-weight: 500; margin-bottom: 1rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--blue-100); color: var(--blue-800); border-left: 4px solid var(--blue-500); }

/* ── Tablas ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }
.table {
  width: 100%; border-collapse: collapse; font-size: .875rem;
}
.table th {
  background: var(--blue-800); color: var(--white);
  padding: .9rem 1rem; text-align: left; font-weight: 600;
  white-space: nowrap;
}
.table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--gray-100); }
.table tr:hover td { background: var(--blue-50); }
.table tr:last-child td { border-bottom: none; }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(4,15,43,.7); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn .3s cubic-bezier(.4,0,.2,1);
}
.modal-header {
  padding: 1.5rem; border-bottom: 2px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { color: var(--blue-800); }
.modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100); color: var(--gray-600);
  font-size: 1.2rem; transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: var(--white); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 2px solid var(--gray-100);
  display: flex; gap: 1rem; justify-content: flex-end;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Sidebar ── */
.sidebar {
  width: 260px; height: 100vh; background: var(--blue-900);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,.3);
}
.sidebar-logo {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.sidebar-logo img {
  width: 250px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  transform: scale(1.5);
  transform-origin: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.sidebar-nav {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 0.5rem 1rem; display: flex; flex-direction: column; gap: .25rem;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.nav-section-title {
  color: rgba(255,255,255,.35); font-size: .7rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 0.5rem .75rem .25rem;
}
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-radius: var(--radius-md);
  color: rgba(255,255,255,.65); font-size: .9rem; font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav-link.active {
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: var(--white); box-shadow: var(--shadow-orange);
}
.nav-link .icon { 
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0;
}
.nav-link .icon svg { width: 100%; height: 100%; fill: currentColor; }

/* Dropdown Sidebar */
.nav-dropdown {
  display: flex; flex-direction: column; gap: 0.15rem;
  overflow: hidden; transition: max-height 0.3s ease;
  padding-left: 1rem; flex-shrink: 0;
}
.nav-dropdown.closed { max-height: 0; }
.nav-dropdown .nav-link { font-size: 0.85rem; padding: 0.6rem 1rem; }
.nav-dropdown-toggle { cursor: pointer; justify-content: space-between; }
.nav-dropdown-toggle .arrow { font-size: 0.7rem; transition: transform 0.3s; }
.nav-dropdown-toggle.active .arrow { transform: rotate(90deg); }

.sidebar-footer {
  padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.user-card {
  background: rgba(255,255,255,.06); border-radius: var(--radius-md);
  padding: .9rem 1rem; display: flex; align-items: center; gap: .75rem;
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-500), var(--blue-600));
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-info .name {
  color: var(--white); font-size: .85rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info .role { color: var(--orange-400); font-size: .72rem; font-weight: 500; }
.logout-btn {
  color: rgba(255,255,255,.5); font-size: 1rem; transition: var(--transition);
  display: flex; padding: .4rem;
}
.logout-btn:hover { color: var(--danger); }

/* ── Main layout con sidebar ── */
.app-layout { display: flex; }
.main-content {
  margin-left: 260px; flex: 1; min-height: 100vh;
  background: var(--gray-50);
  min-width: 0;
  width: calc(100% - 260px);
}
.topbar {
  height: 70px; background: var(--white);
  border-bottom: 2px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--blue-800); }
.page-content { padding: 2rem; }

/* ── Stat cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
  border-radius: 22px; padding: 1.6rem 1.75rem;
  display: flex; align-items: center; gap: 1.25rem;
  position: relative; overflow: hidden; color: var(--white);
  transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover { transform: translateY(-4px); }
.stat-card.blue   { background: linear-gradient(135deg, var(--blue-800), var(--blue-600)); box-shadow: 0 12px 28px rgba(10,36,99,.28); }
.stat-card.orange { background: linear-gradient(135deg, var(--orange-500), var(--orange-600)); box-shadow: 0 12px 28px rgba(255,107,43,.28); }
.stat-card.green  { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 12px 28px rgba(16,185,129,.28); }
.stat-card.red    { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 12px 28px rgba(239,68,68,.28); }

.stat-icon {
  position: absolute; top: -18px; right: -14px;
  width: 96px; height: 96px; opacity: .16; color: var(--white);
  transform: rotate(-8deg);
}
.stat-icon svg { width: 100%; height: 100%; }
.fin-icon svg { width: 20px; height: 20px; }

.stat-info { position: relative; z-index: 1; }
.stat-info .value { font-size: 2.3rem; font-weight: 900; color: var(--white); line-height: 1; }
.stat-info .label {
  font-size: .78rem; color: rgba(255,255,255,.85); font-weight: 700; margin-top: .35rem;
  text-transform: uppercase; letter-spacing: .04em;
}

/* ── Producto card ── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; align-items: start; }
.product-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden; transition: var(--transition);
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.product-card-img {
  height: 140px; background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.product-card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.product-card-title { font-weight: 700; color: var(--gray-900); font-size: .95rem; }
.product-card-cat { font-size: .75rem; color: var(--blue-600); font-weight: 600; text-transform: uppercase; }
.product-card-lab { font-size: .8rem; color: var(--gray-500); }
.product-card-price {
  font-size: 1.5rem; font-weight: 800; color: var(--orange-500);
  margin-top: auto;
}
.product-card-price span { font-size: .75rem; color: var(--gray-500); font-weight: 400; }
.product-card-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--gray-100);
  display: flex; gap: .5rem;
}

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 4rem 2rem; color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 1rem; opacity: .5; }
.empty-state p { font-size: 1rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--blue-800); border-radius: 3px; }

/* ── Menú móvil (barra fija con logo + botón) ── */
.mobile-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: var(--blue-900); z-index: 150; align-items: center; gap: .85rem;
  padding: 0 1rem; box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
.mobile-topbar-logo {
  height: 34px; width: 116px; overflow: hidden;
  display: flex; align-items: center; flex-shrink: 0;
}
.mobile-topbar-logo img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 47%;
}
.mobile-menu-btn {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255,255,255,.12); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; transition: var(--transition-fast);
}
.mobile-menu-btn:active { background: rgba(255,255,255,.22); }
.mobile-menu-btn svg { width: 20px; height: 20px; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(4,15,43,.55); z-index: 90;
  opacity: 0; transition: opacity .25s ease;
}
.sidebar-backdrop.active { display: block; opacity: 1; }

/* ── Botón "subir arriba" ── */
.scroll-top-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 120;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--blue-900); color: var(--white); border: 3px solid var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(4,15,43,.35);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
}
.scroll-top-btn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.scroll-top-btn:hover { background: var(--orange-500); }
.scroll-top-btn svg { width: 20px; height: 20px; }
@media (max-width: 768px) {
  .scroll-top-btn { bottom: 18px; right: 18px; width: 42px; height: 42px; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .page-content { grid-template-columns: 1fr !important; }
  .page-content > * { min-width: 0; }
  .grid { grid-template-columns: 1fr !important; }
  .grid > * { min-width: 0; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: var(--transition); z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-top: 56px !important; }
  .mobile-topbar { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .container { padding: 0 1rem; }
  .page-content { padding: 1rem; }
  .topbar { flex-wrap: wrap; height: auto; min-height: 70px; top: 56px; padding: .85rem 1rem !important; gap: .6rem; }
  .topbar-title { font-size: 1rem; width: 100%; }
  .topbar > div:last-child { flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }
  .toast-container { top: 66px !important; }
  .toast-content { max-width: 55vw; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .card-header input, .card-header select { max-width: 100% !important; width: 100%; }
}

/* Toast Notifications — pill minimalista, cae desde arriba, centrado */
.toast-container {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: .6rem;
  width: auto; max-width: calc(100% - 2rem);
  pointer-events: none;
}
.toast {
  background: white; padding: .55rem 1rem .55rem .55rem; border-radius: 9999px;
  box-shadow: 0 6px 20px rgba(10,36,99,.12), 0 1px 2px rgba(10,36,99,.06);
  border: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: .55rem;
  max-width: 100%;
  opacity: 0; transform: translateY(-14px) scale(.97);
  transition: opacity .3s ease, transform .35s cubic-bezier(.175,.885,.32,1.275);
  pointer-events: auto;
}
.toast.active { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-100); color: var(--blue-600);
}
.toast-icon svg { width: 12px; height: 12px; }
.toast.success .toast-icon { background: #d1fae5; color: var(--success); }
.toast.error .toast-icon { background: #fee2e2; color: var(--danger); }
.toast.warning .toast-icon { background: #fef3c7; color: var(--warning); }
.toast.info .toast-icon { background: var(--blue-100); color: var(--blue-600); }
.toast-content {
  display: flex; align-items: baseline; gap: .4rem; min-width: 0; max-width: 280px;
}
.toast-title {
  font-weight: 700; font-size: .82rem; color: var(--blue-900); flex-shrink: 0;
}
.toast-msg {
  font-size: .82rem; color: var(--gray-500); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 0.85rem; color: var(--blue-900); display: block; margin-bottom: 1px; }
.toast-msg {
  font-size: 0.8rem; color: var(--gray-500); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}


/* ═══════════════════════════════════════════════════════════
   BLOQUEO DE SCROLL + MODAL DE DETALLE DE PRODUCTO
═══════════════════════════════════════════════════════════ */
body.ui-locked {
  position: fixed; left: 0; right: 0; width: 100%;
  overflow: hidden; overscroll-behavior: none;
}
.modal-overlay, .pm-overlay { overscroll-behavior: contain; }
.modal { overscroll-behavior: contain; }

/* botón "ver" sobre la foto de cada tarjeta */
.store-card[data-pm], .product-card[data-pm] { cursor: pointer; }
.store-card-img, .product-card-img { position: relative; }
.pm-peek {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.94); color: var(--blue-800);
  border: 1px solid rgba(10,36,99,.12);
  box-shadow: 0 2px 10px rgba(4,15,43,.14);
  transition: transform .2s ease, background .2s ease, color .2s ease, opacity .2s ease;
}
.pm-peek svg { width: 18px; height: 18px; }
.pm-peek:hover, .pm-peek:focus-visible { background: var(--blue-800); color: #fff; transform: scale(1.08); outline: none; }
@media (hover: hover) and (min-width: 900px) {
  .pm-peek { opacity: 0; transform: translateY(-4px); }
  .store-card:hover .pm-peek, .product-card:hover .pm-peek, .pm-peek:focus-visible { opacity: 1; transform: none; }
}

/* ── Modal ── */
.pm-overlay {
  position: fixed; inset: 0; z-index: 1100;
  display: none; align-items: center; justify-content: center;
  padding: 1.25rem;
  background: rgba(4,15,43,.72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.pm-overlay.open { display: flex; animation: pmFade .2s ease; }
@keyframes pmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pmRise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pmSheet { from { transform: translateY(100%); } to { transform: none; } }

.pm-sheet {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  width: 100%; max-width: 940px; height: min(640px, calc(100dvh - 2.5rem));
  background: #fff; border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(4,15,43,.45);
  animation: pmRise .28s cubic-bezier(.2,.8,.2,1);
}
.pm-close {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: #fff; color: var(--gray-800);
  border: 1px solid var(--gray-200); box-shadow: 0 2px 10px rgba(0,0,0,.1);
  transition: transform .2s ease, background .2s ease;
}
.pm-close svg { width: 18px; height: 18px; }
.pm-close:hover { background: var(--gray-100); transform: rotate(90deg); }
.pm-close:focus-visible, .pm-btn:focus-visible, .pm-qty button:focus-visible, .pm-qty input:focus-visible {
  outline: 3px solid var(--orange-400); outline-offset: 2px;
}

.pm-media {
  position: relative; overflow: hidden; min-height: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #fff 0, #fff 46%, #f1f4fa 100%);
  border-right: 1px solid var(--gray-100);
}
.pm-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 1.5rem;
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
  user-select: none; -webkit-user-drag: none;
}
.pm-media.has-img { cursor: zoom-in; }
.pm-media.zoom { cursor: zoom-out; }
.pm-media.zoom img { transform: scale(1.9); }
.pm-zoom-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  padding: .35rem .8rem; border-radius: 99px; white-space: nowrap;
  font-size: .72rem; font-weight: 600; color: var(--gray-600);
  background: rgba(255,255,255,.92); border: 1px solid var(--gray-200);
  pointer-events: none; transition: opacity .2s ease;
}
.pm-media.zoom .pm-zoom-hint { opacity: 0; }
.pm-noimg { display: grid; gap: .5rem; justify-items: center; color: var(--gray-400); }
.pm-noimg span { font-size: 5rem; filter: grayscale(.2); }
.pm-noimg small { font-size: .8rem; font-weight: 600; }

.pm-info { display: flex; flex-direction: column; min-height: 0; }
.pm-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 2rem 1.9rem 1rem; overscroll-behavior: contain; }
.pm-lab { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-500); margin-bottom: .45rem; padding-right: 2.6rem; }
.pm-title { font-size: 1.45rem; line-height: 1.22; color: var(--blue-900); margin-bottom: .9rem; overflow-wrap: anywhere; }
.pm-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; }
.pm-chip { font-size: .72rem; font-weight: 700; padding: .28rem .65rem; border-radius: 99px; background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.pm-chip.warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.pm-chip.ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.pm-chip.off { background: var(--gray-100); color: var(--gray-500); }

.pm-price { padding: 1rem 1.1rem; border-radius: 14px; background: var(--blue-50); border: 1px solid var(--blue-100); margin-bottom: 1.1rem; }
.pm-old { font-size: .78rem; color: var(--gray-400); text-decoration: line-through; margin-bottom: .15rem; }
.pm-bs { font-family: 'Outfit', sans-serif; font-size: 1.85rem; font-weight: 800; color: var(--blue-800); line-height: 1.1; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pm-off { font-size: .8rem; font-weight: 800; color: #fff; background: var(--orange-500); padding: .2rem .55rem; border-radius: 8px; }
.pm-usd { font-size: .85rem; font-weight: 600; color: var(--gray-500); margin-top: .3rem; }

.pm-specs { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1rem; margin-bottom: 1rem; }
.pm-specs > div { padding: .55rem 0; border-bottom: 1px solid var(--gray-100); min-width: 0; }
.pm-specs dt { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-bottom: .15rem; }
.pm-specs dd { font-size: .92rem; font-weight: 600; color: var(--gray-800); overflow-wrap: anywhere; }
.pm-specs .ok { color: #15803d; } .pm-specs .low { color: #b45309; } .pm-specs .out { color: var(--danger); }
.pm-desc { font-size: .9rem; line-height: 1.6; color: var(--gray-600); white-space: pre-line; }

.pm-actions {
  display: flex; gap: .7rem; align-items: stretch;
  padding: 1rem 1.9rem 1.4rem; border-top: 1px solid var(--gray-100); background: #fff;
}
.pm-qty { display: inline-flex; align-items: stretch; border: 1.5px solid var(--gray-300); border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.pm-qty button { width: 42px; background: var(--gray-50); border: 0; cursor: pointer; font-size: 1.2rem; font-weight: 700; color: var(--gray-700); }
.pm-qty button:hover { background: var(--gray-100); }
.pm-qty input { width: 64px; border: 0; text-align: center; font: 700 1rem 'Inter', sans-serif; color: var(--gray-900); -moz-appearance: textfield; }
.pm-qty input::-webkit-outer-spin-button, .pm-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pm-btn {
  flex: 1; min-height: 46px; padding: 0 1.2rem; border-radius: 12px; cursor: pointer;
  font: 700 .95rem 'Inter', sans-serif; border: 1.5px solid var(--gray-300); background: #fff; color: var(--gray-700);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.pm-btn:hover:not(:disabled) { transform: translateY(-1px); }
.pm-btn.primary { background: var(--orange-500); border-color: var(--orange-500); color: #fff; box-shadow: 0 6px 18px rgba(255,107,43,.32); }
.pm-btn.primary:hover { background: var(--orange-600); border-color: var(--orange-600); }
.pm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Móvil / tablet: hoja que sube desde abajo ── */
@media (max-width: 760px) {
  .pm-overlay { padding: 0; align-items: flex-end; }
  .pm-sheet {
    grid-template-columns: 1fr; grid-template-rows: minmax(160px, 38%) minmax(0, 1fr);
    max-width: none; height: min(94dvh, 100%); border-radius: 22px 22px 0 0;
    animation: pmSheet .3s cubic-bezier(.2,.8,.2,1);
  }
  .pm-media { border-right: 0; border-bottom: 1px solid var(--gray-100); }
  .pm-media img { padding: .75rem; }
  .pm-scroll { padding: 1.2rem 1.2rem .6rem; }
  .pm-title { font-size: 1.2rem; }
  .pm-bs { font-size: 1.55rem; }
  .pm-actions { padding: .8rem 1.2rem calc(.9rem + env(safe-area-inset-bottom)); }
  .pm-close { top: 10px; right: 10px; }
}
@media (max-width: 380px) { .pm-specs { grid-template-columns: 1fr; } .pm-btn { padding: 0 .6rem; font-size: .88rem; } }
@media (max-height: 520px) and (orientation: landscape) {
  .pm-overlay { align-items: center; padding: .5rem; }
  .pm-sheet { grid-template-columns: 1fr 1.2fr; grid-template-rows: none; height: calc(100dvh - 1rem); border-radius: 16px; max-width: 900px; animation: pmRise .28s ease; }
  .pm-actions { padding-bottom: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-overlay.open, .pm-sheet, .pm-media img { animation: none; transition: none; }
}


/* ═══════════════════════════════════════════════════════════
   MODAL DE SUBIDA DE IMÁGENES (progreso real)
═══════════════════════════════════════════════════════════ */
.iu-modal { max-width: 600px; }
.iu-help { font-size: .9rem; color: var(--gray-600); margin-bottom: 1rem; line-height: 1.55; }
.iu-help code { background: var(--gray-100); padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }
.iu-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: 1.1rem; }
.iu-stats > div { background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 12px; padding: .7rem .6rem; text-align: center; }
.iu-stats strong { display: block; font-family: 'Outfit', sans-serif; font-size: 1.4rem; color: var(--blue-800); line-height: 1.1; }
.iu-stats span { font-size: .7rem; font-weight: 600; color: var(--gray-500); }
.iu-or { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; font-size: .82rem; color: var(--gray-500); }
.iu-link { color: var(--blue-600); font-weight: 700; cursor: pointer; text-decoration: underline; }
.iu-seleccion { margin: .2rem 0 1rem; padding: .7rem .9rem; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: .88rem; }
.iu-warn { color: #b45309; font-weight: 600; }
.iu-check { display: flex; gap: .7rem; align-items: flex-start; font-size: .85rem; color: var(--gray-600); line-height: 1.45; cursor: pointer; }
.iu-check input { width: 18px; height: 18px; margin-top: .1rem; flex-shrink: 0; accent-color: var(--blue-700); }

.iu-pct { text-align: center; font-family: 'Outfit', sans-serif; font-weight: 800; color: var(--blue-800); line-height: 1; margin: .4rem 0 1rem; }
.iu-pct span { font-size: 4.2rem; font-variant-numeric: tabular-nums; }
.iu-pct small { font-size: 1.6rem; margin-left: .15rem; color: var(--gray-400); }
.iu-bar { height: 14px; border-radius: 99px; background: var(--gray-200); overflow: hidden; }
.iu-bar > div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--blue-600), var(--orange-500)); transition: width .25s ease; }
.iu-estado { margin-top: .8rem; text-align: center; font-weight: 700; color: var(--gray-700); }
.iu-meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: .3rem; font-size: .8rem; color: var(--gray-500); }
.iu-live { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1.1rem; }
.iu-live > div { border-radius: 10px; padding: .6rem .5rem; text-align: center; font-size: .72rem; font-weight: 600; }
.iu-live strong { display: block; font-size: 1.3rem; font-family: 'Outfit', sans-serif; }
.iu-live .ok { background: #dcfce7; color: #166534; }
.iu-live .wait { background: #fef3c7; color: #92400e; }
.iu-live .skip { background: #fee2e2; color: #991b1b; }
.iu-live.big > div { font-size: .78rem; padding: .8rem .5rem; }
.iu-live.big strong { font-size: 1.7rem; }
.iu-nota { text-align: center; font-size: .78rem; color: var(--gray-400); margin-top: 1rem; }

.iu-resultado-titulo { font-weight: 700; padding: .8rem 1rem; border-radius: 12px; margin-bottom: .2rem; }
.iu-resultado-titulo.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.iu-resultado-titulo.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.iu-detalle { margin-top: .9rem; border: 1px solid var(--gray-200); border-radius: 12px; padding: .2rem .9rem; }
.iu-detalle summary { cursor: pointer; font-weight: 700; font-size: .88rem; padding: .6rem 0; color: var(--gray-700); }
.iu-detalle-nota { font-size: .8rem; color: var(--gray-500); margin-bottom: .6rem; }
.iu-codes { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 180px; overflow-y: auto; padding-bottom: .7rem; }
.iu-codes span { font-size: .74rem; font-weight: 600; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 6px; padding: .15rem .5rem; }
.iu-omit { list-style: none; max-height: 200px; overflow-y: auto; padding-bottom: .6rem; font-size: .8rem; color: var(--gray-600); }
.iu-omit li { padding: .35rem 0; border-bottom: 1px solid var(--gray-100); overflow-wrap: anywhere; }

@media (max-width: 520px) {
  .iu-stats strong { font-size: 1.15rem; }
  .iu-pct span { font-size: 3.4rem; }
  .iu-meta { flex-direction: column; gap: .1rem; align-items: center; }
  .iu-live > div { font-size: .66rem; }
}

[hidden] { display: none !important; }

/* Progreso al guardar un producto con imagen */
.ep-progreso { padding: 0 1.5rem 1rem; }
.ep-progreso .iu-bar { height: 12px; }
.ep-fila { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; font-size: .88rem; font-weight: 600; color: var(--gray-700); }
.ep-fila strong { font-family: 'Outfit', sans-serif; font-size: 1.1rem; color: var(--blue-800); font-variant-numeric: tabular-nums; }
.ep-error { margin-top: .6rem; padding: .65rem .85rem; border-radius: 10px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: .85rem; font-weight: 600; }


/* Paginación */
.paginacion { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; margin: 2rem 0 1rem; }
.pg-btn, .pg-num { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 .9rem; border-radius: 12px; border: 1.5px solid var(--gray-200); background: #fff; color: var(--gray-700); font-weight: 700; font-size: .9rem; text-decoration: none; transition: var(--transition-fast); }
.pg-btn:hover, .pg-num:hover { border-color: var(--blue-600); color: var(--blue-700); }
.pg-num.on { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }
.pg-btn.off { opacity: .4; pointer-events: none; }
.pg-gap { color: var(--gray-400); padding: 0 .2rem; }
@media (max-width: 520px) { .pg-btn { flex: 1 1 40%; } .pg-num { min-width: 40px; padding: 0 .6rem; } }


/* "Cargar más" del catálogo */
.load-more { text-align: center; margin: 2rem 0 1rem; }
.load-more-count { color: var(--gray-500); font-size: .9rem; margin-bottom: .9rem; }
.load-more .btn { min-width: 240px; min-height: 48px; font-weight: 700; }


/* ═══════════════════════════════════════════════════════════
   PULIDO RESPONSIVE GLOBAL (admin + portal)
═══════════════════════════════════════════════════════════ */

/* Evita el zoom automático de Safari al enfocar un campo (tamaño < 16px) y mejora el toque */
@media (max-width: 900px), (pointer: coarse) {
  input.form-control, select.form-control, textarea.form-control, .form-control { font-size: 16px; min-height: 46px; }
  textarea.form-control { min-height: 90px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 42px; padding: .55rem 1rem; }
  .btn-xs { min-height: 38px; padding: .45rem .8rem; }
  .modal-close, .btn-close { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .view-toggle button { min-width: 44px; min-height: 40px; }
  .nav-link { min-height: 46px; }
  .cat-pill { min-height: 42px; }
}

/* Tablas → tarjetas en móvil (las etiquetas las pone ui.js desde los encabezados) */
@media (max-width: 760px) {
  .table.rt, .table.rt tbody, .table.rt tr, .table.rt td { display: block; width: 100%; }
  .table.rt thead { display: none; }
  .table.rt { border: 0; background: transparent; }
  .table.rt tr { background: #fff; border: 1px solid var(--gray-200); border-radius: 16px; margin: 0 0 .9rem; padding: .35rem 1rem; box-shadow: 0 2px 10px rgba(10, 36, 99, .06); }
  .table.rt td { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding: .6rem 0; border: 0; border-bottom: 1px dashed var(--gray-200); text-align: right; min-height: 0; overflow-wrap: anywhere; }
  .table.rt td:last-child { border-bottom: 0; }
  .table.rt td::before { content: attr(data-label); flex: 0 0 34%; text-align: left; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-500); }
  .table.rt td[data-label=""]::before { display: none; }
  .table.rt td[data-label=""] { justify-content: flex-end; }
  .table.rt td > div { flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
  .table.rt td form { display: inline-flex; }
  .table-wrapper:has(.table.rt) { overflow: visible; border-radius: 0; }
  .card-body:has(.table.rt) { padding: .75rem !important; }
}

/* Tarjetas de estadísticas: 2 columnas y más compactas en móvil */
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: .8rem !important; }
  .stat-card { padding: 1rem !important; min-height: 0 !important; flex-direction: column; align-items: flex-start !important; gap: .4rem !important; border-radius: 16px !important; }
  .stat-card .value { font-size: 1.9rem !important; line-height: 1; }
  .stat-card .label { font-size: .68rem !important; line-height: 1.25; }
  .stat-card .stat-icon { width: 38px !important; height: 38px !important; margin: 0 0 .2rem !important; }
  .stat-card .stat-icon svg { width: 20px !important; height: 20px !important; }
}

/* Barras superiores: no se desbordan y los botones bajan de línea */
@media (max-width: 760px) {
  .topbar { height: auto !important; min-height: 0; flex-wrap: wrap; gap: .5rem .8rem; padding-top: .7rem; padding-bottom: .7rem; }
  .page-content { padding: 1rem !important; }
  .card-header { flex-wrap: wrap; gap: .6rem; }
  .card-header .form-control { max-width: none !important; flex: 1 1 100%; }
}

/* Foco visible para teclado en todo el sistema */
.btn:focus-visible, .nav-link:focus-visible, .form-control:focus-visible, .cat-pill:focus-visible { outline: 3px solid var(--orange-400); outline-offset: 2px; }

/* Respeta "reducir movimiento" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}


/* Banner del portal: productos reales sobre degradado de marca (reemplaza la imagen ilustrada) */
.promo-banner-container { position: relative; background: linear-gradient(135deg, var(--blue-800) 0%, #0f3a9e 55%, var(--blue-900) 100%); overflow: hidden; }
.banner-real { position: absolute; inset: 0; pointer-events: none; }
.banner-real .bf { position: absolute; width: clamp(100px, 22%, 180px); height: auto; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 16px; padding: 8px; box-shadow: 0 18px 36px rgba(0, 0, 0, .35); }
.banner-real .bf1 { right: 3%; top: 10%; transform: rotate(6deg); }
.banner-real .bf2 { right: 22%; bottom: -12%; transform: rotate(-6deg); }
.banner-real .bf3 { display: none; }
.promo-banner-container .banner-overlay { z-index: 2; background: none !important; }
.promo-banner-container .banner-overlay h2, .promo-banner-container .banner-overlay p { max-width: min(420px, 54%); }
@media (max-width: 760px) {
  .banner-real .bf { width: 34%; }
  .banner-real .bf2 { right: 4%; bottom: -8%; }
  .banner-real .bf3 { display: none; }
}
