/* SIPE.PE - Senior UI/UX Architecture */
/* Nota: las fuentes ya no se cargan con @import (bloquea un round-trip extra).
   Se cargan con <link rel="preconnect"> + <link> en el <head> de cada plantilla
   base (base.html, admin/layout_master.html, admin/verificar_otp.html). */

:root {
    --sipe-primary: #7c3aed;
    --sipe-primary-hover: #6d28d9;
    --sipe-secondary: #06b6d4;
    --sipe-dark: #0f172a;
    --sipe-dark-lighter: #1e293b;
    --sipe-light: #f8fafc;
    --sipe-border: #e2e8f0;
    --text-main: #334155;
    --text-muted: #64748b;
    --danger: #ef4444;

    /* --- SIPE: CIERRE DE TOKENS (Fase 1 del plan de ruta UI/UX, 20/08/2026) ---
       Estos tokens nacieron limpiando hex sueltos en admin/finanzas — la
       tienda pública (main_bp) no los usaba todavía, pero viven acá
       también porque main.css es la fuente de verdad única y admin.css
       la copia 1:1 (ver admin.css). Mismo valor exacto que ya se veía. */

    /* Neutrales adicionales */
    --sipe-border-strong: #cbd5e1;
    --sipe-border-legacy: #ccc;
    --sipe-light-alt: #f1f5f9;
    --text-secondary: #475569;
    --text-faint: #94a3b8;
    --sipe-secondary-strong: #0891b2;

    /* Estados semánticos: éxito */
    --color-success: #059669;
    --color-success-alt: #10b981;
    --color-success-soft-bg: #d1fae5;
    --color-success-strong: #065f46;
    --color-success-bg: #dcfce7;
    --color-success-text: #166534;
    --color-success-bright: #4ade80;

    /* Estados semánticos: peligro */
    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --color-danger-text: #991b1b;
    --color-danger-light: #f87171;

    /* Estados semánticos: advertencia */
    --color-warning: #92400e;
    --color-warning-alt: #d97706;
    --color-warning-strong: #b45309;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-warning-bg-alt: #fef3c7;
    --color-warning-soft-bg: #fef9c3;
    --color-warning-soft-text: #854d0e;

    /* Estados semánticos: información */
    --color-info: #3b82f6;
    --color-info-text: #1d4ed8;
    --color-info-text-strong: #1e3a8a;
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;
    --color-info-bg-alt: #dbeafe;
    --color-info-text-alt: #1e40af;

    /* Flujo de dinero (badges "tipo" en Finanzas: Ingreso/Egreso, Por cobrar/pagar).
       Fase 6 del plan de ruta UI/UX (20/08/2026, sección 2.8): los tonos
       originales (#43a047 / #e53935) no llegaban al contraste AA de 4.5:1
       como texto sobre blanco (badge_texto en flujo_caja.html/index.html) —
       se oscurecieron dentro de la misma familia (Material green/red 800)
       hasta pasar el mínimo, sin cambiar cuál color representa cada cosa. */
    --color-flow-in: #2e7d32;
    --color-flow-out: #c62828;

    /* Acentos puntuales (badges) */
    --color-badge-accent-bg: #f5f3ff;
    --color-badge-role-bg: #e0e7ff;
    --color-badge-role-text: #3730a3;
    --color-badge-role-text-alt: #4338ca;

    /* --- SIPE: SISTEMA TIPOGRÁFICO (ver brand_guidelines.txt) --- */
    --font-brand: 'Plus Jakarta Sans', 'Plus Jakarta Sans Respaldo', system-ui, sans-serif;
    --font-ui: 'DM Sans', 'DM Sans Respaldo', system-ui, sans-serif;
    --font-tech: 'JetBrains Mono', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    --text-5xl: 3rem;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--sipe-light);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Legibilidad (03/10/2026). Mientras llegan las fuentes de Google, el
   navegador usa Arial ajustada a las MISMAS medidas de DM Sans / Plus
   Jakarta (size-adjust y alturas): el texto ya no salta al cargar. Valores
   calculados de las fuentes reales (ancho medio de minúsculas y métricas
   hhea). */
@font-face { font-family: 'DM Sans Respaldo'; src: local('Arial'); size-adjust: 106.4%; ascent-override: 93.3%; descent-override: 29.1%; line-gap-override: 0%; }
@font-face { font-family: 'Plus Jakarta Sans Respaldo'; src: local('Arial Bold'), local('Arial'); font-weight: 600 800; size-adjust: 113.7%; ascent-override: 91.3%; descent-override: 19.5%; line-gap-override: 0%; }
/* Los botones y campos no heredan la fuente por defecto (salían en Arial). */
button, input, select, textarea { font-family: inherit; }
/* Con la fuente de la página el buscador ya no cabe a 375 px si no puede encogerse. */
.search-input { min-width: 0; }

/* =========================================
   HEADER Y NAVEGACIÓN
========================================= */
.top-bar { background: #090d16; color: #cbd5e1; padding: 8px 30px; font-size: 0.8rem; display: flex; justify-content: space-between; align-items: center; }
.sipe-header { background: var(--sipe-dark); padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; gap: 30px; border-bottom: 1px solid rgba(255,255,255,0.08); }
/* Logo (02/10/2026): wordmark "sipe" con rayo (img/marca/sipe-logo-oscuro.svg) + lema.
   El SVG mide 847x575: la altura de la x va del 20 % al 58 % del alto y el rayo
   baja por debajo, por eso el lema se alinea arriba y no al centro. */
.brand-logo { display: flex; align-items: flex-start; gap: 14px; text-decoration: none; flex-shrink: 0; --logo-h: 64px; }
.brand-logo-img { display: block; height: var(--logo-h); width: auto; }
.logo-text { font-family: var(--font-brand); color: var(--sipe-light); font-size: calc(var(--logo-h) * 0.22); font-weight: 700; line-height: 1;
    margin-top: calc(var(--logo-h) * 0.13); height: calc(var(--logo-h) * 0.47);
    display: flex; flex-direction: column; justify-content: space-between;
    padding-left: 13px; border-left: 2px solid rgba(6, 182, 212, 0.55); }
.logo-text span { color: var(--sipe-secondary); font-weight: 600; }
.footer-logo { display: inline-block; height: 64px; width: auto; margin-bottom: 15px; }

.header-search { flex: 1; max-width: 600px; }
.search-form { display: flex; width: 100%; background: #1e293b; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
.search-input { flex: 1; background: transparent; border: none; padding: 12px 20px; color: white; outline: none; }
.search-btn { background: var(--sipe-primary); color: white; border: none; padding: 0 20px; cursor: pointer; transition: 0.2s; }
.search-btn:hover { background: var(--sipe-primary-hover); }

.header-actions { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.action-btn { color: white; text-decoration: none; font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cart-chip { background: var(--sipe-primary); padding: 6px 14px; border-radius: 50px; font-size: 0.8rem; }

.sipe-nav { background: var(--sipe-dark-lighter); padding: 0 30px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.nav-menu { list-style: none; display: flex; gap: 5px; max-width: 1400px; margin: 0 auto; flex-wrap: wrap; }
.nav-item { position: relative; }
.nav-link { display: flex; align-items: center; gap: 6px; padding: 15px 18px; color: #e2e8f0; text-decoration: none; font-size: 0.9rem; font-weight: 600; transition: 0.2s; }
.nav-item:hover .nav-link { background: var(--sipe-primary); color: white; }

/* Dropdown */
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: white; min-width: 240px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); border-radius: 0 0 8px 8px; z-index: 1000; padding: 10px 0; border: 1px solid var(--sipe-border); }
.nav-item:hover .dropdown-menu { display: block; animation: fadeIn 0.2s ease; }
.dropdown-item a { display: block; padding: 10px 20px; color: var(--text-main); text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: 0.15s; }
.dropdown-item a:hover { background: #f1f5f9; color: var(--sipe-primary); padding-left: 25px; }

/* Menú en una fila + "Todas las categorías" (03/10/2026). En escritorio y
   tablet: Todas · Ofertas · destacadas (base.html, menu_destacadas); el
   resto queda en el panel. En celular (≤768) no hay panel: el menú lateral
   lista todas (ver el bloque móvil). */
.nav-todas-btn { background: none; border: 0; font: inherit; font-size: 0.85rem; cursor: pointer; }
.nav-chevron { font-size: 0.7rem; margin-left: 2px; }
.mega-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 1000; width: min(1080px, calc(100vw - 60px)); background: white; border: 1px solid var(--sipe-border); border-radius: 0 0 12px 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); padding: 22px 24px 18px; }
.nav-todas:hover .mega-menu, .nav-todas:focus-within .mega-menu, .nav-todas.open .mega-menu { display: block; }
.mega-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 24px; }
.mega-cat { display: flex; align-items: center; gap: 8px; color: var(--sipe-dark); font-family: var(--font-brand); font-weight: 700; font-size: 0.9rem; text-decoration: none; margin-bottom: 6px; }
.mega-cat .ico-cat { width: 20px; height: 20px; color: var(--sipe-primary); flex-shrink: 0; }
.mega-cat:hover { color: var(--sipe-primary); }
.mega-col ul { list-style: none; padding-left: 28px; }
.mega-col li a { display: block; padding: 3px 0; color: var(--text-secondary); font-size: 0.85rem; text-decoration: none; }
.mega-col li a:hover { color: var(--sipe-primary); }
.mega-todo { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--sipe-border); width: 100%; color: var(--sipe-primary); font-weight: 700; font-size: 0.9rem; text-decoration: none; }
@media screen and (min-width: 769px) {
    .nav-menu { flex-wrap: nowrap; }
    .nav-item--extra { display: none; }
    .nav-link { white-space: nowrap; }
}
@media screen and (min-width: 769px) and (max-width: 1200px) { .nav-item--d4 { display: none; } }
@media screen and (min-width: 769px) and (max-width: 1060px) { .nav-item--d3 { display: none; } .nav-link { padding: 15px 12px; } .mega-grid { grid-template-columns: repeat(3, 1fr); } }

/* =========================================
   1. HERO BENTO BOX
========================================= */
.main-wrapper { max-width: 1400px; margin: 0 auto; padding: 30px 20px; width: 100%; flex: 1; }
/* Portada (03/10/2026, 2.ª versión): cuadro grande + dos cuadros (Ofertas y
   Suministros), unos 300 px de alto. Las imágenes son fondos (CSS) y el
   texto va encima en HTML. */
.hero { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 16px; min-height: 300px; margin-bottom: 20px; }
.hero-main { grid-row: span 2; position: relative; border-radius: 16px; overflow: hidden; color: white; background: var(--sipe-dark); display: grid; }
/* Carrusel del cuadro grande (03/10/2026): las 3 diapositivas ocupan la misma celda (el alto lo pone la más alta, no salta) y cambian con un fundido. Imágenes propias generadas con IA, sin logos ajenos. */
.hero-slide { --hero-img: var(--img-lg, none); grid-area: 1 / 1; padding: 36px 40px 56px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(90deg, rgba(15,23,42,0.92) 0%, rgba(15,23,42,0.7) 55%, rgba(15,23,42,0.2) 100%), var(--hero-img) center right/cover no-repeat; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s linear .6s; }
.hero-slide.is-activa { opacity: 1; visibility: visible; transition: opacity .6s ease, visibility 0s; }
/* La imagen la pone la plantilla (--img-lg / --img-sm, con ?v= para no quedar pegada en la caché). La 2.ª y 3.ª se piden recién con la página cargada. */
.hero-carrusel:not(.hero-carrusel--listo) .hero-slide:not(:first-child) { --hero-img: none; }
.hero-controles { position: absolute; left: 40px; bottom: 18px; display: flex; align-items: center; gap: 4px; z-index: 1; }
.hero-punto { width: 28px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.hero-punto::before { content: ""; width: 22px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.35); transition: background .3s; }
.hero-punto.is-activo::before { background: var(--sipe-secondary); }
.hero-punto:hover::before { background: rgba(255,255,255,0.7); }
.hero-pausa { width: 28px; height: 24px; margin-left: 6px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.hero-pausa[hidden] { display: none; }
.hero-pausa span { width: 9px; height: 11px; border-left: 3px solid rgba(255,255,255,0.75); border-right: 3px solid rgba(255,255,255,0.75); }
.hero-pausa[aria-pressed="true"] span { width: 0; height: 0; border-left: 10px solid rgba(255,255,255,0.85); border-right: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.hero-punto:focus-visible, .hero-pausa:focus-visible { outline: 2px solid var(--sipe-secondary); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .hero-slide, .hero-slide.is-activa { transition: none; } }
.hero-main h1, .hero-slide-titulo { font-family: var(--font-brand); font-weight: 800; letter-spacing: -0.02em; font-size: 2.5rem; line-height: 1.1; margin-bottom: 12px; max-width: 620px; }
.hero-main h1 span, .hero-slide-titulo span { color: var(--sipe-secondary); white-space: nowrap; }
.hero-main p { font-size: 1.05rem; color: #e2e8f0; margin-bottom: 22px; max-width: 560px; line-height: 1.5; }
.hero-btn { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; }
.hero-cuadro { position: relative; border-radius: 16px; padding: 22px 24px; display: flex; flex-direction: column; justify-content: center; color: white; text-decoration: none; background-color: var(--sipe-dark); background-size: cover; background-position: center right; overflow: hidden; }
.hero-cuadro::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,23,42,0.85) 0%, rgba(15,23,42,0.55) 60%, rgba(15,23,42,0.1) 100%); }
.hero-cuadro > * { position: relative; }
.hero-cuadro--ofertas { background-color: var(--sipe-primary); background-image: var(--img-lg); }
.hero-cuadro--suministros { background-color: var(--sipe-secondary-strong); background-image: var(--img-lg); }
.hero-cuadro h2 { font-family: var(--font-brand); font-weight: 700; font-size: 1.35rem; margin-bottom: 6px; }
.hero-cuadro p { font-size: 0.95rem; color: #e2e8f0; max-width: 260px; line-height: 1.4; }
.hero-cuadro-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 700; font-size: 0.9rem; }
.hero-cuadro:hover .hero-cuadro-link, .hero-cuadro:focus-visible .hero-cuadro-link { text-decoration: underline; }
.hero-dato { font-weight: 800; font-variant-numeric: tabular-nums; }
/* Precinto de confianza dentro de la portada: banda con borde, bajo los cuadros. */
.main-wrapper .trust-badges { border: 1px solid var(--sipe-border); border-radius: 16px; padding: 20px 24px; margin-bottom: 30px; }

/* =========================================
   2. CATEGORÍAS RÁPIDAS
========================================= */
.quick-categories { margin-bottom: 36px; }
.category-circles { display: flex; justify-content: space-between; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.cat-circle { display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; color: var(--text-main); font-weight: 600; font-size: 0.9rem; line-height: 1.25; text-align: center; min-width: 90px; max-width: 110px; }
/* Íconos propios (macros/iconos_categoria.html) en la misma forma del
   favicon: cuadrado de esquinas redondeadas. Al pasar el mouse solo cambia
   el borde: sin agrandar ni rellenar. */
.ico-cat { --ico-acento: var(--sipe-secondary-strong); display: block; }
.circle-icon { width: 68px; height: 68px; background: white; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--sipe-primary); border: 1px solid var(--sipe-border); transition: border-color 0.15s, box-shadow 0.15s; }
.circle-icon .ico-cat { width: 30px; height: 30px; }
.cat-circle:hover .circle-icon, .cat-circle:focus-visible .circle-icon { border-color: var(--sipe-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.cat-circle:hover { color: var(--sipe-primary); }

/* =========================================
   3. LAYOUT (FILTROS + GRILLA)
========================================= */
.store-layout { display: flex; gap: 30px; align-items: flex-start; }
.filters-sidebar { width: 260px; background: white; padding: 20px; border-radius: 12px; border: 1px solid var(--sipe-border); flex-shrink: 0; position: sticky; top: 20px; }
.filter-header h2 { font-size: 1.15rem; }
.filter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--sipe-border); }
.filter-group { margin-bottom: 25px; }
.filter-group h3, .filter-group h4 { font-size: 0.95rem; margin-bottom: 12px; color: var(--sipe-dark); }
.filter-group ul { list-style: none; }
.filter-group li { margin-bottom: 8px; font-size: 0.85rem; color: var(--text-muted); }
/* Links de subcategoría dentro de una categoría (Plan SEO, Fase 1 Parte 2 —
   reemplazan al viejo checkbox multi-categoría). Un <a> trae su propio
   color/subrayado por defecto que pisa lo heredado de .filter-group li, así
   que necesita su propio estilo — mismo lenguaje visual que .dropdown-item a
   del menú superior (sin subrayado, gris oscuro, violeta al hover) más un
   estado .is-active con relleno sólido, igual criterio que los botones
   .btn-sipe, para que se note cuál subcategoría está seleccionada. */
.subcat-list li { margin-bottom: 4px; }
.subcat-list a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text-main); text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: 0.15s; }
.subcat-list a:hover { background: var(--sipe-light); color: var(--sipe-primary); }
.subcat-list a.is-active { background: var(--sipe-primary); color: white; font-weight: 700; }
/* Filtros por atributo y páginas de faceta (03/10/2026, fases 3 y 4) */
.atributo-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.atributo-list li { margin-bottom: 2px; }
.atributo-list a { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; color: var(--text-main); text-decoration: none; font-size: 0.84rem; }
.atributo-list a:hover { background: var(--sipe-light); color: var(--sipe-primary); }
.atributo-list a.is-active { color: var(--sipe-primary); font-weight: 700; }
.atributo-check { width: 14px; height: 14px; flex: 0 0 14px; border: 1.5px solid var(--sipe-border); border-radius: 3px; background: #fff; }
.atributo-list a.is-active .atributo-check { background: var(--sipe-primary); border-color: var(--sipe-primary); box-shadow: inset 0 0 0 2px #fff; }
.atributo-list .atributo-n { color: var(--text-faint); font-size: 0.78rem; margin-left: auto; }
.faceta-activa { display: inline-flex; align-items: center; gap: 8px; background: var(--sipe-primary); color: #fff; border-radius: 999px; padding: 5px 8px 5px 12px; font-size: 0.82rem; font-weight: 700; }
.faceta-activa a { color: #fff; text-decoration: none; }
.faceta-intro { margin: 6px 0 0; font-size: 0.9rem; color: var(--text-secondary); max-width: 860px; line-height: 1.55; }
.coleccion-gamer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 14px 18px; margin-bottom: 18px; border-radius: 10px; background: var(--sipe-dark, #0f172a); color: #fff; text-decoration: none; }
.coleccion-gamer strong { font-size: 1.05rem; }
.coleccion-gamer span { font-size: .88rem; opacity: .85; }
.coleccion-gamer-cta { margin-left: auto; font-weight: 700; opacity: 1 !important; }
.facetas-populares { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--sipe-border); }
.facetas-populares h2 { font-size: 0.95rem; margin: 0 0 10px; color: var(--text-secondary); }
.facetas-populares ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facetas-populares a { display: inline-block; padding: 6px 12px; border: 1px solid var(--sipe-border); border-radius: 999px; font-size: 0.8rem; color: var(--text-main); text-decoration: none; }
.facetas-populares a:hover { border-color: var(--sipe-primary); color: var(--sipe-primary); }
.facetas-populares a span { color: var(--text-faint); }
.price-inputs { display: flex; align-items: center; gap: 10px; }
.price-inputs input { width: 100%; padding: 8px; border: 1px solid var(--sipe-border); border-radius: 6px; font-size: 0.85rem; }

.store-content { flex: 1; min-width: 0; }
.sorting-bar { display: flex; justify-content: space-between; align-items: center; background: white; padding: 12px 20px; border-radius: 12px; border: 1px solid var(--sipe-border); margin-bottom: 25px; }
.sort-options select { padding: 6px 12px; border: 1px solid var(--sipe-border); border-radius: 6px; font-weight: 500; outline: none; }

/* =========================================
   GRILLA DE PRODUCTOS Y SECCIONES
========================================= */
.section-title h1, .section-title h2 { font-family: var(--font-brand); font-weight: 700; font-size: 1.5rem; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.badge-new { background: var(--danger); color: white; font-size: 0.7rem; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; font-weight: 800; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; transition: opacity 0.15s ease; }
.product-grid.htmx-request { opacity: 0.5; } /* feedback visual mientras el filtro trae resultados por HTMX */
.product-card { background: white; border-radius: 12px; border: 1px solid var(--sipe-border); padding: 15px; display: flex; flex-direction: column; transition: 0.2s; position: relative; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 12px 25px -5px rgba(0,0,0,0.1); border-color: var(--sipe-primary); }
.product-img-wrapper { width: 100%; aspect-ratio: 1; background: #f1f5f9; border-radius: 8px; margin-bottom: 15px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-img-wrapper img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.product-info { display: flex; flex-direction: column; flex: 1; justify-content: space-between; gap: 10px; }
.product-cat { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; }
.product-name { font-size: 0.95rem; line-height: 1.3; font-weight: 600; color: var(--sipe-dark); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price-row { display: flex; justify-content: space-between; align-items: center; }
.price-tag { font-family: var(--font-brand); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--sipe-primary); }
.stock-badge { font-size: 0.75rem; background: #e0e7ff; color: #4338ca; padding: 3px 8px; border-radius: 4px; font-weight: 700; }
.btn-add-cart { width: 100%; margin-top: 10px; }

/* Ofertas con descuento (Producto.en_oferta) — precio normal tachado +
   precio de oferta destacado, y el badge 🔥 sobre la foto del producto. */
.oferta-badge { position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--danger); color: white; font-size: 0.75rem; font-weight: 800; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.02em; }
.price-tag-wrap { display: flex; flex-direction: column; gap: 2px; }
.price-old { font-family: var(--font-brand); font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--text-secondary); text-decoration: line-through; }
.price-tag.price-oferta { color: var(--danger); }
/* 02/10/2026: precio por transferencia y plazo de entrega a la vista en la
   tarjeta (antes el plazo vivía en un tooltip). */
.price-transfer { font-size: 0.85rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-secondary); margin-top: -4px; }
.product-plazo { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: #4338ca; }

/* Franjas de la portada (02/10/2026): las mismas .product-card en un riel
   horizontal con scroll-snap — 4 a la vista en escritorio, 2 en celular. */
.franja { margin-bottom: 44px; }
.franja-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 20px; margin-bottom: 16px; }
.franja-head h2 { font-family: var(--font-brand); font-weight: 700; font-size: 1.5rem; color: var(--sipe-dark); display: flex; align-items: center; gap: 10px; }
.franja-head p { color: var(--text-secondary); font-size: 0.95rem; margin-top: 4px; }
.franja-cta { color: var(--sipe-primary); font-weight: 700; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.franja-cta:hover { color: var(--sipe-primary-hover); }
.franja-track { display: grid; grid-auto-flow: column; grid-auto-columns: max(240px, calc((100% - 60px) / 4)); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 14px; scrollbar-width: thin; }
.franja-track > .product-card { scroll-snap-align: start; }

/* Llegada estimada en el resumen del checkout (02/10/2026). */
.checkout-llegada { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: #e0e7ff; color: #4338ca; font-size: 0.85rem; }
.checkout-llegada p { margin: 0; }
.checkout-llegada .checkout-llegada-nota { margin-top: 4px; font-size: 0.75rem; color: var(--text-secondary); }
.detalle-precio-oferta-wrap { display: flex; align-items: center; gap: 10px; margin-top: 15px; }

/* Botones Genéricos */
.btn-sipe { background: var(--sipe-primary); color: white; padding: 12px 20px; border-radius: 8px; text-decoration: none; font-weight: 700; text-align: center; border: none; cursor: pointer; transition: 0.2s; }
.btn-sipe:hover { background: var(--sipe-primary-hover); }
.btn-small { padding: 8px 15px; font-size: 0.85rem; }
.btn-outline { background: transparent; border: 2px solid var(--sipe-primary); color: var(--sipe-primary); }
.btn-outline:hover { background: var(--sipe-primary); color: white; }
.load-more-container { text-align: center; margin-top: 40px; }
.portada-catalogo { text-align: center; margin: 8px 0 44px; }
.portada-catalogo .btn-sipe { display: inline-flex; align-items: center; gap: 8px; }
/* En una franja temática la categoría de cada tarjeta sobra. */
.franja .product-cat { display: none; }
.stock-badge--pocas { background: var(--color-warning-bg-alt); color: var(--color-warning); }

/* =========================================
   4 Y 7. TRUST BADGES Y FAT FOOTER
========================================= */
.trust-badges { background: white; padding: 40px 20px; border-top: 1px solid var(--sipe-border); border-bottom: 1px solid var(--sipe-border); }
.trust-container { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.trust-item { display: flex; align-items: center; gap: 15px; }
.trust-item i { font-size: 1.9rem; color: var(--sipe-secondary-strong); width: 36px; text-align: center; flex-shrink: 0; }
.trust-text h3 { font-family: var(--font-brand); font-size: 1rem; font-weight: 700; color: var(--sipe-dark); margin-bottom: 2px; }
.trust-text p { font-size: 0.875rem; color: var(--text-secondary); }

.fat-footer { background: var(--sipe-dark); color: #94a3b8; padding-top: 60px; font-size: 0.85rem; }
.footer-container { max-width: 1400px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 40px; margin-bottom: 40px; }
.footer-col h3 { color: white; font-size: 1.05rem; margin-bottom: 20px; font-weight: 600; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: #94a3b8; text-decoration: none; transition: 0.2s; }
.footer-col a:hover { color: white; }
.social-links { display: flex; gap: 15px; margin-top: 20px; }
.social-links a { color: white; font-size: 1.2rem; background: rgba(255,255,255,0.1); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.social-links a:hover { background: var(--sipe-primary); }
.reclamaciones-link { display: inline-block; border: 1px solid #475569; padding: 8px 12px; border-radius: 6px; margin-top: 10px; }
.footer-bottom { background: #090d16; padding: 20px; text-align: center; border-top: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; gap: 10px; }

/* Utilidades */
.mt-2 { margin-top: 15px; }
.d-mobile-only { display: none; }

/* =========================================
   MEDIA QUERIES (MOBILE)
========================================= */
.hamburger-btn { display: none; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

@media screen and (max-width: 1024px) {
    /* 02/10/2026: el bloque grande arriba a todo el ancho y los dos
       laterales LADO A LADO (antes apilados): la primera pantalla del
       celular muestra el titular y las dos puertas, Ofertas y Zona Gamer. */
    .hero-main h1, .hero-slide-titulo { font-size: 2.1rem; }
    .trust-container { grid-template-columns: repeat(2, 1fr); gap: 30px; }
    .footer-container { grid-template-columns: repeat(2, 1fr); }
}

@media screen and (max-width: 768px) {
    /* Auditoría responsive 22/09/2026 (B5): la cabecera ocupaba 225px de
       812 (barra superior de 2 líneas + logo + fila de acciones + buscador)
       y no era fija. Ahora: barra superior de 1 línea (solo la promo),
       una sola fila logo | acciones (con hamburguesa a la izquierda),
       buscador debajo, y la cabecera se queda pegada arriba al hacer
       scroll. Total ≈ 110px. */
    .top-bar { padding: 6px 12px; font-size: 0.78rem; justify-content: center; }
    .top-bar .top-contact { display: none; }
    .sipe-header { position: sticky; top: 0; z-index: 900; flex-wrap: wrap; padding: 8px 12px 10px 52px; gap: 8px 10px; align-items: center; }
    .brand-logo { flex: 1; justify-content: flex-start; min-width: 0; }
    .brand-logo { --logo-h: 50px; gap: 10px; }
    .brand-logo .logo-text { font-size: var(--text-xs); padding-left: 10px; margin-top: 5px; height: 30px; }
    .header-search { order: 3; flex: 1 0 100%; max-width: none; }
    .header-actions { width: auto; order: 2; gap: 8px; padding: 0; border: 0; position: relative; }
    .header-actions .action-label { display: none; }
    .header-actions .action-btn { min-height: 40px; display: inline-flex; align-items: center; padding: 0 6px; }
    .search-input { height: 40px; }

    .hamburger-btn { display: flex; align-items: center; justify-content: center; order: 1; position: absolute; left: 6px; top: 8px; width: 40px; height: 40px; }

    /* Menú Off-Canvas */
    .sipe-nav { position: fixed; top: 0; left: -100%; width: 280px; height: 100vh; background: var(--sipe-dark); flex-direction: column; padding: 60px 20px 20px; transition: 0.3s ease; z-index: 1000; overflow-y: auto; }
    .sipe-nav.active { left: 0; }
    .nav-menu { flex-direction: column; width: 100%; }
    .dropdown-menu { position: static; background: rgba(255,255,255,0.05); border: none; border-left: 2px solid var(--sipe-primary); border-radius: 0; box-shadow: none; display: none; margin-left: 15px; margin-top: 5px; }
    .nav-item.open .dropdown-menu { display: block; }
    .nav-link { color: white; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .dropdown-item a { color: #cbd5e1; }

    /* Layout Sidebar Modal */
    .d-mobile-only { display: block; }
    .store-layout { flex-direction: column; gap: 15px; }
    .filters-sidebar { position: fixed; top: 0; left: -100%; width: 80%; max-width: 300px; height: 100vh; z-index: 2000; border-radius: 0; transition: 0.3s; overflow-y: auto; box-shadow: 5px 0 15px rgba(0,0,0,0.5); }
    .filters-sidebar.active { left: 0; }
    .close-filters-btn, .open-filters-btn { background: var(--sipe-primary); color: white; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; }
    .close-filters-btn { background: var(--sipe-dark); }
    .sorting-bar { flex-direction: column; gap: 15px; align-items: stretch; }
    
    .hero { grid-template-columns: 1fr 1fr; grid-template-rows: auto; gap: 12px; min-height: 0; margin-bottom: 16px; }
    .hero-main { grid-row: auto; grid-column: 1 / -1; }
    .hero-slide { padding: 24px 18px 52px; background: linear-gradient(rgba(15,23,42,0.62), rgba(15,23,42,0.84)), var(--hero-img) center right/cover no-repeat; }
    .hero-slide { --hero-img: var(--img-sm, none); }
    .hero-carrusel:not(.hero-carrusel--listo) .hero-slide:not(:first-child) { --hero-img: none; }
    .hero-controles { left: 50%; transform: translateX(-50%); bottom: 12px; }
    .hero-cuadro--ofertas, .hero-cuadro--suministros { background-image: var(--img-sm); }
    .hero-main h1, .hero-slide-titulo { font-size: 1.7rem; }
    .hero-main p { font-size: 0.95rem; margin-bottom: 16px; }
    .hero-btn { align-self: stretch; justify-content: center; }
    .hero-cuadro { padding: 16px 14px; min-height: 150px; justify-content: flex-end; }
    .hero-cuadro::before { background: linear-gradient(0deg, rgba(15,23,42,0.88) 0%, rgba(15,23,42,0.45) 70%, rgba(15,23,42,0.15) 100%); }
    .hero-cuadro h2 { font-size: 1.05rem; }
    .hero-cuadro p { font-size: 0.85rem; }
    .hero-cuadro-link { font-size: 0.85rem; margin-top: 6px; }
    .main-wrapper .trust-badges { padding: 16px; margin-bottom: 22px; }
    .main-wrapper .trust-container { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
    .main-wrapper .trust-item { gap: 10px; align-items: flex-start; }
    .main-wrapper .trust-item i { font-size: 1.3rem; width: 24px; }
    .main-wrapper .trust-text h3 { font-size: 0.9rem; }
    .main-wrapper .trust-text p { font-size: 0.8rem; }
    .nav-todas { display: none; }
    .quick-categories { margin-bottom: 26px; }
    .category-circles { justify-content: flex-start; }
    .cat-circle { min-width: 76px; font-size: 0.8rem; }
    .circle-icon { width: 58px; height: 58px; border-radius: 14px; }
    .circle-icon .ico-cat { width: 26px; height: 26px; }
    .franja-head h2 { font-size: 1.25rem; }
    .franja-track { grid-auto-columns: calc((100% - 12px) / 2); gap: 12px; }
    .franja-track > .product-card { padding: 10px; }
    .franja-track .price-tag { font-size: 1.15rem; }

    .trust-container { grid-template-columns: 1fr; }
    .footer-container { grid-template-columns: 1fr; text-align: center; }
    .social-links { justify-content: center; }
    .payment-methods { justify-content: center; display: flex; gap: 10px; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }


/* =========================================
   5. DETALLE DE PRODUCTO, CARRITO, CHECKOUT Y PEDIDOS
   (compra sin cuenta: se identifica al cliente por DNI/RUC + teléfono)
========================================= */
.breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--sipe-primary); }

.detalle-layout { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 40px; background: white; border: 1px solid var(--sipe-border); border-radius: 12px; padding: 30px; margin-bottom: 40px; }
.detalle-galeria { display: flex; flex-direction: column; gap: 12px; }
.detalle-img { width: 100%; aspect-ratio: 1; background: #f1f5f9; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.detalle-img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }

/* Miniaturas de la galería (varias fotos por producto): fila horizontal,
   con scroll propio si son muchas, para no empujar el resto de la ficha
   fuera de la primera pantalla. */
.detalle-miniaturas { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.detalle-miniatura { flex: 0 0 auto; width: 60px; height: 60px; padding: 0; background: #f1f5f9; border: 2px solid transparent; border-radius: 8px; cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: border-color 0.15s ease; }
.detalle-miniatura img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.detalle-miniatura:hover { border-color: var(--sipe-border); }
.detalle-miniatura.activa { border-color: var(--sipe-primary); }
.detalle-info h1 { font-family: var(--font-brand); font-size: 1.6rem; margin-bottom: 10px; color: var(--sipe-dark); }
.detalle-precio { font-family: var(--font-tech); font-size: 2rem; font-weight: 700; color: var(--sipe-primary); margin: 15px 0; }
.detalle-stock { font-size: 0.85rem; font-weight: 600; margin-bottom: 20px; }
.detalle-stock.disponible { color: #16a34a; }
.detalle-stock.agotado { color: var(--danger); }
.cantidad-selector { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.cantidad-selector input { width: 70px; padding: 10px; border: 1px solid var(--sipe-border); border-radius: 6px; text-align: center; }
.relacionados-title { font-family: var(--font-brand); font-weight: 700; font-size: 1.2rem; margin-bottom: 15px; }

/* --- Carrito --- */
.carrito-item { display: grid; grid-template-columns: 70px 1fr auto auto auto; gap: 15px; align-items: center; background: white; border: 1px solid var(--sipe-border); border-radius: 10px; padding: 15px; margin-bottom: 12px; }
.carrito-item img { width: 70px; height: 70px; object-fit: contain; mix-blend-mode: multiply; background: #f1f5f9; border-radius: 8px; }
.carrito-item-nombre { font-weight: 600; color: var(--sipe-dark); font-size: 0.9rem; }
.carrito-item-precio { font-family: var(--font-tech); color: var(--text-muted); font-size: 0.85rem; }
.carrito-item form { display: flex; align-items: center; gap: 8px; }
.carrito-item input[type="number"] { width: 55px; padding: 6px; border: 1px solid var(--sipe-border); border-radius: 6px; text-align: center; }
.carrito-item-subtotal { font-family: var(--font-tech); font-weight: 700; color: var(--sipe-dark); }
.btn-eliminar { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1rem; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; } /* auditoría responsive 22/09/2026 (B4): 14x18px era muy chico para el dedo */
.carrito-resumen { background: white; border: 1px solid var(--sipe-border); border-radius: 12px; padding: 25px; position: sticky; top: 20px; }
.carrito-resumen .total-row { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; margin: 15px 0; font-family: var(--font-tech); }
.carrito-layout { display: grid; grid-template-columns: 1fr 300px; gap: 30px; align-items: start; }
.carrito-vacio { text-align: center; padding: 60px 20px; color: var(--text-muted); background: white; border-radius: 12px; border: 1px solid var(--sipe-border); }

/* --- Formularios (checkout / mis compras) --- */
.form-card { background: white; border: 1px solid var(--sipe-border); border-radius: 12px; padding: 30px; }
.form-grupo { margin-bottom: 18px; }
.form-grupo label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--sipe-dark); margin-bottom: 6px; }
.form-grupo input, .form-grupo textarea, .form-grupo select { width: 100%; padding: 11px 14px; border: 1px solid var(--sipe-border); border-radius: 8px; font-size: 0.9rem; font-family: var(--font-ui); background: #fff; }
.form-grupo input:focus, .form-grupo textarea:focus, .form-grupo select:focus { outline: none; border-color: var(--sipe-primary); }
.form-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
/* Selects en cascada Departamento/Provincia/Distrito del checkout (ver
   app/static/js/ubigeo_selector.js) — 3 columnas en vez de las 2 de
   .form-fila, con el mismo breakpoint móvil de apilar a 1 columna. */
.form-fila-ubigeo { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-nota { font-size: 0.78rem; color: var(--text-muted); margin-top: -10px; margin-bottom: 18px; }
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 30px; align-items: start; }
.checkout-resumen-item { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 8px 0; border-bottom: 1px solid var(--sipe-border); }
.form-card-compacta { max-width: 560px; margin: 0 auto; }

/* --- Selector de forma de pago (checkout): hoy solo hay una opción
   (depósito/transferencia), pero se deja como clase — no inline —
   porque el comentario del template ya anticipa sumar otras formas de
   pago sin rediseñar la pantalla (ver Pedido.forma_pago en app/models.py). --- */
.forma-pago-opcion { border: 1px solid var(--sipe-border-strong); border-radius: 8px; padding: 12px 14px; }
.forma-pago-opcion label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 400; }
/* .form-grupo input (arriba) le mete a TODO input dentro de un .form-grupo
   ancho 100%/padding/borde de caja de texto — como el radio nativo vive
   dentro del .form-grupo "Forma de pago", sin este reset se deforma en un
   rectángulo enorme (hallazgo del usuario). Mismo criterio que ya usa el
   checkbox de "Términos y Condiciones" (ver
   macros/main_components.html::consentimiento_legal_checkbox): se
   resetea a su tamaño nativo y se ancla arriba, pegado al texto. */
.forma-pago-opcion input[type="radio"] { width: auto; height: auto; margin: 3px 0 0; padding: 0; border: revert; border-radius: revert; background: revert; flex-shrink: 0; accent-color: var(--sipe-primary); }
.forma-pago-opcion .forma-pago-ayuda { font-size: 0.82rem; color: var(--text-muted); }
/* Ícono genérico de depósito/transferencia (Font Awesome, mismo criterio
   que admin/depositos_pendientes.html) y logos oficiales de Izipay/tarjetas
   aceptadas (alojados en app/static/img/pagos/, ver github.com/izipay-pe/Imagenes).
   .forma-pago-contenido/.forma-pago-titulo arman esto con flexbox (gap fijo)
   en vez de <br> sueltos entre imágenes de alto distinto — eso dejaba
   espaciados inconsistentes y se veía desordenado. */
.forma-pago-opcion .forma-pago-icono { color: var(--sipe-primary); margin-right: 2px; }
.forma-pago-opcion .forma-pago-contenido { display: flex; flex-direction: column; gap: 6px; }
.forma-pago-opcion .forma-pago-titulo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* width:auto + object-fit:contain para que respeten su proporción real —
   .forma-pago-contenido es un flex en columna, y por defecto (align-self:
   stretch) estira a sus hijos al ancho completo del contenedor; con solo
   `height` fijo eso deformaba tarjetas-aceptadas.png (hallazgo del
   usuario). align-self:flex-start en esa imagen puntual corta el estirado
   sin tocar el resto del layout. */
.forma-pago-opcion .forma-pago-logo-izipay { height: 15px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.forma-pago-opcion .forma-pago-logo-tarjetas { height: 13px; width: auto; max-width: 100%; object-fit: contain; align-self: flex-start; display: block; }

/* --- Selector de moneda (S//US$) dentro de la opción "Pagar con tarjeta
   (Izipay)" — discreto e indentado bajo el texto de esa opción (26px ≈
   ancho del radio + su gap, para que quede alineado con "Pagar con
   tarjeta" de arriba), con una simple línea punteada arriba en vez de una
   caja con borde/fondo propios — esa caja competía visualmente con el
   botón "Confirmar pedido" (hallazgo del usuario, ver DEUDA_TECNICA.md
   punto 31 y el siguiente punto sobre este ajuste). Etiqueta en minúsculas
   y peso medio, no todo-mayúsculas, para no competir en jerarquía con el
   título "Forma de pago". --- */
.forma-pago-moneda { margin: 10px 0 0 26px; padding-top: 10px; border-top: 1px dashed var(--sipe-border-strong); }
.forma-pago-moneda-etiqueta { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.forma-pago-moneda-toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.forma-pago-moneda-pill { flex: 1 1 120px; display: flex; align-items: baseline; justify-content: center; gap: 4px 6px; padding: 6px 10px; border: 1px solid var(--sipe-border-strong); border-radius: 8px; cursor: pointer; font-size: 0.82rem; font-weight: 400; background: white; text-align: center; }
.forma-pago-moneda-pill strong { font-size: 0.82rem; }
.forma-pago-moneda-pill input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.forma-pago-moneda-pill:has(input:checked) { border-color: var(--sipe-primary); background: color-mix(in srgb, var(--sipe-primary) 10%, white); font-weight: 600; }
.forma-pago-moneda.forma-pago-moneda-inactiva { opacity: 0.5; }
.forma-pago-moneda.forma-pago-moneda-inactiva .forma-pago-moneda-pill { cursor: default; }

/* --- Botones con ícono a ancho completo (checkout / pago / confirmación) --- */
.btn-full { width: 100%; }
.btn-icono { display: inline-flex; align-items: center; gap: 8px; }
.btn-icono.btn-full { justify-content: center; }

/* --- Aviso de comprobante rechazado / en revisión (pago por depósito) --- */
.aviso-caja { padding: 12px 14px; margin-bottom: 15px; border-radius: 8px; font-size: 0.85rem; }
.aviso-caja.aviso-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }
.aviso-caja.aviso-success { background: var(--color-success-bg); color: var(--color-success-text); }

/* --- Datos de la cuenta bancaria (pago por depósito) --- */
.cuenta-bancaria-caja { background: var(--sipe-light); border: 1px dashed var(--sipe-border-strong); border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.cuenta-bancaria-caja__eyebrow { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 10px; }
.cuenta-bancaria-caja p { font-size: 0.95rem; margin-bottom: 6px; }
.cuenta-bancaria-caja p:last-child { margin-bottom: 0; }
.cuenta-bancaria-caja__cuenta + .cuenta-bancaria-caja__cuenta { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--sipe-border-strong); }

/* --- Confirmación de pedido / seguimiento --- */
.confirmacion-card { background: white; border: 1px solid var(--sipe-border); border-radius: 12px; padding: 40px; text-align: center; max-width: 560px; margin: 0 auto 40px; }
.confirmacion-card i.fa-circle-check { font-size: 3rem; color: #16a34a; margin-bottom: 15px; }
.codigo-pedido { font-family: var(--font-tech); font-size: 1.3rem; font-weight: 700; background: #f1f5f9; padding: 10px 20px; border-radius: 8px; display: inline-block; margin: 15px 0; }
.btn-whatsapp { background: #25d366; }
.btn-whatsapp:hover { background: #1da851; }

/* --- Avisos de estado según Pedido.estado_pago (confirmación de pedido) --- */
.aviso-confirmacion { padding: 14px 16px; margin-bottom: 20px; border-radius: 10px; text-align: left; font-size: 0.9rem; }
.aviso-confirmacion.aviso-dashed { background: var(--sipe-light); border: 1px dashed var(--sipe-border-strong); }
.aviso-confirmacion.aviso-success { background: var(--color-success-bg); border: 1px solid var(--sipe-border); }
.aviso-confirmacion.aviso-danger { background: var(--color-danger-bg); border: 1px solid var(--sipe-border); }

.estado-pedido { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; letter-spacing: 0.3px; }
.estado-pendiente { background: #fef3c7; color: #92400e; }
.estado-confirmado { background: #dbeafe; color: #1e40af; }
.estado-enviado { background: #e0e7ff; color: #4338ca; }
.estado-entregado { background: #dcfce7; color: #166534; }
.estado-cancelado { background: #fee2e2; color: #991b1b; }

.pedido-card { background: white; border: 1px solid var(--sipe-border); border-radius: 10px; padding: 20px; margin-bottom: 15px; }
.pedido-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.pedido-card-items { font-size: 0.85rem; color: var(--text-muted); }

@media screen and (max-width: 768px) {
    .detalle-layout { grid-template-columns: 1fr; }
    .carrito-layout, .checkout-layout { grid-template-columns: 1fr; }
    /* Auditoría responsive 22/09/2026 (B2): en una columna, el resumen del
       pedido (total + cupón) va ANTES del formulario, para que el cliente
       vea qué paga y pueda aplicar su cupón antes de "Confirmar pedido". */
    .checkout-layout .carrito-resumen { order: -1; }
    .carrito-item { grid-template-columns: 60px 1fr; }
    .carrito-item form, .carrito-item-subtotal, .btn-eliminar { grid-column: 1 / -1; justify-self: start; }
    .form-fila { grid-template-columns: 1fr; }
    .form-fila-ubigeo { grid-template-columns: 1fr; }
}

/* =========================================================
   AUDITORÍA RESPONSIVE 22/09/2026 (B6) — tablet en vertical (769–1024px):
   el checkout mantiene dos columnas pero con el resumen más angosto, y la
   grilla de productos muestra 3 por fila.
   ========================================================= */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .checkout-layout { grid-template-columns: 1fr 300px; gap: 20px; }
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .sipe-header { padding: 15px 20px; gap: 15px; }
}

/* =========================================================
   AUDITORÍA RESPONSIVE 22/09/2026 (B3) — Safari en iPhone hace zoom a toda
   la página al tocar un campo con letra menor a 16px, y no vuelve solo.
   Los campos del sitio usan 0.9rem (14.4px). En pantallas táctiles se
   fuerzan 16px; en escritorio no cambia nada.
   ========================================================= */
@media screen and (max-width: 768px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* =========================================================
   FIX: ANTI-DESBORDAMIENTO HORIZONTAL (MOBILE)
   ========================================================= */

/* 1. Candado maestro: Bloquea el scroll fantasma a nivel global */
html, body {
    overflow-x: hidden;
    /* Auditoría responsive 22/09/2026 (B5): "hidden" convierte a html/body en
       contenedor de scroll y anula position: sticky en la cabecera. "clip"
       recorta igual sin crear scroll (Chrome 90+, Safari 16+); los navegadores
       viejos ignoran esta línea y se quedan con "hidden". */
    overflow-x: clip;
    width: 100%;
    max-width: 100vw;
}

@media screen and (max-width: 768px) {
    /* 2. (03/10/2026) El tamaño del título del hero en celular ahora vive en .hero-main h1. */
    
    /* 3. Evitar que el buscador sume ancho extra sobre los paddings */
    .header-search {
        min-width: 0 !important;
        width: 100%;
    }

    /* 4. Proteger la grilla en celulares muy estrechos (ej. iPhone SE) */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)) !important;
    }
}

/* =========================================================
   UTILIDADES DE ESPACIADO Y TEXTO (Fase P, 29/08/2026)
   Van al final del archivo a propósito: son de un solo nivel de
   especificidad (una sola clase), así que necesitan ir después de
   clases de componente como .form-nota para poder pisar su margen
   por defecto cuando una pantalla puntual necesita otro valor (ver
   checkout.html y mis_compras.html, que combinan "form-nota mb-3").
   Completan la utilidad .mt-2 que ya existía más arriba.
========================================= */
.mt-1 { margin-top: 10px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 15px; }
.mb-3 { margin-bottom: 20px; }

/* Texto secundario reutilizable (notas, metadatos, ayudas de formulario).
   Los tamaños via clase pisan visualmente algunos valores puntuales que
   antes eran inline (0.8rem/0.82rem -> 0.8rem, 0.85rem exactos): la
   diferencia es de menos de 1px y unifica la escala tipográfica de estas
   4 pantallas sin tocar el resto del sitio (ver plan-integracion-sipe-pe.md,
   Fase P, sobre por qué no se adoptó la escala --text-* de tokens acá). */
.texto-muted { color: var(--text-muted); }
.texto-muted-xs { font-size: 0.8rem; color: var(--text-muted); }
.texto-muted-sm { font-size: 0.85rem; color: var(--text-muted); }
.texto-muted-md { font-size: 0.9rem; color: var(--text-muted); }

/* =========================================================
   PÁGINAS LEGALES Y DE ATENCIÓN AL CLIENTE (Fase S.4, 07/09/2026)
   Términos, Política de Devolución, Política de Privacidad, FAQ,
   Soporte Técnico y Contacto — reusan .form-card/.section-title de
   arriba para la coherencia visual del resto de la tienda; estas clases
   son solo lo que faltaba para texto largo en prosa (que .form-card no
   necesitaba antes, pensado para formularios cortos).
   ========================================================= */
.legal-page { max-width: 760px; margin: 0 auto; }
.legal-page h2 { font-family: var(--font-brand); font-size: var(--text-2xl); color: var(--sipe-dark); margin: 28px 0 12px; }
.legal-page h2:first-child { margin-top: 0; }
/* Subtítulos por categoría dentro de una sección h2 — ej. la
   clasificación por tipo de producto en politica_devolucion.html. Más
   chico y sin el font-brand del h2 para que se lea claramente como un
   nivel debajo, no como otra sección nueva. */
.legal-page h3 { font-size: 1.05rem; font-weight: 700; color: var(--sipe-dark); margin: 20px 0 8px; }
.legal-page p { margin-bottom: 14px; line-height: 1.65; }
.legal-page ul, .legal-page ol { margin: 0 0 14px 22px; line-height: 1.65; }
.legal-page li { margin-bottom: 6px; }
.legal-page strong { color: var(--sipe-dark); }

/* Preguntas frecuentes: <details>/<summary> nativo, sin JS — mismo
   criterio que los grupos colapsables del sidebar admin
   (admin/_sidebar_nav.html). */
.faq-item { background: white; border: 1px solid var(--sipe-border); border-radius: 10px; padding: 4px 20px; margin-bottom: 12px; }
.faq-item summary { padding: 14px 0; font-weight: 700; color: var(--sipe-dark); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "\f107"; font-family: "Font Awesome 6 Free"; font-weight: 900; color: var(--text-faint); transition: transform 0.15s; }
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p { padding-bottom: 16px; color: var(--text-muted); margin-bottom: 0; }

/* Contacto: una tarjeta por área — mismo look que .pedido-card (borde +
   radio + padding), en grilla para que se acomoden solas según el ancho. */
.contacto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.contacto-card { background: white; border: 1px solid var(--sipe-border); border-radius: 10px; padding: 20px; }
.contacto-card h4 { font-family: var(--font-brand); font-size: 1rem; color: var(--sipe-dark); margin-bottom: 6px; }
.contacto-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.contacto-card a { font-family: var(--font-tech); font-size: 0.85rem; color: var(--sipe-primary); font-weight: 700; text-decoration: none; word-break: break-all; }
.contacto-card a:hover { text-decoration: underline; }

/* Ficha técnica legible (04/10/2026, app/catalogo/ficha.py) */
.ficha-tecnica { margin-top: 32px; max-width: 1040px; }
.ficha-esenciales { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.ficha-esenciales li { background: var(--sipe-light, #f5f3ff); border: 1px solid var(--sipe-border, #e2e8f0); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.ficha-esencial-etiqueta { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint, #64748b); }
.ficha-esenciales strong { font-size: .98rem; color: var(--text-main, #0f172a); line-height: 1.3; }
.ficha-secciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.ficha-seccion { border: 1px solid var(--sipe-border, #e2e8f0); border-radius: 10px; background: #fff; overflow: hidden; }
.ficha-seccion summary { cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 700; font-size: .95rem; color: var(--text-main, #0f172a); display: flex; align-items: center; gap: 8px; }
.ficha-seccion summary::-webkit-details-marker { display: none; }
.ficha-seccion summary::after { content: "+"; margin-left: auto; font-weight: 400; font-size: 1.2rem; color: var(--text-faint, #64748b); }
.ficha-seccion[open] summary::after { content: "−"; }
.ficha-seccion[open] summary { border-bottom: 1px solid var(--sipe-border, #e2e8f0); }
.ficha-n { font-size: .72rem; font-weight: 600; color: var(--text-faint, #64748b); background: var(--sipe-light, #f1f5f9); border-radius: 999px; padding: 1px 8px; }
.ficha-seccion dl { margin: 0; padding: 4px 16px 10px; }
.ficha-fila { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--sipe-border, #e2e8f0); font-size: .88rem; line-height: 1.45; }
.ficha-fila:last-child { border-bottom: 0; }
.ficha-fila dt { color: var(--text-secondary, #475569); font-weight: 600; }
.ficha-fila dd { margin: 0; color: var(--text-main, #0f172a); overflow-wrap: anywhere; }
.ficha-fila dd ul { margin: 0; padding-left: 18px; }
.ficha-fila dd li { margin: 2px 0; }
@media (max-width: 768px) {
    .ficha-secciones { grid-template-columns: 1fr; }
    .ficha-esenciales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ficha-fila { grid-template-columns: 42% 1fr; gap: 10px; font-size: .86rem; }
}
.descripcion-sipe-lista { margin: 4px 0 12px; padding-left: 20px; font-size: .93rem; color: #1e293b; line-height: 1.65; }
.detalle-promo-vigente { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 5px 10px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: .84rem; font-weight: 600; }

/* =========================================================
   CELULAR 06/10/2026 — filtros y listados
   1. Grupos de filtros plegables (<details>): sin barra de scroll
      dentro del cajón que ya scrollea, y Aplicar/Limpiar siempre a mano
      (fijos al pie del cajón).
   2. Listados de categoría/búsqueda a 2 por fila con la tarjeta
      compacta de las franjas de la portada (antes 1 por fila, ~600 px
      por producto). En pantallas de menos de 340 px vuelve a 1.
   En escritorio no cambia nada.
   ========================================================= */
.filter-atributo > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filter-atributo > summary::-webkit-details-marker { display: none; }
.filter-atributo > summary h3 { margin-bottom: 0; }
.filter-atributo > summary::after { content: "+"; font-weight: 700; color: var(--text-secondary); font-size: 1.1rem; line-height: 1; }
.filter-atributo[open] > summary::after { content: "\2212"; }
.filter-atributo[open] > summary { margin-bottom: 12px; }

@media screen and (max-width: 768px) {
    .filters-sidebar { height: 100vh; height: 100dvh; padding-bottom: 0; }
    .sipe-nav { height: 100vh; height: 100dvh; }
    .filters-sidebar .atributo-list { max-height: none; overflow: visible; }
    .filters-sidebar .filter-group { margin-bottom: 18px; }
    .filters-sidebar .filter-atributo > summary { min-height: 40px; }
    .filtros-acciones { position: sticky; bottom: 0; background: white; margin: 0 -20px; padding: 6px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--sipe-border); box-shadow: 0 -6px 12px rgba(15, 23, 42, 0.06); }

    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
    .product-grid .product-card { padding: 10px; }
    .product-grid .product-card:hover { transform: none; }
    .product-grid .product-img-wrapper { margin-bottom: 10px; }
    .product-grid .product-info { gap: 6px; }
    .product-grid .product-cat { display: none; }
    .product-grid .product-name { font-size: 0.88rem; }
    .product-grid .product-price-row { flex-wrap: wrap; gap: 4px; align-items: flex-start; }
    .product-grid .price-tag { font-size: 1.15rem; }
    .product-grid .price-old { font-size: 0.78rem; }
    .product-grid .price-transfer, .product-grid .product-plazo { font-size: 0.78rem; }
    .product-grid .stock-badge { font-size: 0.7rem; padding: 2px 6px; }
    .product-grid .btn-add-cart { padding: 9px 6px; font-size: 0.8rem; }
    .product-grid .oferta-badge { top: 6px; left: 6px; font-size: 0.68rem; padding: 2px 7px; }
}
@media screen and (max-width: 339px) {
    .product-grid { grid-template-columns: 1fr !important; }
}
