/* ============================================================================
   CanastaSV — "Fresco" simple-shopping skin (market browse + cart).
   Clean white surfaces, a brightened grocery green, a citrus savings accent,
   soft cards, and smooth micro-interactions. Mobile-first, reduced-motion safe.
   ========================================================================== */

:root {
    --c-green: #16a34a;
    --c-green-dark: #15803d;
    --c-green-tint: #e8f7ee;
    --c-green-tint-2: #d8f0e1;
    --c-orange: #f97316;
    --c-orange-dark: #ea580c;
    --c-orange-tint: #fff1e6;
    --c-ink: #14181c;
    --c-muted: #64748b;
    --c-line: #e9efe9;
    --c-surface: #ffffff;
    --c-bg: #f6f8f5;
    --shadow-sm: 0 1px 2px rgba(16, 24, 16, .06);
    --shadow: 0 4px 16px rgba(16, 24, 16, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 16, .14);
    --radius: 16px;
}

html, body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--c-bg);
    color: var(--c-ink);
}

/* ---- Shell + app bar ---------------------------------------------------- */
.shop-shell { min-height: 100vh; }

.shop-appbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--c-line);
}

.shop-appbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--c-ink); }

.brand-mark {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--c-green) 0%, var(--c-green-dark) 100%);
    box-shadow: var(--shadow-sm);
}

.brand-name { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.22rem; letter-spacing: -.02em; }
.brand-accent { color: var(--c-green); }

.store-pill {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: 4px;
    padding: 6px 10px;
    border: 1px solid var(--c-green-tint-2);
    background: var(--c-green-tint);
    color: var(--c-green-dark);
    border-radius: 999px;
    font: 600 .82rem/1 'Outfit', sans-serif;
    cursor: pointer;
    max-width: 42vw;
    transition: background .15s ease, transform .1s ease;
}
.store-pill:hover { background: var(--c-green-tint-2); }
.store-pill:active { transform: scale(.97); }
.store-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Brand letter badge — shown only on mobile (desktop keeps the storefront icon + full "Chain · Branch"). */
.store-pill-badge {
    display: none;
    width: 20px; height: 20px; flex: none;
    border-radius: 6px;
    color: #fff;
    font: 800 .72rem/1 'Outfit', sans-serif;
    place-items: center;
}
.store-pill-branch { display: none; }

/* Small inline brand letter badge for advanced-mode price chips + comparison rows. */
.store-letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; flex: none;
    border-radius: 4px;
    color: #fff;
    font: 800 .62rem/1 'Outfit', sans-serif;
    vertical-align: -3px;
    margin-right: 4px;
}

.appbar-spacer { flex: 1 1 auto; }

.cart-button {
    position: relative;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    color: var(--c-ink);
    text-decoration: none;
    transition: background .15s ease;
}
.cart-button:hover { background: var(--c-green-tint); color: var(--c-green-dark); }

.cart-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--c-orange);
    color: #fff;
    font: 700 .68rem/1 'Outfit', sans-serif;
    box-shadow: 0 0 0 2px #fff;
    animation: badge-pop .28s ease;
}

.shop-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 16px 120px;
}

/* ---- Section heads ------------------------------------------------------ */
.section-eyebrow {
    font: 700 .72rem/1 'Outfit', sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--c-green);
}
.section-title { font-family: 'Outfit', sans-serif; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 0; }
.section-sub { color: var(--c-muted); margin-top: 2px; }

/* ---- Home: hero + store choice ----------------------------------------- */
.home-hero {
    border-radius: 22px;
    padding: 30px 26px;
    background:
        radial-gradient(1200px 200px at 90% -40%, rgba(249, 115, 22, .14), transparent 60%),
        linear-gradient(135deg, var(--c-green) 0%, var(--c-green-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.home-hero h1 { font-family: 'Outfit', sans-serif; font-weight: 800; letter-spacing: -.025em; font-size: clamp(1.7rem, 4.5vw, 2.5rem); margin: 0; }
.home-hero p { margin: 8px 0 0; max-width: 46ch; opacity: .92; }
.home-hero .wave { font-size: 1.6rem; }

.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.store-choice {
    display: flex; align-items: center; gap: 14px;
    padding: 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.store-choice:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--c-green-tint-2); }
.store-choice:active { transform: translateY(-1px) scale(.995); }
.store-choice.is-selected { border-color: var(--c-green); box-shadow: 0 0 0 2px var(--c-green-tint-2), var(--shadow); }

.store-logo {
    width: 50px; height: 50px; flex: none;
    border-radius: 13px;
    display: grid; place-items: center;
    color: #fff; font: 800 1.2rem/1 'Outfit', sans-serif;
}
.store-choice-body { min-width: 0; flex: 1; }
.store-choice-name { font: 700 1.02rem/1.2 'Outfit', sans-serif; }
.store-choice-meta { color: var(--c-muted); font-size: .82rem; margin-top: 3px; }

/* branch chips */
.branch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.branch-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid var(--c-line);
    background: #fff;
    color: var(--c-ink);
    font: 600 .85rem/1 'Outfit', sans-serif;
    cursor: pointer;
    transition: all .14s ease;
}
.branch-chip:hover { border-color: var(--c-green-tint-2); background: var(--c-green-tint); }
.branch-chip.is-selected { background: var(--c-green); border-color: var(--c-green); color: #fff; }
.branch-chip .km { opacity: .7; font-weight: 500; }

/* home: simple-flow options (online offers / recommend similar) */
.opts-card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 8px 18px;
}
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; }
.opt-row + .opt-row { border-top: 1px solid var(--c-line); }
.opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-label { font: 600 .92rem/1.2 'Outfit', sans-serif; color: var(--c-ink); }
.opt-sub { font-size: .76rem; color: var(--c-muted); line-height: 1.3; }

/* ---- Category tiles ----------------------------------------------------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    gap: 12px;
}
.cat-tile {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 16px 8px 13px;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: center;
    transition: transform .14s ease, box-shadow .14s ease;
}
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-tile:active { transform: translateY(-1px) scale(.98); }
.cat-tile-icon {
    width: 50px; height: 50px;
    display: grid; place-items: center;
    border-radius: 15px;
}
.cat-tile-label { font: 600 .82rem/1.15 'Outfit', sans-serif; color: var(--c-ink); }
.cat-tile-count { font-size: .7rem; color: var(--c-muted); }

/* sub-category filter chips */
.subcat-row { display: flex; flex-wrap: wrap; gap: 8px; }
.subcat-chip {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--c-line);
    background: #fff;
    color: var(--c-ink);
    font: 600 .8rem/1 'Inter', sans-serif;
    cursor: pointer;
    transition: all .12s ease;
}
.subcat-chip:hover { border-color: var(--c-green-tint-2); }
.subcat-chip.is-active { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }
.subcat-chip .n { opacity: .6; margin-left: 3px; }

/* ---- Product cards ------------------------------------------------------ */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 14px;
}
.prod-card {
    position: relative;
    display: flex; flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .14s ease, box-shadow .14s ease;
}
.prod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.prod-img {
    aspect-ratio: 1 / 1;
    background: #fff;
    display: grid; place-items: center;
    padding: 12px;
}
.prod-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.prod-img .ph { color: #cdd6cd; }

.prod-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.prod-name {
    font: 500 .86rem/1.25 'Inter', sans-serif;
    color: var(--c-ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.15em;
}
.prod-meta { font-size: .73rem; color: var(--c-muted); }
.prod-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prod-price { font: 700 1.05rem/1 'Outfit', sans-serif; color: var(--c-ink); }
.prod-price-unit { font-size: .68rem; color: var(--c-muted); font-weight: 500; }
.prod-link { color: var(--c-muted); display: inline-flex; }

/* Discounts ("Ofertas") */
.prod-rebaja {
    position: absolute; top: 8px; left: 8px; z-index: 1;
    padding: 3px 8px; border-radius: 7px;
    background: var(--c-orange); color: #fff;
    font: 700 .62rem/1 'Outfit', sans-serif; letter-spacing: .04em; text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}
.prod-price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.prod-price.is-sale { color: var(--c-orange-dark); }
.prod-was { font: 500 .8rem/1 'Outfit', sans-serif; color: var(--c-muted); text-decoration: line-through; }
.prod-off { font: 700 .7rem/1 'Outfit', sans-serif; color: var(--c-orange-dark); }
.cat-tile.is-ofertas { border-color: var(--c-orange); background: var(--c-orange-tint); }
.cat-tile.is-ofertas:hover { box-shadow: 0 0 0 1px var(--c-orange), var(--shadow); }
.cat-tile.is-ofertas .cat-tile-label { color: var(--c-orange-dark); font-weight: 700; }
.cat-tile.is-ofertas .cat-tile-count { color: var(--c-orange-dark); }

/* Price-history badges + trigger (see docs/price-history.md) */
.prod-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.pbadge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 7px; border-radius: 999px;
    font: 700 .62rem/1.2 'Outfit', sans-serif; letter-spacing: .01em;
}
.pb-low { background: var(--c-green-tint); color: var(--c-green-dark); }
.pb-drop { background: var(--c-green); color: #fff; }
.pb-out { background: #fdecec; color: #b42318; }
.prod-hist {
    position: absolute; top: 8px; z-index: 1;
    width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 8px; cursor: pointer;
    background: var(--c-green-tint); color: var(--c-green-dark);
    box-shadow: var(--shadow-sm);
}
.prod-hist:hover { background: var(--c-green); color: #fff; }

/* Price-history dialog */
.hist-prod { margin-bottom: 10px; }
.hist-name { font: 600 .95rem/1.25 'Outfit', sans-serif; color: var(--c-ink); }
.hist-size { font-size: .75rem; color: var(--c-muted); margin-top: 2px; }
.hist-empty { padding: 18px 4px; color: var(--c-muted); font-size: .85rem; display: flex; gap: 8px; align-items: center; }
.hist-chain { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--c-line); }
.hist-chain:first-of-type { border-top: none; padding-top: 0; }
.hist-chain-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.hist-dot { width: 10px; height: 10px; border-radius: 50%; }
.hist-chain-name { font-weight: 600; font-size: .85rem; }
.hist-last { margin-left: auto; font: 700 1rem/1 'Outfit', sans-serif; color: var(--c-ink); }
.hist-svg { width: 100%; height: 90px; display: block; background: var(--c-bg); border-radius: 8px; }
.hist-line { fill: none; stroke: var(--c-green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.hist-grid { stroke: var(--c-line); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.hist-stats { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.hist-stats > div { display: flex; flex-direction: column; }
.hist-stats .lbl { font-size: .65rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .03em; }
.hist-stats .val { font: 700 .95rem/1.2 'Outfit', sans-serif; color: var(--c-ink); }
.hist-stats .val.good { color: var(--c-green-dark); }
.hist-stats .dt { font-size: .65rem; color: var(--c-muted); }
.hist-verdict { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.hist-pill { padding: 3px 9px; border-radius: 999px; font: 600 .68rem/1.2 'Outfit', sans-serif; background: var(--c-bg); color: var(--c-muted); }
.hist-pill.good { background: var(--c-green-tint); color: var(--c-green-dark); }
.hist-pill.warn { background: var(--c-orange-tint); color: var(--c-orange-dark); }
.hist-pill.muted { background: var(--c-bg); color: var(--c-muted); }
.hist-since { margin-top: 12px; font-size: .7rem; color: var(--c-muted); text-align: center; }

/* Canasta-básica inflation page (/precios) */
.canasta-page { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
.canasta-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.canasta-back { flex: none; width: 36px; height: 36px; border: 1px solid var(--c-line); border-radius: 10px;
    background: var(--c-surface); color: var(--c-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.canasta-head h1 { font: 700 1.4rem/1.2 'Outfit', sans-serif; color: var(--c-ink); margin: 0; }
.canasta-head p { font-size: .82rem; color: var(--c-muted); margin: 4px 0 0; }
.canasta-empty { padding: 28px 8px; color: var(--c-muted); text-align: center; display: flex; gap: 8px; align-items: center; justify-content: center; }
.canasta-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.ccat { flex: none; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--c-line); background: var(--c-surface);
    color: var(--c-muted); font: 600 .78rem/1 'Outfit', sans-serif; cursor: pointer; white-space: nowrap; }
.ccat.on { background: var(--c-green); border-color: var(--c-green); color: #fff; }
.canasta-card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
.canasta-svg { width: 100%; height: 180px; display: block; }
.cg-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cg-grid { stroke: var(--c-line); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.canasta-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: .68rem; color: var(--c-muted); }
.canasta-axis .cg-yrange { font-weight: 600; }
.canasta-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cl-item { display: flex; align-items: center; gap: 8px; }
.cl-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.cl-name { font-weight: 600; font-size: .85rem; }
.cl-now { margin-left: auto; font: 700 .95rem/1 'Outfit', sans-serif; color: var(--c-ink); }
.cl-chg { font: 700 .72rem/1 'Outfit', sans-serif; padding: 2px 7px; border-radius: 999px; }
.cl-chg.down { background: var(--c-green-tint); color: var(--c-green-dark); }
.cl-chg.up { background: var(--c-orange-tint); color: var(--c-orange-dark); }
.cl-chg.flat { background: var(--c-line); color: var(--c-muted); }
.cl-thin { font-size: .65rem; color: var(--c-muted); font-style: italic; }
.canasta-foot { margin-top: 16px; font-size: .72rem; color: var(--c-muted); line-height: 1.5; }

/* Home entry to the prices page */
/* Promoted feature card (home → "Precios en el tiempo") */
.feature-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px;
    border: 1px solid var(--c-green-tint-2);
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--c-green-tint) 0%, var(--c-surface) 72%);
    box-shadow: var(--shadow-sm);
    text-decoration: none; color: inherit; cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--c-green); }
.feature-card:active { transform: translateY(-1px) scale(.995); }
.feature-card-icon {
    width: 50px; height: 50px; flex: none;
    border-radius: 13px;
    display: grid; place-items: center;
    background: var(--c-green); color: #fff;
}
.feature-card-icon .mud-icon-root { font-size: 1.7rem; }
.feature-card-body { min-width: 0; flex: 1; }
.feature-card-eyebrow {
    display: block; font: 700 .66rem/1 'Outfit', sans-serif;
    letter-spacing: .12em; text-transform: uppercase; color: var(--c-green); margin-bottom: 4px;
}
.feature-card-title { display: block; font: 700 1.05rem/1.2 'Outfit', sans-serif; }
.feature-card-sub { display: block; color: var(--c-muted); font-size: .82rem; margin-top: 3px; line-height: 1.35; }
.feature-card-go { color: var(--c-green-dark); flex: none; }

.add-btn {
    width: 36px; height: 36px; flex: none;
    border: none; border-radius: 11px;
    background: var(--c-green);
    color: #fff;
    display: grid; place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, background .12s ease;
}
.add-btn:hover { background: var(--c-green-dark); }
.add-btn:active { transform: scale(.88); }
.add-btn.in-cart { background: var(--c-green-tint); color: var(--c-green-dark); }

/* Card actions row: the quick-compare button next to the add button */
.prod-actions { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.cmp-mini {
    width: 32px; height: 32px; flex: none;
    border: 1px solid var(--c-line); border-radius: 10px;
    background: #fff; color: var(--c-green-dark);
    display: grid; place-items: center; cursor: pointer;
    transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.cmp-mini:hover { background: var(--c-green-tint); border-color: var(--c-green); }
.cmp-mini:active { transform: scale(.9); }

.qty-mini { display: inline-flex; align-items: center; gap: 8px; }
.qty-mini button {
    width: 30px; height: 30px; border: none; border-radius: 9px;
    background: var(--c-green-tint); color: var(--c-green-dark);
    display: grid; place-items: center; cursor: pointer; transition: background .12s ease;
}
.qty-mini button:hover { background: var(--c-green-tint-2); }
.qty-mini .q { font: 700 .92rem/1 'Outfit', sans-serif; min-width: 18px; text-align: center; }

/* ---- Search ------------------------------------------------------------- */
.shop-search { display: flex; align-items: center; gap: 10px; }
.shop-search > .mud-input-control { flex: 1 1 auto; }
.scan-btn {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--c-line);
    background: #fff;
    color: var(--c-green-dark);
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, transform .06s ease;
}
.scan-btn:hover { border-color: var(--c-green); background: var(--c-green-tint); }
.scan-btn:active { transform: translateY(1px); }

/* ---- Barcode scanner + scan result ------------------------------------- */
.scan-stage {
    position: relative; width: 100%; aspect-ratio: 4 / 3;
    background: #000; border-radius: 14px; overflow: hidden;
}
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
    position: absolute; inset: 20% 12%;
    border: 2px solid rgba(255, 255, 255, .92); border-radius: 10px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .22);
    pointer-events: none;
}
.scan-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.scan-head img {
    width: 64px; height: 64px; object-fit: contain; flex: 0 0 auto;
    border-radius: 10px; background: #fff; border: 1px solid var(--c-line);
}
.scan-head .nm { font: 700 1rem/1.2 'Outfit', sans-serif; }
.scan-head .mt { font-size: .8rem; color: var(--c-muted); margin-top: 2px; }
.scan-sect {
    font: 700 .8rem/1 'Outfit', sans-serif; text-transform: uppercase; letter-spacing: .05em;
    color: var(--c-muted); margin: 18px 0 2px;
}
.scan-sim {
    font: 700 .66rem/1 'Outfit', sans-serif; color: var(--c-muted);
    background: var(--c-surface); border: 1px solid var(--c-line);
    padding: 3px 7px; border-radius: 999px; vertical-align: middle;
}
.scan-was { font-size: .8rem; color: var(--c-muted); text-decoration: line-through; margin-right: 6px; font-weight: 500; }
.scan-agotado { color: var(--c-orange-dark); font-weight: 600; font-size: .92rem; }
/* The store/name column grows and may shrink (min-width:0 lets long names wrap instead of overflowing the row) */
.cmp-grow { flex: 1 1 auto; min-width: 0; }
.scan-head > div { min-width: 0; }
.scan-extlink { color: var(--c-muted); display: inline-flex; flex: 0 0 auto; padding: 4px; border-radius: 8px; }
.scan-extlink:hover { color: var(--c-green-dark); background: var(--c-green-tint); }

/* ---- Cart --------------------------------------------------------------- */
.cart-list { display: flex; flex-direction: column; gap: 10px; }
.cart-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}
.cart-item-img { width: 60px; height: 60px; flex: none; border-radius: 10px; background: #fff; display: grid; place-items: center; padding: 4px; }
.cart-item-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cart-item-body { flex: 1; min-width: 0; }
.cart-item-name { font: 500 .92rem/1.25 'Inter', sans-serif; }
.cart-item-meta { font-size: .76rem; color: var(--c-muted); margin-top: 2px; }
.cart-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.cart-line-total { font: 700 1rem/1 'Outfit', sans-serif; }

.swap-btn {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px dashed var(--c-orange);
    background: var(--c-orange-tint);
    color: var(--c-orange-dark);
    font: 600 .76rem/1 'Outfit', sans-serif;
    cursor: pointer;
    transition: background .12s ease;
}
.swap-btn:hover { background: #ffe6d2; }

/* savings reveal panel */
.savings-card {
    border-radius: 20px;
    padding: 22px;
    background: linear-gradient(135deg, #fff 0%, var(--c-green-tint) 100%);
    border: 1px solid var(--c-green-tint-2);
    box-shadow: var(--shadow);
}
.savings-total { font: 800 2.4rem/1 'Outfit', sans-serif; letter-spacing: -.02em; }
.savings-amount {
    font: 800 1.5rem/1 'Outfit', sans-serif;
    color: var(--c-orange-dark);
    display: inline-block;
}
.savings-pop { animation: pop-in .5s cubic-bezier(.2, .9, .3, 1.3); }

.cmp-row {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid var(--c-line);
    background: #fff;
    margin-top: 10px;
    transition: box-shadow .14s ease, border-color .14s ease;
}
.cmp-row.is-best { border-color: var(--c-green); box-shadow: 0 0 0 2px var(--c-green-tint-2); background: linear-gradient(180deg, var(--c-green-tint) 0%, #fff 100%); }
.cmp-name { font: 700 .95rem/1.15 'Outfit', sans-serif; }
.cmp-meta { font-size: .76rem; color: var(--c-muted); }
.cmp-total { margin-left: auto; font: 700 1.15rem/1 'Outfit', sans-serif; text-align: right; }
.cmp-badge {
    font: 700 .66rem/1 'Outfit', sans-serif; letter-spacing: .05em; text-transform: uppercase;
    color: var(--c-green-dark); background: var(--c-green-tint-2);
    padding: 4px 8px; border-radius: 999px;
}

/* ---- Sticky cart bar (appears while shopping) -------------------------- */
.cart-bar-wrap {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1090;
    display: flex; justify-content: center;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    pointer-events: none;
}
.cart-bar {
    pointer-events: auto;
    width: min(560px, 100%);
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px 10px 16px;
    border-radius: 16px;
    background: var(--c-ink);
    color: #fff;
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    animation: slide-up .3s cubic-bezier(.2, .8, .3, 1);
}
.cart-bar .cb-count {
    width: 34px; height: 34px; flex: none; border-radius: 10px;
    background: rgba(255, 255, 255, .14); display: grid; place-items: center;
    font: 700 .95rem/1 'Outfit', sans-serif;
}
.cart-bar .cb-text { display: flex; flex-direction: column; line-height: 1.2; }
.cart-bar .cb-label { font-size: .72rem; opacity: .7; }
.cart-bar .cb-total { font: 700 1.05rem/1.1 'Outfit', sans-serif; }
.cart-bar .cb-go { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font: 700 .9rem/1 'Outfit', sans-serif;
    background: var(--c-green); padding: 9px 14px; border-radius: 11px; }
.cart-bar .cb-save { color: #ffd9bf; font-size: .72rem; }

/* ---- Empty states ------------------------------------------------------- */
.empty-pane {
    text-align: center; padding: 48px 20px;
    border: 1px dashed var(--c-line); border-radius: var(--radius); background: #fff;
}
.empty-pane .ic { color: var(--c-green-tint-2); }

/* ---- Misc --------------------------------------------------------------- */
.back-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--c-muted); font: 600 .85rem/1 'Outfit', sans-serif;
    cursor: pointer; text-decoration: none; background: none; border: none; padding: 4px 0;
}
.back-link:hover { color: var(--c-green-dark); }

.pill-toggle { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---- Motion ------------------------------------------------------------- */
.fade-up { animation: fadeUp .42s cubic-bezier(.2, .8, .3, 1) both; }
.stagger > * { animation: fadeUp .42s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 28ms); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes badge-pop { 0% { transform: scale(.2); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---- Dark / light toggle (home corner) --------------------------------- */
.theme-toggle {
    position: fixed; right: 18px; z-index: 1080;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--c-surface); color: var(--c-ink);
    border: 1px solid var(--c-line);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .14s ease, background .14s ease, color .14s ease, border-color .14s ease;
}
.theme-toggle:hover { transform: translateY(-2px) scale(1.05); border-color: var(--c-green-tint-2); }
.theme-toggle:active { transform: scale(.93); }

/* ---- Dark mode ---------------------------------------------------------- */
/* Toggled by the `data-theme` attribute on <html> (set early in index.html, mirrored by ThemeState).
   Re-points the design tokens; a few elements that hardcoded white — or used --c-ink as a background —
   are remapped so they flip too. Product-photo tiles intentionally stay white. */
[data-theme="dark"] {
    --c-green: #16a34a;
    --c-green-dark: #4ade80;        /* readable green for text/accents on dark surfaces & tints */
    --c-green-tint: #16271d;
    --c-green-tint-2: #1f3a2a;
    --c-orange: #f97316;
    --c-orange-dark: #fb923c;       /* readable orange for sale text on dark */
    --c-orange-tint: #2a1a0e;
    --c-ink: #e6edf3;
    --c-muted: #93a4b3;
    --c-line: #2a333c;
    --c-surface: #1a2127;
    --c-bg: #0f1419;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 6px 18px rgba(0, 0, 0, .5);
    --shadow-lg: 0 14px 34px rgba(0, 0, 0, .6);
}
[data-theme="dark"] .branch-chip,
[data-theme="dark"] .subcat-chip,
[data-theme="dark"] .cmp-mini,
[data-theme="dark"] .scan-btn,
[data-theme="dark"] .cmp-row,
[data-theme="dark"] .empty-pane { background: var(--c-surface); }
[data-theme="dark"] .savings-card { background: linear-gradient(135deg, var(--c-surface) 0%, var(--c-green-tint) 100%); }
[data-theme="dark"] .cmp-row.is-best { background: linear-gradient(180deg, var(--c-green-tint) 0%, var(--c-surface) 100%); }
[data-theme="dark"] .store-letter { box-shadow: 0 0 0 2px var(--c-surface); }
[data-theme="dark"] .shop-appbar { background: rgba(15, 20, 25, .82); }
/* Elements that used --c-ink (now light) as a *background* need a real dark fill. */
[data-theme="dark"] .subcat-chip.is-active { background: var(--c-green); border-color: var(--c-green); }
[data-theme="dark"] .cart-bar { background: #1f2730; }
/* "Suele estar agotado" chip: tuned for a dark card. */
[data-theme="dark"] .pb-out { background: #3a1d1d; color: #fca5a5; }

@media (prefers-reduced-motion: reduce) {
    *, .fade-up, .stagger > *, .savings-pop, .cart-bar, .cart-badge {
        animation: none !important;
        transition: none !important;
    }
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 600px) {
    .shop-main { padding: 16px 12px 120px; }
    .cat-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
    .prod-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .store-pill { max-width: 52vw; }
    /* Mobile pill: brand letter badge + branch only ("(W) Santa Elena"), no storefront icon / chain name. */
    .store-pill-badge { display: grid; }
    .store-pill-icon { display: none; }
    .store-pill-full { display: none; }
    .store-pill-branch { display: inline; }
    .home-hero { padding: 24px 18px; }
    /* Cart: surface the total + "Comparar" CTA above the item list on phones. */
    .cart-col-summary { order: -1; }
    .cart-col-summary .savings-card { position: static !important; }
}
