/* ============================================================
   INDUSTRIAS PROTEX — Catálogo
   Modo Operate: encontrar un producto y sumarlo a la consulta.
   Las fotos van tal como las entrega el cliente.
   ============================================================ */

.tienda {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: clamp(1.75rem, 3.5vw, 3.5rem);
    align-items: start;
    padding-block: clamp(2.5rem, 4.5vw, 4rem) clamp(4rem, 8vw, 7rem);
}

/* ------------------------------------------------------------
   Filtros
   ------------------------------------------------------------ */
.filtros {
    position: sticky;
    top: calc(var(--alto-nav) + 1.5rem);
    max-height: calc(100dvh - var(--alto-nav) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: .35rem;
}

.filtros__grupo { padding-block: 1.4rem; border-top: 1px solid var(--linea); }
.filtros__grupo:first-of-type { padding-top: 0; border-top: 0; }

.filtros__titulo {
    font-family: var(--texto);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tinta-40);
    margin-bottom: .85rem;
}

.filtros__lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }

.opcion {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .5rem .6rem;
    border: 0;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--texto);
    font-size: .9375rem;
    color: var(--tinta-60);
    transition: background-color var(--rapido) var(--salida), color var(--rapido) var(--salida);
}
.opcion span:first-of-type { flex: 1; min-width: 0; }
.opcion__cuenta { font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--tinta-40); }

.opcion::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid var(--linea);
    transition: background-color var(--rapido) var(--salida),
                border-color var(--rapido) var(--salida),
                scale var(--rapido) var(--salida);
}

@media (hover: hover) and (pointer: fine) {
    .opcion:hover { background: var(--nieve); color: var(--tinta); }
    .opcion:hover::before { border-color: var(--azul-200); }
}

.opcion[aria-pressed="true"] { color: var(--azul-texto); font-weight: 600; background: var(--azul-tenue); }
.opcion[aria-pressed="true"]::before { background: var(--azul); border-color: var(--azul); scale: 1.15; }
.opcion[aria-pressed="true"] .opcion__cuenta { color: var(--azul-texto); }

.opcion--marca { gap: .6rem; padding-block: .45rem; }
.opcion--marca img {
    width: 42px;
    height: 22px;
    object-fit: contain;
    object-position: left center;
    flex: none;
}

/* Al cambiar de línea la lista de marcas se rehace: entra suave */
.filtros__lista .aparece { animation: aparece 320ms var(--salida) both; }
@keyframes aparece {
    from { opacity: 0; translate: 0 -4px; }
    to   { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    .filtros__lista .aparece { animation: none; }
}

.filtros__limpiar {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: 1.25rem;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--azul-texto);
}
.filtros__limpiar svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.filtros__limpiar[hidden] { display: none; }

/* ------------------------------------------------------------
   Barra de resultados
   ------------------------------------------------------------ */
.barra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--linea);
}

.barra__conteo {
    font-size: .875rem;
    color: var(--tinta-60);
    font-variant-numeric: tabular-nums;
    margin-right: auto;
}
.barra__conteo strong { color: var(--tinta); font-weight: 600; }

.buscador { position: relative; flex: 1 1 200px; min-width: 0; max-width: 300px; }
.buscador svg {
    position: absolute;
    left: 13px; top: 50%;
    translate: 0 -50%;
    width: 16px; height: 16px;
    stroke: var(--tinta-40);
    stroke-width: 1.8;
    fill: none;
    pointer-events: none;
}
.buscador input {
    width: 100%;
    padding: .62rem 2.3rem .62rem 2.4rem;
    border: 1px solid var(--linea);
    border-radius: 999px;
    background: var(--nieve);
    color: var(--tinta);
    font-family: var(--texto);
    font-size: .875rem;
    transition: border-color var(--rapido) var(--salida), box-shadow var(--rapido) var(--salida), background-color var(--rapido) var(--salida);
}
.buscador input::-webkit-search-cancel-button,
.buscador input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.buscador input:focus-visible {
    outline: none;
    background: #fff;
    border-color: var(--azul);
    box-shadow: 0 0 0 3px rgba(19, 25, 54, .16);
}
.buscador__limpiar {
    position: absolute;
    right: 7px; top: 50%;
    translate: 0 -50%;
    display: grid;
    place-items: center;
    width: 26px; height: 26px;
    border: 0;
    border-radius: 999px;
    background: var(--linea-suave);
    cursor: pointer;
    color: var(--tinta-60);
}
.buscador__limpiar svg { position: static; translate: none; width: 12px; height: 12px; stroke: currentColor; }
.buscador__limpiar[hidden] { display: none; }

.orden { position: relative; flex: none; }
.orden select {
    appearance: none;
    padding: .62rem 2.2rem .62rem .9rem;
    border: 1px solid var(--linea);
    border-radius: 999px;
    background: #fff;
    color: var(--tinta);
    font-family: var(--texto);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
}
.orden svg {
    position: absolute;
    right: 12px; top: 50%;
    translate: 0 -50%;
    width: 14px; height: 14px;
    stroke: var(--tinta-60);
    stroke-width: 2;
    fill: none;
    pointer-events: none;
}
.orden select:focus-visible { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(19, 25, 54, .16); }

.vista {
    display: flex;
    flex: none;
    padding: 3px;
    border: 1px solid var(--linea);
    border-radius: 999px;
}
.vista button {
    display: grid;
    place-items: center;
    width: 34px; height: 30px;
    border: 0;
    border-radius: 999px;
    background: none;
    cursor: pointer;
    color: var(--tinta-40);
    transition: background-color var(--rapido) var(--salida), color var(--rapido) var(--salida);
}
.vista svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.9; fill: none; }
.vista button[aria-pressed="true"] { background: var(--azul); color: #fff; }

.btn-filtros { display: none; }

/* Fichas de filtro aplicado */
.aplicados { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.5rem; }
.aplicados[hidden] { display: none; }
.aplicado {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .32rem .5rem .32rem .8rem;
    border: 1px solid var(--azul-200);
    border-radius: 999px;
    background: var(--azul-tenue);
    color: var(--azul-texto);
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
}
.aplicado svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2.2; fill: none; }
@media (hover: hover) and (pointer: fine) {
    .aplicado:hover { background: var(--azul-200); }
}

/* ------------------------------------------------------------
   Tarjeta de producto: borde fino y un más para sumar
   ------------------------------------------------------------ */
.rejilla {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
    gap: clamp(1rem, 1.8vw, 1.5rem);
}

.producto {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    background: #fff;
    overflow: hidden;
    transition: border-color var(--medio) var(--salida),
                box-shadow var(--medio) var(--salida),
                transform var(--medio) var(--salida);
}

.producto__caja {
    display: grid;
    grid-template-rows: auto 1fr;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.producto__foto {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-bottom: 1px solid var(--linea-suave);
}
.producto__foto img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: scale 700ms var(--salida);
}

.producto__cuerpo {
    display: grid;
    align-content: start;
    gap: .15rem;
    padding: .85rem .95rem 1rem;
}

.producto__tipo {
    font-family: var(--display);
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--tinta);
    padding-right: 2.2rem;
    transition: color var(--rapido) var(--salida);
}
.producto__marca { font-size: .8125rem; color: var(--azul-texto); font-weight: 500; }
.producto__codigo { font-size: .75rem; color: var(--tinta-40); font-variant-numeric: tabular-nums; }

/* El más vive sobre la tarjeta, no dentro del botón que abre la ficha */
.producto__sumar {
    position: absolute;
    right: .7rem;
    bottom: .75rem;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border: 1px solid var(--linea);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    color: var(--azul-texto);
    transition: background-color var(--rapido) var(--salida),
                border-color var(--rapido) var(--salida),
                color var(--rapido) var(--salida),
                transform var(--rapido) var(--salida);
}
.producto__sumar svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.producto__sumar .icono-check { display: none; }

@media (hover: hover) and (pointer: fine) {
    .producto__sumar:hover { background: var(--azul); border-color: var(--azul); color: #fff; }
    .producto:hover { border-color: var(--azul-200); box-shadow: var(--sombra-2); transform: translateY(-3px); }
    .producto:hover .producto__foto img { scale: 1.05; }
    .producto:hover .producto__tipo { color: var(--azul-texto); }
}
.producto__sumar:active { transform: scale(.9); }

.producto__sumar[data-dentro="true"] {
    background: var(--azul);
    border-color: var(--azul);
    color: #fff;
}
.producto__sumar[data-dentro="true"] .icono-mas { display: none; }
.producto__sumar[data-dentro="true"] .icono-check { display: block; }

/* Vista de lista */
.rejilla[data-vista="lista"] { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.rejilla[data-vista="lista"] .producto { grid-template-rows: auto; }
.rejilla[data-vista="lista"] .producto__caja {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 1.25rem;
}
.rejilla[data-vista="lista"] .producto__foto { border-bottom: 0; border-right: 1px solid var(--linea-suave); }
.rejilla[data-vista="lista"] .producto__cuerpo { padding-block: 1rem; padding-right: 4rem; }
.rejilla[data-vista="lista"] .producto__tipo { font-size: 1.0625rem; padding-right: 0; }
.rejilla[data-vista="lista"] .producto__resumen {
    display: block;
    margin-top: .3rem;
    font-size: .875rem;
    color: var(--tinta-60);
    max-width: 70ch;
}
.rejilla[data-vista="lista"] .producto__sumar { top: 50%; bottom: auto; translate: 0 -50%; }
.producto__resumen { display: none; }

@media (hover: hover) and (pointer: fine) {
    .rejilla[data-vista="lista"] .producto:hover { transform: none; }
}

/* ------------------------------------------------------------
   Paginación
   ------------------------------------------------------------ */
.paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: clamp(2.5rem, 4vw, 3.5rem);
}
.paginacion[hidden] { display: none; }

.paginacion button {
    min-width: 38px;
    height: 38px;
    padding-inline: .6rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--linea);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-family: var(--texto);
    font-size: .875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--tinta-60);
    transition: border-color var(--rapido) var(--salida), color var(--rapido) var(--salida), background-color var(--rapido) var(--salida);
}
.paginacion svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; }
@media (hover: hover) and (pointer: fine) {
    .paginacion button:not(:disabled):not([aria-current]):hover { border-color: var(--azul-200); color: var(--azul-texto); }
}
.paginacion button[aria-current] { background: var(--azul); border-color: var(--azul); color: #fff; }
.paginacion button:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------------------
   Carrito flotante
   ------------------------------------------------------------ */
.carrito {
    position: fixed;
    left: 50%;
    bottom: clamp(1rem, 2.5vw, 2rem);
    z-index: 880;
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .8rem .7rem 1.25rem;
    border: 0;
    border-radius: 999px;
    background: var(--azul);
    color: #fff;
    cursor: pointer;
    font-family: var(--texto);
    font-size: .9375rem;
    font-weight: 600;
    box-shadow: 0 6px 16px -6px rgba(10, 14, 32, .5), 0 20px 48px -18px rgba(10, 14, 32, .6);
    translate: -50% 140%;
    opacity: 0;
    visibility: hidden;
    transition: translate 420ms var(--salida), opacity 260ms var(--salida), visibility 0s linear 420ms,
                background-color var(--medio) var(--salida);
}

.carrito[data-visible="true"] {
    translate: -50% 0;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.carrito svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.8; fill: none; flex: none; }

.carrito__texto { display: grid; text-align: left; line-height: 1.2; }
.carrito__texto small {
    font-size: .75rem;
    font-weight: 500;
    color: var(--sobre-azul-72);
    font-variant-numeric: tabular-nums;
}

.carrito__cuenta {
    display: grid;
    place-items: center;
    min-width: 30px; height: 30px;
    padding-inline: .5rem;
    border-radius: 999px;
    background: #fff;
    color: var(--azul-texto);
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
}

@media (hover: hover) and (pointer: fine) {
    .carrito:hover { background: var(--azul-800); }
}
.carrito:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
    .carrito { transition: opacity 160ms linear, visibility 0s; translate: -50% 0; }
}

/* En pantallas angostas deja libre el botón de WhatsApp */
@media (max-width: 640px) {
    .carrito { left: 1rem; right: 5rem; translate: 0 140%; justify-content: space-between; }
    .carrito[data-visible="true"] { translate: 0 0; }
}

/* ------------------------------------------------------------
   Responsive de la tienda
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
    .tienda { grid-template-columns: minmax(0, 1fr); }

    .filtros {
        position: fixed;
        inset: 0 0 0 auto;
        z-index: 960;
        width: min(340px, 88vw);
        max-height: none;
        padding: calc(var(--alto-nav) + 1rem) 1.25rem 2rem;
        background: #fff;
        box-shadow: var(--sombra-3);
        translate: 100% 0;
        visibility: hidden;
        transition: translate 320ms var(--salida), visibility 0s linear 320ms;
    }
    .filtros[data-abierto="true"] { translate: 0 0; visibility: visible; transition-delay: 0s; }

    .filtros__cerrar {
        position: absolute;
        top: calc(var(--alto-nav) + .25rem);
        right: 1.25rem;
        display: grid;
        place-items: center;
        width: 34px; height: 34px;
        border: 1px solid var(--linea);
        border-radius: 999px;
        background: #fff;
        cursor: pointer;
    }
    .filtros__cerrar svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

    .filtros__velo {
        position: fixed;
        inset: 0;
        z-index: 950;
        background: rgba(10, 14, 32, .4);
        backdrop-filter: blur(3px);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--medio) var(--salida), visibility 0s linear var(--medio);
    }
    .filtros__velo[data-abierto="true"] { opacity: 1; visibility: visible; transition-delay: 0s; }

    .btn-filtros {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
        flex: none;
        padding: .62rem 1rem;
        border: 1px solid var(--linea);
        border-radius: 999px;
        background: #fff;
        cursor: pointer;
        font-family: var(--texto);
        font-size: .875rem;
        font-weight: 600;
        color: var(--tinta);
    }
    .btn-filtros svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; }
    .btn-filtros em {
        font-style: normal;
        min-width: 18px; height: 18px;
        display: grid; place-items: center;
        border-radius: 999px;
        background: var(--azul);
        color: #fff;
        font-size: .6875rem;
        font-variant-numeric: tabular-nums;
    }
    .btn-filtros em[hidden] { display: none; }
}

@media (min-width: 1025px) {
    .filtros__cerrar, .filtros__velo { display: none; }
}

@media (max-width: 640px) {
    .rejilla { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
    .barra__conteo { order: -1; width: 100%; margin-right: 0; }
    .buscador { max-width: none; flex: 1 1 100%; }
    .vista { display: none; }
    .rejilla[data-vista="lista"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .producto__tipo { font-size: .875rem; }
}

/* ------------------------------------------------------------
   Ficha del producto
   ------------------------------------------------------------ */
/* La ventana de la ficha no lleva relleno propio: el panel de la foto
   llega hasta el borde y el de los datos tiene el suyo */
#ventana-ficha .ventana__caja {
    width: min(100%, 940px);
    padding: 0;
    overflow: hidden;
}
#ventana-ficha .ventana__cerrar {
    position: absolute;
    top: .85rem;
    right: .85rem;
    z-index: 3;
    float: none;
    margin: 0;
}

.ficha-producto {
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    max-height: min(92dvh, 900px);
}

/* Panel de la foto */
.ficha-producto__galeria {
    display: grid;
    align-content: center;
    gap: 1rem;
    padding: clamp(1.25rem, 3vw, 2.25rem);
    background: var(--nieve);
    border-right: 1px solid var(--linea-suave);
}

.ficha-producto__principal {
    /* Flex, no grid: así la foto no estira la caja a su alto natural */
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
}
/* contain, no cover: la foto del producto nunca se recorta */
.ficha-producto__principal img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.ficha-producto__miniaturas { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.ficha-producto__miniaturas button {
    width: 58px; height: 58px;
    padding: 5px;
    overflow: hidden;
    border: 1px solid var(--linea);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color var(--rapido) var(--salida), box-shadow var(--rapido) var(--salida);
}
.ficha-producto__miniaturas img { width: 100%; height: 100%; object-fit: contain; }
.ficha-producto__miniaturas button[aria-pressed="true"] {
    border-color: var(--azul);
    box-shadow: 0 0 0 2px rgba(19, 25, 54, .16);
}

/* Panel de los datos: cuerpo que rueda y pie fijo abajo */
.ficha-producto__panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}
.ficha-producto__cuerpo {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(1.75rem, 3.5vw, 2.75rem) clamp(1.5rem, 3vw, 2.5rem) 1.5rem;
}

.ficha-producto h2 {
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    padding-right: 2.5rem;
    text-wrap: balance;
}

/* Marca, código y línea en una sola línea de datos, no un rótulo suelto */
.ficha-producto__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-top: .55rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--azul-texto);
}
.ficha-producto__meta span { font-weight: 500; color: var(--tinta-40); font-variant-numeric: tabular-nums; }
.ficha-producto__meta i {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--linea);
}

.ficha-producto__descripcion {
    margin-top: 1.1rem;
    color: var(--tinta-60);
    font-size: .9375rem;
    line-height: 1.6;
    max-width: 62ch;
}

.ficha-producto__datos { display: grid; gap: 1.35rem; margin-top: 1.85rem; }

/* Cada bloque: rótulo a la izquierda, valores a la derecha */
.bloque {
    display: grid;
    grid-template-columns: minmax(0, 104px) minmax(0, 1fr);
    gap: .5rem 1.25rem;
    align-items: baseline;
}
.bloque h3 {
    font-family: var(--texto);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tinta-40);
    margin: 0;
}
.bloque ul { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.bloque li {
    padding: .3rem .7rem;
    border-radius: 999px;
    background: var(--nieve);
    font-size: .8125rem;
    color: var(--tinta);
}
.bloque p { font-size: .875rem; color: var(--tinta-60); margin: 0; }

/* Pie: cantidad, botón y nota, siempre a la vista */
.ficha-producto__pie {
    flex: none;
    display: grid;
    gap: .7rem;
    padding: 1.1rem clamp(1.5rem, 3vw, 2.5rem) 1.35rem;
    background: #fff;
    border-top: 1px solid var(--linea-suave);
}
.ficha-producto__controles {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .7rem;
}
.ficha-producto__controles .btn { width: 100%; }
.ficha-producto__nota {
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--tinta-60);
    max-width: none;
}

.contador {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--linea);
    border-radius: 999px;
    overflow: hidden;
}
.contador button {
    width: 40px; height: 44px;
    border: 0;
    background: #fff;
    cursor: pointer;
    color: var(--tinta);
    font-size: 1.1rem;
    line-height: 1;
    transition: background-color var(--rapido) var(--salida);
}
@media (hover: hover) and (pointer: fine) { .contador button:hover { background: var(--nieve); } }
.contador button:disabled { color: var(--tinta-40); cursor: not-allowed; }
.contador output {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    /* Apilado: rueda la ventana entera, no cada panel por su lado */
    #ventana-ficha .ventana__caja { overflow-y: auto; }
    .ficha-producto { grid-template-columns: minmax(0, 1fr); max-height: none; }
    .ficha-producto__galeria { border-right: 0; border-bottom: 1px solid var(--linea-suave); }
    /* Alto propio: la foto no se come la pantalla antes de los datos */
    .ficha-producto__principal { aspect-ratio: auto; height: 32dvh; min-height: 170px; }
    .ficha-producto__cuerpo { overflow: visible; }
    .ficha-producto__pie { position: sticky; bottom: 0; box-shadow: 0 -8px 20px -14px rgba(10, 14, 32, .35); }
}
@media (max-width: 520px) {
    .bloque { grid-template-columns: minmax(0, 1fr); gap: .45rem; }
}
@media (max-width: 420px) {
    .ficha-producto__controles { grid-template-columns: minmax(0, 1fr); }
    .ficha-producto__controles .contador { justify-self: start; }
}

/* ------------------------------------------------------------
   Consulta
   ------------------------------------------------------------ */
.pedido__caja { width: min(100%, 660px); }
.pedido h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin-bottom: .4rem; padding-right: 2.5rem; }
.pedido__bajada { color: var(--tinta-60); font-size: .9375rem; margin-bottom: 1.5rem; max-width: 56ch; }

/* Estado vacío: sin caja punteada dentro de la ventana */
.pedido__vacio {
    display: grid;
    justify-items: center;
    gap: .55rem;
    padding: clamp(2rem, 6vw, 3.25rem) 0 clamp(.5rem, 2vw, 1rem);
    text-align: center;
}
.pedido__vacio-icono {
    display: grid;
    place-items: center;
    width: 64px; height: 64px;
    margin-bottom: .6rem;
    border-radius: 50%;
    background: var(--azul-tenue);
    color: var(--azul-texto);
}
.pedido__vacio-icono svg { width: 28px; height: 28px; }
.pedido__vacio h3 { font-size: 1.125rem; }
.pedido__vacio p { color: var(--tinta-60); font-size: .9375rem; max-width: 40ch; }
.pedido__vacio .btn { margin-top: 1rem; }

.pedido__lista { list-style: none; margin: 0; padding: 0; }

.pedido__item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--linea-suave);
}
.pedido__item:first-child { border-top: 1px solid var(--linea-suave); }

.pedido__miniatura {
    width: 64px; height: 64px;
    overflow: hidden;
    border-radius: 9px;
    border: 1px solid var(--linea-suave);
}
.pedido__miniatura { padding: 4px; background: #fff; }
.pedido__miniatura img { width: 100%; height: 100%; object-fit: contain; }

.pedido__nombre { font-weight: 600; font-size: .9375rem; line-height: 1.3; }
.pedido__marca { font-size: .8125rem; color: var(--azul-texto); }

.pedido__quitar {
    border: 0;
    background: none;
    cursor: pointer;
    font-size: .8125rem;
    color: var(--tinta-60);
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-top: .3rem;
    padding: 0;
}
@media (hover: hover) and (pointer: fine) { .pedido__quitar:hover { color: #8a2f1b; } }

.pedido__pie { display: grid; gap: 1rem; margin-top: 1.75rem; }
.pedido__acciones { display: flex; flex-wrap: wrap; gap: .6rem; }
.pedido__acciones .btn { flex: 1 1 auto; }
@media (max-width: 520px) {
    /* Apilados y al mismo ancho, no uno largo y otro corto */
    .pedido__acciones { display: grid; }
    .pedido__acciones .btn { width: 100%; }
}
.pedido__acciones .btn--contorno { flex: 0 0 auto; }

@media (max-width: 520px) {
    .pedido__item { grid-template-columns: 54px minmax(0, 1fr); }
    .pedido__item .contador { grid-column: 1 / -1; justify-self: start; }
    .pedido__miniatura { width: 54px; height: 54px; }
}

/* ------------------------------------------------------------
   Aviso flotante
   ------------------------------------------------------------ */
.brindis {
    position: fixed;
    /* Es un aviso, nunca se toca: no debe robar el clic del carrito */
    pointer-events: none;
    left: 50%;
    bottom: calc(clamp(1rem, 2.5vw, 2rem) + 88px);
    z-index: 970;
    translate: -50% 120%;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1.15rem;
    border-radius: 999px;
    background: var(--tinta);
    color: #fff;
    box-shadow: var(--sombra-3);
    font-size: .875rem;
    font-weight: 500;
    opacity: 0;
    transition: translate 420ms var(--salida), opacity 300ms var(--salida);
}
.brindis[data-visible="true"] { translate: -50% 0; opacity: 1; }
.brindis svg { width: 17px; height: 17px; stroke: #8fe0a8; stroke-width: 2.2; fill: none; }

@media (prefers-reduced-motion: reduce) {
    .brindis { transition: opacity 180ms linear; translate: -50% 0; }
}
