:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f4f6fb;
    --card: #ffffff;
    --brand: #1d4ed8;
    --brand-dark: #1e3a8a;
    --sale: #b91c1c;
    --ok: #15803d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
}

a { color: inherit; }

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.bar, .cats, .wrap, .footer-grid {
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
}

.bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.brand img { width: 36px; height: 36px; object-fit: contain; }

.search {
    display: flex;
    flex: 1;
    min-width: 0;
}

.search input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: 0.6rem 0 0 0.6rem;
    padding: 0.65rem 0.8rem;
    font: inherit;
}

.search button, .btn, .btn-ghost {
    border: 0;
    border-radius: 0.6rem;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.search button, .btn {
    background: var(--brand);
    color: #fff;
}

.search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 0 0.6rem 0.6rem 0;
}

.search button svg { display: none; width: 1.15rem; height: 1.15rem; }

.btn:hover, .search button:hover { background: var(--brand-dark); }

.btn-ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-block { display: block; width: 100%; }

.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--brand-dark);
    text-decoration: none;
}

.cart-link svg { width: 1.35rem; height: 1.35rem; }

.cart-count {
    position: absolute;
    top: -0.15rem;
    right: -0.15rem;
    min-width: 1.25rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.cats {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
}

.cats a {
    flex: 0 0 auto;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #f1f5f9;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 650;
}

.cats a.is-active, .cats a:hover { background: var(--brand); color: #fff; }

@media (max-width: 800px) {
    .cats {
        max-height: 3.5rem;
        transition: max-height 0.22s ease, padding 0.22s ease, opacity 0.18s ease;
    }

    .site-header.is-scrolled .cats {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
    }
}

.wrap { padding: 1.5rem 0 3rem; }

.hero {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    padding: 1.6rem 1.5rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    color: #fff;
}

.hero h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.15; }

.hero p { margin: 0; color: #dbeafe; }

.hero .btn { justify-self: start; margin-top: 0.6rem; background: #fff; color: var(--brand-dark); }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.toolbar h1 { margin: 0; font-size: 1.35rem; }

.toolbar select {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    padding: 0.45rem 0.6rem;
    font: inherit;
    background: #fff;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.pcard {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    overflow: hidden;
}

.pcard-media {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8fafc;
}

.pcard-media img,
.pcard-media .no-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.75rem;
    box-sizing: border-box;
}

.no-photo,
.pcard-media .no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.pcard-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.9rem 1rem;
}

.pcard-cat {
    height: 1rem;
    margin: 0;
    overflow: hidden;
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1rem;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.pcard-title {
    height: 2.7em;
    margin: 0;
    overflow: hidden;
    font-size: 0.98rem;
    line-height: 1.35;
}

.pcard-title a {
    display: -webkit-box;
    height: 2.7em;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-decoration: none;
}

.pcard-price {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 2.7rem;
    margin: 0.15rem 0 0.7rem;
    font-weight: 800;
}

.pcard-price s {
    display: block;
    min-height: 1.15rem;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.15rem;
}

.pcard-price s:empty { visibility: hidden; }

.pcard .btn { margin-top: auto; }

.pager {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
}

.pager a, .pager span {
    min-width: 2.2rem;
    padding: 0.4rem 0.65rem;
    border-radius: 0.45rem;
    background: #fff;
    border: 1px solid var(--line);
    text-align: center;
    text-decoration: none;
}

.pager .is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

.product {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 2rem;
    align-items: start;
}

.stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 22rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
}

.stage img { width: 100%; height: 24rem; object-fit: contain; padding: 1rem; }

.crumb { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.88rem; }
.crumb a { color: var(--brand); }

.product h1 { margin: 0 0 0.8rem; font-size: clamp(1.4rem, 2.5vw, 2rem); line-height: 1.2; }

.price-now { margin: 0; color: var(--brand); font-size: 2rem; font-weight: 800; }
.price-now.is-sale { color: var(--sale); }
.price-was { margin: 0.15rem 0 0; color: var(--muted); }

.stock {
    display: inline-block;
    margin: 0.9rem 0;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #dcfce7;
    color: var(--ok);
    font-size: 0.78rem;
    font-weight: 800;
}

.buy-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
.qty {
    width: 4.5rem;
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    padding: 0.65rem;
    font: inherit;
}

.prose {
    margin-top: 2rem;
    padding: 1.2rem 1.3rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
}

.prose h2 { margin-top: 0; }

.cart-page h1 {
    margin: 0;
    font-size: 1.7rem;
}

.cart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cart-head p {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 0.7fr);
    gap: 1.25rem;
    align-items: start;
}

.cart-lines {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-line {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
}

.cart-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #f8fafc;
}

.cart-line img,
.cart-photo .thumb {
    width: 96px;
    height: 96px;
    object-fit: contain;
    padding: 0.35rem;
}

.cart-photo .thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.cart-name {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.cart-unit {
    margin: 0.25rem 0 0.35rem;
    color: var(--muted);
}

.cart-remove {
    padding: 0;
    border: 0;
    background: none;
    color: #b91c1c;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.line-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
}

.qty-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.line-actions input[type="number"] {
    width: 5.5rem;
    padding: 0.45rem 0.5rem;
    text-align: center;
}

.line-actions .btn-ghost {
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
}

.cart-line-total {
    margin: 0;
    min-width: 6.5rem;
    color: var(--brand);
    font-size: 1.05rem;
    font-weight: 800;
    text-align: right;
}

.cart-summary {
    position: sticky;
    top: 6.5rem;
    padding: 1.15rem 1.2rem 1.25rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
}

.cart-summary h2 {
    margin: 0 0 0.8rem;
    font-size: 1.15rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}

.summary-total {
    margin-bottom: 1rem;
    border-bottom: 0;
    font-size: 1.15rem;
}

.summary-total strong { color: var(--brand); }

.cart-continue {
    display: block;
    margin-top: 0.75rem;
    color: var(--brand);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.25rem;
    align-items: start;
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1.1rem 1.2rem;
}

label { display: block; margin: 0.7rem 0 0.25rem; font-weight: 700; font-size: 0.9rem; }

input[type="text"], input[type="tel"], textarea, input[type="number"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    padding: 0.65rem 0.7rem;
    font: inherit;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.6rem;
    background: #fee2e2;
    color: #991b1b;
}

.empty {
    padding: 2rem 1rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
}

.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 2rem 0 1rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
}

.site-footer a { color: #fff; }
.float-actions {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.maps-btn,
.whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.maps-btn { background: #ea4335; }
.maps-btn:hover { background: #c5221f; }
.whatsapp-btn { background: #25d366; }
.whatsapp-btn:hover { background: #1ebe5d; }

.maps-btn svg,
.whatsapp-btn svg {
    width: 32px;
    height: 32px;
}

.copy { width: min(1120px, calc(100% - 2rem)); margin: 1.2rem auto 0; padding-top: 0.8rem; border-top: 1px solid #1e293b; font-size: 0.85rem; }

@media (max-width: 1000px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    .bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand cart"
            "search search";
        gap: 0.6rem 0.75rem;
        align-items: center;
        padding: 0.65rem 0 0.75rem;
    }
    .brand { grid-area: brand; min-width: 0; font-size: 0.95rem; gap: 0.4rem; }
    .cart-link { grid-area: cart; }
    .brand img { width: 32px; height: 32px; }
    .brand span { overflow: hidden; text-overflow: ellipsis; }
    .search { grid-area: search; }
    .search input,
    .search button { min-height: 2.75rem; }
    .search button {
        position: relative;
        width: 2.85rem;
        padding: 0;
    }
    .search button svg { display: block; }
    .search button span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .cart-link { width: 2.6rem; height: 2.6rem; }
    .product, .checkout-grid, .footer-grid { grid-template-columns: 1fr; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary { position: static; }
    .cart-line { grid-template-columns: 80px minmax(0, 1fr); }
    .line-actions, .cart-line-total { grid-column: 2; }
    .cart-line-total { text-align: left; }
    .stage img { height: 16rem; }
}

@media (max-width: 520px) {
    .product-grid { grid-template-columns: 1fr; }
}
