:root {
  --red: #c8161d; --red-d: #9b0f15; --red-s: #fbe9e7; --saffron: #ef8a1f; --saffron-s: #fff1df;
  --bg: #fbf6ef; --card: #ffffff; --ink: #2a1a14; --ink2: #5d4a40; --muted: #8a7568; --line: #ecdfd2;
  --ok: #1e7a3c; --ok-s: #e5f4ea; --warn: #b25407; --warn-s: #fff0dc;
  --r: 16px; --r-s: 11px; --sh: 0 1px 2px rgba(60, 30, 10, .06), 0 6px 22px rgba(60, 30, 10, .07);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red: #ef4b4f; --red-d: #ff7c7c; --red-s: #3a1a1a; --saffron: #f6a24a; --saffron-s: #3a2a17;
    --bg: #17110e; --card: #221a16; --ink: #f6ece4; --ink2: #d6c4b8; --muted: #a8968a; --line: #3a2e27;
    --ok: #59c27c; --ok-s: #17301f; --warn: #f0a24a; --warn-s: #3a2a12;
    --sh: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 Mukta, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
:focus-visible { outline: 2.5px solid var(--saffron); outline-offset: 2px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 8px 16px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.top-in .search { order: 9; flex: 1 0 100%; }   /* phone: search on its own line under the store chip */
.brand img { width: 88px; height: auto; }
.store-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 13px 5px 9px; text-align: left; }
.store-chip svg { color: var(--red); }
.store-chip span { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.store-chip small { font-size: 11px; color: var(--muted); }
.store-chip b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-act { display: flex; gap: 6px; }
.icon-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-weight: 700; text-decoration: none; }
.icon-btn.bag i { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font: 700 11.5px/19px Mukta; font-style: normal; text-align: center; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 0 12px; height: 44px; }
.search svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 16px Mukta; color: var(--ink); }
@media (min-width: 900px) {
  .top-in { flex-wrap: nowrap; padding-top: 10px; padding-bottom: 10px; gap: 14px; }
  .top-in .store-chip { flex: 0 1 260px; }
  .top-in .search { order: 0; flex: 1 1 auto; max-width: 520px; margin-left: auto; }
}

main { max-width: 1200px; margin: 0 auto; padding: 14px 16px 40px; min-height: 70vh; outline: 0; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 6vw, 40px); font-weight: 800; }
h2 { font-size: 21px; font-weight: 800; }
h3 { font-size: 16.5px; font-weight: 700; }
.sec { margin: 26px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec a, .link { color: var(--red); font-weight: 700; font-size: 14.5px; text-decoration: none; background: none; border: 0; padding: 0; }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 22px 20px 20px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #f39a2b 0%, transparent 46%), linear-gradient(135deg, #b5121a 0%, #d81f26 55%, #c0141b 100%); box-shadow: var(--sh); }
.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; border: 18px solid rgba(255, 196, 120, .22); }
.hero p { margin: 8px 0 0; max-width: 34ch; color: #ffe9d6; font-size: 16px; }
.hero .stat { display: flex; gap: 18px; margin-top: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .stat div { line-height: 1.1; }
.hero .stat b { display: block; font-size: 22px; font-weight: 800; }
.hero .stat span { font-size: 12.5px; color: #ffd9bd; }
.hero .cta { position: relative; z-index: 1; margin-top: 16px; display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--red-d); border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 800; }
@media (prefers-color-scheme: dark) { .hero .cta { color: #9b0f15; } }

/* departments + tiles */
.depts { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 16px -16px 0; padding: 0 16px 2px; }
.depts::-webkit-scrollbar { display: none; }
.pill { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 15px; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.pill.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px) { .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; padding: 13px 13px 12px; border-radius: var(--r); text-decoration: none; background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh); overflow: hidden; transition: transform .25s var(--ease); }
.tile:active { transform: scale(.98); }
.tile .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--t, var(--red-s)); color: var(--tc, var(--red)); }
.tile .ico svg { width: 25px; height: 25px; stroke-width: 1.6; }
.tile b { display: block; font-size: 16.5px; font-weight: 800; margin-top: 10px; line-height: 1.15; }
.tile small { color: var(--muted); font-size: 13px; }

/* chips row */
.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip small { opacity: .75; font-weight: 500; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.bar select { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 10px; font: 600 14px Mukta; color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--card); padding: 3px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.seg button.on { background: var(--ink); color: var(--bg); }

/* crumbs */
.crumb { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumb a { text-decoration: none; color: var(--ink2); font-weight: 600; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 14px; } }
.card { display: flex; flex-direction: column; text-decoration: none; background: var(--card); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--sh); text-align: left; padding: 0; transition: transform .25s var(--ease); }
.card:active { transform: scale(.985); }
.ph { position: relative; aspect-ratio: 4 / 5; background: var(--ph, linear-gradient(160deg, var(--saffron-s), var(--red-s))); display: grid; place-items: center; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .glyph { color: color-mix(in srgb, var(--red) 55%, transparent); }
.ph .glyph svg { width: 46px; height: 46px; stroke-width: 1.2; }
.ph .sw { position: absolute; left: 10px; bottom: 10px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.ph .off { position: absolute; top: 9px; left: 9px; background: var(--ok); color: #fff; font: 700 12px/1 Mukta; padding: 5px 7px 4px; border-radius: 7px; }
.ph .code { position: absolute; right: 9px; bottom: 8px; font: 600 11px Mukta; color: color-mix(in srgb, var(--ink) 55%, transparent); }
.card .body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card .nm { font-size: 14.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card .br { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.price b { font-size: 17px; font-weight: 800; }
.price s { color: var(--muted); font-size: 13px; }
.price em { font-style: normal; color: var(--ok); font-weight: 700; font-size: 13px; }
.avail { margin-top: auto; padding-top: 4px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; line-height: 1.2; }
.avail::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.avail.ok { color: var(--ok); } .avail.low { color: var(--warn); } .avail.far { color: var(--ink2); }
.more { display: block; margin: 18px auto 0; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 22px; font-weight: 700; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

/* product page */
.pd { display: grid; gap: 18px; }
@media (min-width: 900px) { .pd { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; } .pd .ph { border-radius: 22px; position: sticky; top: 90px; } }
.pd .ph { border-radius: 18px; aspect-ratio: 4 / 5; }
.pd .ph:not(:has(img)) { aspect-ratio: 16 / 10; }   /* no photo yet: a short placeholder, the details stay on screen */
@media (min-width: 900px) { .pd .ph:not(:has(img)) { aspect-ratio: 4 / 5; } }
.pd .ph .glyph svg { width: 80px; height: 80px; }
.pd h1 { font-size: clamp(24px, 5vw, 32px); }
.pd .price b { font-size: 26px; }
.pd .price s { font-size: 16px; }
.pd .price em { font-size: 15px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.meta span { font-size: 13px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; color: var(--ink2); }
.lbl { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.sz { min-width: 52px; padding: 8px 12px; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; font-weight: 700; position: relative; }
.sz.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.sz.away { color: var(--muted); border-style: dashed; }
.stores { display: flex; flex-direction: column; gap: 8px; }
.st { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; text-align: left; width: 100%; }
.st.on { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 15%, transparent); }
.st .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.st.on .radio { border-color: var(--red); }
.st.on .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.st .tx { flex: 1; min-width: 0; line-height: 1.2; }
.st .tx b { display: block; font-size: 15px; }
.st .tx small { color: var(--muted); font-size: 12.5px; }
.badge { flex: none; font: 700 12px/1 Mukta; padding: 6px 8px 5px; border-radius: 8px; white-space: nowrap; }
.badge.ok { background: var(--ok-s); color: var(--ok); }
.badge.low { background: var(--warn-s); color: var(--warn); }
.badge.no { background: var(--line); color: var(--muted); }
/* 👑 owner view (signed-in owner only) */
.badge.own { background: #2a1a12; color: #ffd98a; }
.owner-line { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: #2a1a12; color: #fbe9c6; font-size: 14px; }
.owner-line b { color: #ffd98a; }
.owner-line small { opacity: .7; }
.cta-row { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); margin-top: 14px; }
.btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--ink); background: var(--card); font-weight: 800; font-size: 16px; text-decoration: none; padding: 0 16px; }
.btn.pri { background: var(--red); border-color: var(--red); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.sm { min-height: 38px; font-size: 14px; border-radius: 11px; flex: none; border-width: 1px; }
.note { font-size: 13.5px; color: var(--ink2); background: var(--saffron-s); border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.acts { display: flex; gap: 6px; flex: none; }
.acts a { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink2); }
.acts svg { width: 17px; height: 17px; }

/* bag + checkout */
.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: var(--sh); }
.group h3 { display: flex; justify-content: space-between; gap: 10px; }
.line { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.line .ph { width: 72px; aspect-ratio: 4 / 5; border-radius: 10px; flex: none; }
.line .ph .glyph svg { width: 26px; height: 26px; }
.line .tx { flex: 1; min-width: 0; }
.line .tx b { font-weight: 600; font-size: 15px; display: block; }
.line .tx small { color: var(--muted); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; }
.qty button { width: 32px; height: 30px; border: 0; background: none; font-weight: 800; font-size: 17px; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.tot { display: flex; justify-content: space-between; font-weight: 800; font-size: 18px; padding-top: 10px; border-top: 1px dashed var(--line); margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13.5px; font-weight: 700; color: var(--ink2); }
.field input { height: 48px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; font: 500 16px Mukta; background: var(--card); color: var(--ink); }
.field input:focus { border-color: var(--ink); outline: 0; }
.pay { display: flex; flex-direction: column; gap: 8px; }
.pay .st small { display: block; }
.steps { display: grid; gap: 10px; counter-reset: s; margin: 12px 0 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--red-s); color: var(--red); font-weight: 800; display: grid; place-items: center; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; padding: 6px 12px; border-radius: 999px; background: var(--ok-s); color: var(--ok); }
.status.wait { background: var(--warn-s); color: var(--warn); }

/* sheet */
#sheetBg { position: fixed; inset: 0; z-index: 40; background: rgba(20, 10, 5, .45); animation: fade .2s ease; }
#sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: up .32s var(--ease); }
@media (min-width: 700px) { #sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, 94vw); border-radius: 22px; animation: pop .25s var(--ease); } }
#sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
#sheet h2 { margin-bottom: 4px; }
.locbtn { width: 100%; margin: 12px 0; }
.citys { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -46%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

#toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14.5px; transition: .25s var(--ease); pointer-events: none; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.foot { border-top: 1px solid var(--line); background: var(--card); }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 22px 16px calc(28px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--ink2); }
.foot-in p { margin: 10px 0 0; max-width: 60ch; }
.skel { background: linear-gradient(90deg, var(--line) 0, color-mix(in srgb, var(--line) 50%, var(--card)) 50%, var(--line) 100%); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }
