/* ==========================================================================
   EMYDA - Catálogo
   ========================================================================== */

:root {
    --bg: #cbd7e6;
    --surface: #ffffff;
    --ink: #1b2330;
    --muted: #5d6b7e;
    --line: #dbe3ee;
    --dark: #080817;
    --sky: #43628b;
    --sky-dark: #2f4868;
    --accent: #0a7cff;
    --accent-dark: #0062cc;
    --teal: #1fb5c9;
    --ok: #1e8e3e;
    --warn: #b26a00;
    --out: #c62828;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(16, 32, 64, .08);
    --header-h: 64px;
    --gutter: 16px;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
fieldset { border: 0; }

.is-hidden { display: none !important; }
.muted { color: var(--muted); font-size: .9em; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Botones -------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 8px 16px;
    border-radius: 8px; border: 1px solid transparent;
    font-weight: 600; font-size: .9rem;
    background: #e7ecf3; color: var(--ink);
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-outline { background: transparent; border-color: var(--sky); color: var(--sky); }
.btn-outline:hover { background: var(--sky); color: #fff; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 8px;
    font-size: 1.1rem;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); }

.link-btn { color: var(--sky); font-weight: 600; font-size: .85rem; }
.link-btn:hover { text-decoration: underline; }

/* --- Header --------------------------------------------------------------- */

.site-header {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: var(--header-h);
    padding: 8px var(--gutter);
    background: var(--dark); color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand img { width: 220px; height: auto; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.user-menu { display: flex; align-items: center; gap: 4px; }
.user-name {
    max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .85rem; opacity: .8; margin-right: 6px;
}
.header-link {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 40px; padding: 6px 12px; border-radius: 8px;
    font-size: .9rem; font-weight: 600;
}
.header-link:hover { background: rgba(255, 255, 255, .1); }
#login-link { border: 1px solid var(--accent); color: #6db3ff; }

.cart-btn {
    position: relative;
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 6px 18px;
    border: 1px solid var(--teal); border-radius: 999px;
    font-weight: 600; letter-spacing: .04em;
}
.cart-btn:hover { background: rgba(31, 181, 201, .15); }
.cart-btn .fa-cart-shopping { font-size: 1.2rem; }
.cart-badge {
    min-width: 24px; height: 24px; padding: 0 6px;
    display: inline-grid; place-items: center;
    border-radius: 999px; background: var(--teal); color: var(--dark);
    font-size: .8rem; font-weight: 700;
}

/* --- Banner --------------------------------------------------------------- */

.banner { position: relative; background: var(--dark); }
.banner-track {
    display: grid;
    /* minmax(0,1fr): sin esto la columna toma el ancho real de la imagen (6668px) */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    /* Altura según el ancho de pantalla (aspect-ratio + min-height ensanchaba el banner en móvil) */
    height: clamp(110px, 12.5vw, 240px);
    overflow: hidden;
    /* Deslizar con el dedo: el navegador sólo maneja el scroll vertical */
    touch-action: pan-y;
    user-select: none; -webkit-user-select: none;
    cursor: grab;
}
.banner-track:active { cursor: grabbing; }
.banner-slide {
    grid-area: 1 / 1;
    position: relative;
    opacity: 0; visibility: hidden;
    transition: opacity .6s ease, visibility .6s;
}
.banner-slide.is-active { opacity: 1; visibility: visible; }
.banner-slide img, .banner-slide picture { display: block; width: 100%; height: 100%; }
.banner-slide img { -webkit-user-drag: none; }
.banner-bg { object-fit: cover; object-position: left center; }
.banner-logo {
    position: absolute; right: 4%; top: 50%; transform: translateY(-50%);
    width: 38% !important; height: auto !important; max-width: 520px;
}
.banner-slide--ad { background: #1e1e30; }
.banner-slide--ad img { object-fit: contain; }

/* --- Layout del catálogo -------------------------------------------------- */

.shop {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px var(--gutter) 48px;
}

.filters { align-self: start; position: sticky; top: calc(var(--header-h) + 16px); }
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filters-head h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; }
.filters-close { display: none; }
.filters-group legend {
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    color: var(--muted); margin-bottom: 8px;
}
.category-list { display: grid; gap: 2px; }
.check {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    font-size: .9rem; cursor: pointer;
}
.check:hover { background: rgba(255, 255, 255, .55); }
.check input { width: 17px; height: 17px; accent-color: var(--sky); }
.check span { flex: 1; text-transform: uppercase; }
.check small { color: var(--muted); }

.catalog-bar {
    position: sticky; top: var(--header-h); z-index: 20;
    display: flex; align-items: center; gap: 16px;
    padding: 10px 16px; margin-bottom: 16px;
    background: var(--sky); color: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.search {
    flex: 1 1 280px; max-width: 420px;
    display: flex; align-items: center; gap: 10px;
    padding: 0 12px; height: 40px;
    background: #fff; color: var(--ink); border-radius: 8px;
}
.search i { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: .95rem; }
.results-count { font-size: .9rem; white-space: nowrap; }
.view-toggle { display: flex; gap: 4px; margin-left: auto; }
.view-toggle .icon-btn { color: rgba(255, 255, 255, .6); }
.view-toggle .icon-btn.is-active { color: #fff; background: rgba(255, 255, 255, .15); }
.filters-open {
    display: none; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .5);
    font-weight: 600; font-size: .9rem;
}

.login-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    padding: 12px 16px; margin-bottom: 16px;
    background: #fff8e1; border: 1px solid #ffe08a; border-radius: var(--radius);
    font-size: .9rem;
}
.login-banner a { color: var(--accent-dark); font-weight: 700; text-decoration: underline; }

/* --- Tarjetas de producto -------------------------------------------------- */

.products { display: grid; gap: 16px; }
.products.view-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.products.view-list { grid-template-columns: 1fr; }

.product {
    display: flex; flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.product-gallery {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.product-gallery img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: contain; padding: 12px;
    opacity: 0; transition: opacity .25s;
}
.product-gallery img.is-active { opacity: 1; }
.gallery-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(8, 8, 23, .55); color: #fff;
    opacity: 0; transition: opacity .2s;
}
.gallery-btn--prev { left: 8px; }
.gallery-btn--next { right: 8px; }
.product:hover .gallery-btn, .gallery-btn:focus-visible { opacity: 1; }
@media (hover: none) { .gallery-btn { opacity: 1; } }

.product-info { flex: 1; padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 6px; }
.product-category { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--sky); }
.product-name { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.product-desc {
    font-size: .85rem; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.stock {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: 999px;
    font-size: .75rem; font-weight: 700;
}
.stock::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock--ok { color: var(--ok); background: #e6f4ea; }
.stock--warn { color: var(--warn); background: #fff4e0; }
.stock--out { color: var(--out); background: #fdecea; }

.product-buy { padding: 10px 16px 16px; display: grid; gap: 10px; }
.price { font-size: 1.25rem; font-weight: 700; }
/* Precios discriminados (sólo admin) */
.price-table { display: grid; gap: 2px; font-size: .85rem; background: #f4f7fb; border-radius: 8px; padding: 8px 10px; }
.price-table div { display: flex; justify-content: space-between; gap: 8px; }
.price-table dt { color: var(--muted); }
.price-table dt small { color: var(--ok); font-weight: 600; }
.price-table dd { font-weight: 700; }
.price-table div:first-child dd { color: var(--ink); }
.buy-row { display: flex; gap: 8px; }
.buy-row .btn { flex: 1; }
.qty-input {
    width: 64px; height: 40px; padding: 0 6px;
    border: 1px solid var(--line); border-radius: 8px;
    text-align: center; font-size: 1rem;
}

/* Vista lista */
.view-list .product { flex-direction: row; align-items: stretch; }
.view-list .product-gallery { width: 160px; flex: none; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); }
.view-list .product-info { padding: 16px; }
.view-list .product-desc { -webkit-line-clamp: 3; }
.view-list .product-buy { width: 260px; flex: none; align-content: center; }

/* --- Estado de carga (scroll infinito) ------------------------------------ */

.catalog-status {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 28px 0; color: var(--muted); font-size: .9rem;
}
.catalog-status[data-mode="idle"] { display: none; }
.catalog-status:not([data-mode="loading"]) .spinner { display: none; }
.spinner {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid rgba(67, 98, 139, .25); border-top-color: var(--sky);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#scroll-sentinel { height: 1px; }

/* --- Footer --------------------------------------------------------------- */

.site-footer { background: var(--dark); color: #d7deea; padding: 32px var(--gutter); }
.footer-grid {
    max-width: 1200px; margin: 0 auto;
    display: grid; gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    align-items: start;
}
.footer-logo { width: 200px; height: auto; }
.site-footer h2 { font-size: .95rem; margin-bottom: 8px; color: #fff; }
.site-footer p { font-size: .9rem; margin-bottom: 4px; }
.site-footer a:hover { color: var(--teal); }

/* --- Overlay, drawer, modales -------------------------------------------- */

.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(8, 8, 23, .55); }

.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
    width: min(420px, 100%);
    display: flex; flex-direction: column;
    background: var(--surface);
    box-shadow: -8px 0 30px rgba(0, 0, 0, .2);
    transform: translateX(100%);
    transition: transform .25s ease;
}
.drawer.is-open { transform: none; }
.drawer-head, .modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h2, .modal-head h2 { font-size: 1.1rem; }
.drawer-head { flex: none; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px; }
.drawer-foot { flex: none; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: grid; gap: 10px; }
.cart-subtotal { display: flex; justify-content: space-between; font-size: 1.05rem; }

.empty-cart { display: grid; place-items: center; gap: 12px; padding: 48px 0; color: var(--muted); }
.empty-cart i { font-size: 2.2rem; opacity: .4; }

.cart-line {
    display: grid; grid-template-columns: 56px 1fr auto; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-line img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; }
.cart-line-name { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.cart-line-price { font-size: .8rem; color: var(--muted); margin: 2px 0 6px; }
.cart-line-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
.stepper button { width: 30px; height: 30px; font-size: 1.1rem; }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; }

.modal {
    position: fixed; inset: 0; z-index: 110;
    display: grid; place-items: center;
    padding: var(--gutter);
    background: rgba(8, 8, 23, .55);
}
.modal-card {
    width: min(560px, 100%);
    /* dvh = alto realmente visible (en celulares 100vh incluye lo que tapa la barra del navegador) */
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex; flex-direction: column;
    background: var(--surface); border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
/* Sólo el cuerpo se desplaza: encabezado y botones siempre a la vista */
.modal-head { flex: none; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: grid; gap: 16px; }
.modal-foot { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }

.checkout-client { font-size: .85rem; color: var(--muted); }
.summary-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.summary-table th { text-align: left; font-size: .75rem; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; }
.summary-table td { padding: 6px 0; border-top: 1px solid var(--line); }
.summary-table td:nth-child(n+2), .summary-table th:nth-child(n+2) { text-align: right; padding-left: 12px; white-space: nowrap; }

.checkout-group { display: grid; gap: 6px; }
.checkout-group legend, .field { font-size: .85rem; font-weight: 600; }
.radio { display: flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; }
.radio input { width: 18px; height: 18px; accent-color: var(--accent); }
.field { display: grid; gap: 6px; }
.field input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 400; }
.field textarea { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 400; resize: vertical; }
.field-hint { font-weight: 600; font-size: .8rem; }
.field-hint.is-error { color: var(--out); }
.field-hint.is-ok { color: var(--ok); }

.totals { display: grid; gap: 4px; background: #f4f7fb; padding: 12px; border-radius: 8px; }
.totals div { display: flex; justify-content: space-between; font-size: .9rem; }
.totals-total { font-size: 1.1rem !important; font-weight: 700; padding-top: 6px; border-top: 1px solid var(--line); }
.note { font-size: .82rem; color: var(--muted); }
.form-error { color: var(--out); font-size: .88rem; font-weight: 600; }
.form-error:empty { display: none; }

.order { border: 1px solid var(--line); border-radius: 8px; }
.order summary {
    display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center;
    padding: 10px 12px; cursor: pointer; font-size: .9rem;
}
.order .stock { align-self: center; }
.order-items { padding: 0 12px 12px; }

.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 200;
    transform: translate(-50%, 20px);
    max-width: calc(100% - 32px);
    padding: 12px 18px; border-radius: 10px;
    background: #1f2a3a; color: #fff; font-size: .9rem; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--warn { background: var(--warn); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
    .shop { grid-template-columns: 1fr; padding-top: 16px; }

    .filters {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
        align-self: stretch; height: 100%;
        width: min(300px, 85%);
        padding: 16px;
        background: var(--surface);
        box-shadow: 8px 0 30px rgba(0, 0, 0, .2);
        transform: translateX(-100%);
        transition: transform .25s ease;
        overflow-y: auto;
    }
    .filters.is-open { transform: none; }
    .filters-close { display: inline-grid; }
    .filters-open { display: inline-flex; }

    .catalog-bar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
    .search { flex-basis: 100%; max-width: none; order: -1; }
    .results-count { flex: 1; min-width: 0; font-size: .82rem; order: 1; }
    .view-toggle { margin-left: 0; order: 2; }
    .count-long { display: none; }

    .user-name { display: none; }
}

@media (max-width: 640px) {
    :root { --header-h: 56px; }
    body { font-size: 14px; }
    .brand img { width: 150px; }
    .header-link span, .cart-btn-label { display: none; }
    .header-link { padding: 6px 10px; }
    .cart-btn { padding: 6px 12px; }

    .banner-logo { width: 55% !important; right: 3%; }

    .products.view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .view-grid .product-info { padding: 10px 10px 4px; }
    .view-grid .product-buy { padding: 8px 10px 12px; }
    .view-grid .product-desc { display: none; }
    .view-grid .product-name { font-size: .88rem; }
    .view-grid .price { font-size: 1.05rem; }
    .view-grid .buy-row { flex-direction: column; }
    .view-grid .qty-input { width: 100%; }

    .view-list .product { flex-wrap: wrap; }
    .view-list .product-gallery { width: 110px; }
    .view-list .product-info { flex: 1 1 0; min-width: 0; padding: 12px; }
    .view-list .product-buy { width: 100%; padding-top: 0; }

    /* Celular: banner más alto (5:2), para la imagen propia de celular */
    .banner-track { height: 40vw; }
    .banner-logo { width: 62% !important; right: 50%; transform: translate(50%, -50%); }
    .toast { bottom: auto; top: calc(var(--header-h) + 12px); transform: translate(-50%, -20px); }
    .modal { padding: 0; place-items: end stretch; }
    .modal-card { width: 100%; max-height: 92vh; max-height: calc(100dvh - 24px); border-radius: var(--radius) var(--radius) 0 0; }
    /* Margen para la barra de gestos (iPhone / Android) */
    .modal-foot { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
    .modal-foot .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Marcas destacadas, datos técnicos y detalle de producto
   ========================================================================== */

/* Filtro de marcas con logo (ej: MANNOL) */
.brand-filter { display: grid; gap: 8px; min-width: 0; }
#brand-group { margin-bottom: 18px; }
.brand-chip {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    background: #0b1d3a; color: #fff;
    border: 2px solid transparent;
    transition: transform .15s, box-shadow .15s;
}
.brand-chip:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16, 32, 64, .25); }
.brand-chip { width: 100%; min-width: 0; overflow: hidden; }
.brand-chip img { flex: 0 1 auto; min-width: 0; height: auto; max-height: 22px; max-width: 120px; object-fit: contain; object-position: left center; }
.brand-chip strong { letter-spacing: .05em; }
.brand-chip small { font-size: .72rem; opacity: .8; white-space: nowrap; }
.brand-chip.is-active { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(31, 181, 201, .25); }

.catalog-status #load-more-btn { margin-top: 4px; }

/* Tarjeta: marca, código y datos técnicos */
.product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.brand-tag {
    font-size: .7rem; font-weight: 700; letter-spacing: .06em;
    padding: 2px 8px; border-radius: 4px; background: #0b1d3a; color: #fff;
}
.product-code { font-size: .82rem; color: var(--muted); }
.product-code strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.link-plain { text-align: left; font-weight: inherit; line-height: inherit; }
.link-plain:hover { color: var(--accent-dark); text-decoration: underline; }
.product-gallery[data-detail] { cursor: zoom-in; }

.specs { display: grid; gap: 4px; font-size: .8rem; }
.specs div { min-width: 0; }
.specs dt { display: inline; font-weight: 700; color: var(--sky); }
.specs dt::after { content: ': '; }
.specs dd { display: inline; color: var(--muted); }
/* En la tarjeta, cada dato ocupa como máximo 2 líneas (el detalle muestra todo) */
.specs--compact div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.price small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.iva-note { font-size: .75rem; color: var(--muted); margin-top: -4px; }
.price-table .price-cost { border-top: 1px dashed var(--line); margin-top: 2px; padding-top: 2px; }
.price-table .price-cost dd { color: var(--muted); font-weight: 600; }
.cart-subtotal small { font-size: .75rem; color: var(--muted); margin-right: auto; padding-left: 6px; align-self: center; }

/* Detalle del producto */
.modal-card--wide { width: min(900px, 100%); }
.pd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.pd-images { display: grid; gap: 8px; }
.pd-images img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.pd-info { display: grid; gap: 12px; align-content: start; }
.pd-info .specs { font-size: .9rem; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pd-info .specs div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.pd-info .specs div:last-child { border-bottom: 0; }
.pd-info .specs div:nth-child(odd) { background: #f8fafc; }
.pd-info .specs dt::after { content: ''; }
.pd-info .specs dd { color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.pd-buy .price { font-size: 1.5rem; }

.summary-total td { border-top: 0 !important; padding: 2px 0 !important; }
.summary-table tfoot tr:first-child td { border-top: 1px solid var(--line) !important; padding-top: 8px !important; }

@media (max-width: 760px) {
    .pd { grid-template-columns: 1fr; gap: 16px; }
    .pd-images { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .pd-info .specs div { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 640px) {
    .view-grid .specs--compact { display: none; }
}
