/* Дэлгүүрийн сайт (худалдан авагч) — утсанд эхэлж, компьютерт өргөсдөг */
body { background: var(--ground); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.shop-top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.shop-top .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: var(--ink); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; font-weight: 700; font-size: 18px; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-btn { position: relative; width: 48px; height: 48px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--surface); display: flex; align-items: center; justify-content: center; }
.cart-btn .n { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cart-btn .n:empty { display: none; }

.hero { padding: 20px 0 6px; display: flex; flex-direction: column; gap: 12px; }
.hero h1 { margin: 0; font-size: clamp(24px, 6vw, 36px); line-height: 1.15; letter-spacing: -0.01em; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); text-decoration: none; }
.fact.accent { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 25%, var(--surface)); color: var(--ink); }

.tools { position: sticky; top: 64px; z-index: 15; background: var(--ground); padding: 10px 0; display: flex; flex-direction: column; gap: 10px; }
.searchbar { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 14px; color: var(--muted); }
.searchbar:focus-within { border-color: var(--accent); }
.searchbar input { border: 0; outline: none; background: transparent; flex: 1; font-size: 16px; min-width: 0; color: var(--ink); }
.cats { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.cats::-webkit-scrollbar { display: none; }
.cats .chip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 6px 0 120px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card-p { display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); text-align: left; padding: 0; color: inherit; }
.card-p .ph { position: relative; aspect-ratio: 1 / 1; background: #E9ECF0; display: flex; align-items: center; justify-content: center; color: #8A919C; }
.card-p .ph img { width: 100%; height: 100%; object-fit: cover; }
.card-p .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card-p .nm { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.card-p .pr { font-size: 16px; font-weight: 700; }
.card-p .pr s { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.tag { position: absolute; top: 8px; left: 8px; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 8px; }
.tag.sale { background: #B42318; color: #fff; }
.tag.out { background: rgba(18,22,31,.82); color: #fff; }
.card-p.is-out .ph img { opacity: .55; }

.state-msg { text-align: center; padding: 56px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ---- доод сагсны мөр ---- */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--ground) 70%, transparent); pointer-events: none; }
.cartbar button { pointer-events: auto; max-width: 560px; margin: 0 auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 18px; border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 600; box-shadow: 0 6px 20px rgba(18,22,31,.18); }
.cartbar[hidden] { display: none; }

/* ---- dialog (барааны дэлгэрэнгүй, сагс) ---- */
dialog.sheet { border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink); overflow: hidden; }
dialog.sheet::backdrop { background: rgba(18,22,31,.5); }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; max-width: 560px; border-radius: 22px; }
}
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.close-x { position: absolute; top: 10px; right: 10px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(18,22,31,.2); }

.gallery { position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 1 / 1; background: #E9ECF0; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.slides .noimg { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; color: #8A919C; }
.dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.6); box-shadow: 0 0 0 1px rgba(18,22,31,.15); }
.dots i.on { background: #fff; width: 18px; border-radius: 4px; }
.pd { padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 12px; }
.pd h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.pd .price { font-size: 22px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pd .price s { font-size: 15px; font-weight: 400; color: var(--muted); }
.pd .price .off { font-size: 13px; color: #B42318; font-weight: 700; }
.pd .desc { white-space: pre-line; font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 0; }
.pd .cat { font-size: 13px; color: var(--muted); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts .chip { min-width: 48px; min-height: 44px; justify-content: center; border-radius: 12px; }
.opts .chip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt-label { font-size: 14px; font-weight: 600; }
.opt-label.err { color: var(--danger); }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 14px; }
.qty button { width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; padding: 0; }
.qty output { min-width: 32px; text-align: center; font-weight: 700; font-size: 16px; }
.add-row { display: flex; gap: 10px; align-items: center; }
.add-row .btn { flex: 1; }

.citem { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.citem .thumb { width: 64px; height: 64px; }
.citem .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.citem .nm { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem .sub { font-size: 13px; color: var(--muted); }
.citem .qty { border-radius: 12px; }
.citem .qty button { width: 38px; height: 40px; }
.sum { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; font-size: 16px; }
.sum b { font-size: 20px; }
.checkout { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.checkout h3 { margin: 6px 0 0; font-size: 16px; }
.done-box { padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.done-box .big { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex; align-items: center; justify-content: center; }
.done-box h2 { margin: 0; font-size: 22px; }
.done-box p { margin: 0; color: var(--ink-2); line-height: 1.5; }

.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0 120px; font-size: 14px; color: var(--ink-2); }
.foot .wrap { display: flex; flex-direction: column; gap: 10px; }
.foot b { font-size: 16px; color: var(--ink); }
.foot a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.foot small { color: var(--muted); }

/* ---- захиалга: дүн, бүс, төлбөр, байршил ---- */
.sums { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.sums > div { display: flex; justify-content: space-between; gap: 12px; }
.sums .grand { color: var(--ink); font-size: 16px; padding-top: 6px; border-top: 1px dashed var(--line-2); }
.sums .grand b { font-size: 20px; }
.hint-line { margin: 0; display: flex; gap: 6px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; }
.hint-line svg { flex-shrink: 0; margin-top: 2px; }
.paypick { display: flex; flex-direction: column; gap: 8px; }
.payopt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 14px; cursor: pointer; }
.payopt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.payopt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.payopt span { display: flex; flex-direction: column; gap: 2px; }
.payopt b { font-size: 15px; }
.payopt small { font-size: 13px; color: var(--muted); }
.locbox { display: flex; flex-direction: column; gap: 6px; }
.loc-btn { justify-content: flex-start; min-height: 46px; }
.loc-ok { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 46px; padding: 0 12px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); font-size: 14px; font-weight: 600; }
.loc-ok a { color: var(--ok); }
.loc-ok .spinner { width: 18px; height: 18px; border-width: 2px; }
.bankbox { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 16px; background: var(--ground); border: 1px solid var(--line); }
.bankbox > b { font-size: 16px; margin-bottom: 4px; }
.bankbox .brow { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 14px; min-height: 36px; }
.bankbox .brow > span:first-child { color: var(--muted); }
.bankbox .v { font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bankbox small { color: var(--muted); font-size: 12px; }
.bankbox .linkbtn { min-height: 36px; font-size: 13px; }
.done-box .pmeta { margin-top: -6px; }

/* ---- нүүр баннер ---- */
.hero-b { padding: 14px 0 4px; display: flex; flex-direction: column; gap: 12px; }
.banner { position: relative; }
.b-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 18px; gap: 0; }
.b-track::-webkit-scrollbar { display: none; }
.b-slide { flex: 0 0 100%; scroll-snap-align: center; position: relative; display: flex; flex-direction: column; border: 0; padding: 0; margin: 0; background: var(--surface); text-align: left; color: inherit; font: inherit; overflow: hidden; }
button.b-slide { cursor: pointer; }
.b-media { display: block; aspect-ratio: 16 / 9; background: #E9ECF0; }
@media (min-width: 720px) { .b-media { aspect-ratio: 5 / 2; } }
.b-media img { width: 100%; height: 100%; object-fit: cover; }
.b-text { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.b-title { font-size: clamp(20px, 5.4vw, 34px); font-weight: 700; line-height: 1.15; text-wrap: balance; }
.b-sub { font-size: clamp(14px, 3.6vw, 18px); line-height: 1.4; }
.b-btn { margin-top: 6px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); min-height: 44px; pointer-events: none; }
.s-overlay .b-text { position: absolute; inset: auto 0 0 0; padding: 48px 18px 18px; color: #FFFFFF; background: linear-gradient(to top, rgba(10,12,18,.78), rgba(10,12,18,.35) 60%, transparent); }
.s-overlay .b-title, .s-overlay .b-sub { text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.s-below .b-text { padding: 14px 16px 16px; }
.s-below .b-sub { color: var(--muted); }
.b-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.s-below ~ .b-dots, .banner:has(.s-below) .b-dots { position: static; padding-top: 8px; }
.b-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.65); box-shadow: 0 0 0 1px rgba(18,22,31,.2); transition: width .2s; }
.banner:has(.s-below) .b-dots i { background: var(--line-2); box-shadow: none; }
.b-dots i.on { width: 18px; border-radius: 4px; background: #FFFFFF; }
.banner:has(.s-below) .b-dots i.on { background: var(--accent); }

/* ---- жагсаалтын толгой, цааш үзэх, дээш ---- */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 2px 0 8px; }
.sortbox select { min-height: 40px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); padding: 0 10px; font-size: 14px; color: var(--ink); }
.grid { padding-bottom: 12px; }
.more-zone { display: flex; justify-content: center; padding: 8px 0 120px; min-height: 60px; }
.more-zone .btn { min-width: 200px; }
.to-top { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 24; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 4px 14px rgba(18,22,31,.16); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.to-top svg { transform: rotate(90deg); }
