/* Didgah catalog storefront — boutique redesign (frames.html + frame.html).
   Loads AFTER site.css on catalog pages only. Surfaces map onto the shared
   theme tokens so dark mode keeps working; spec palette drives accents. */

:root {
  --cat-navy: #102e60;
  --cat-teal: #007f9f;
  --cat-teal-soft: #eaf7fa;
  --cat-ok: #18794e;
  --cat-err: #b42318;
  --cat-maxw: 1320px;
}
:root[data-theme="dark"] { --cat-teal-soft: #16283a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cat-teal-soft: #16283a; }
}

/* display:* rules below must never resurrect a [hidden] element */
[hidden] { display: none !important; }

/* ---------- compact intro (replaces the big hero band) ---------- */
.cat-intro {
  max-width: var(--cat-maxw); margin: 0 auto;
  padding: 1.1rem 1rem .4rem;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1.2rem;
}
.cat-intro .breadcrumb { margin: 0 0 .15rem; width: 100%; font-size: .82rem; }
.cat-intro h1 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); margin: 0; }
.cat-intro p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.cat-intro a.cat-guide-link { font-size: .85rem; font-weight: 700; margin-inline-start: auto; }
/* category-hero stats («۱۳۲ مدل از ۱۴ برند») + top-brand quick chips —
   Sunglass Hut-style merchandising, real catalog counts only */
.cat-stats { font-size: .85rem; color: var(--ink-soft); margin: .25rem 0 0; }
.cat-brandchips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.cat-brandchip {
  font: inherit; font-size: .8rem; padding: .28rem .7rem; border-radius: 999px;
  border: 1px solid var(--cat-border, #dbe4ee); background: var(--cat-surface, #fff);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.cat-brandchip:hover, .cat-brandchip:focus-visible {
  border-color: var(--brand, #1b3a75); box-shadow: 0 2px 8px rgba(10,20,40,.08);
}
.cat-crumb-k { color: var(--ink-soft); }

/* ---------- toolbar: prominent search + sort + count ---------- */
.cat-shell { max-width: var(--cat-maxw); margin: 0 auto; padding: 0 1rem 2rem; }
.cat-toolbar {
  display: flex; gap: .6rem; align-items: center;
  padding: .8rem 0 .6rem; position: sticky; top: 60px; z-index: 20;
  background: var(--bg);
}
.cat-search {
  position: relative; flex: 1 1 auto; min-width: 0;
}
.cat-search input {
  width: 100%; font: inherit; font-size: .95rem;
  padding: .7rem 2.8rem .7rem 2.8rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  min-height: 46px;
}
.cat-search input:focus { border-color: var(--cat-teal); outline: none; box-shadow: 0 0 0 3px rgba(0,127,159,.16); }
.cat-search svg { position: absolute; inset-inline-start: .8rem; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; stroke: var(--muted); pointer-events: none; }
.cat-search .cat-clear {
  position: absolute; inset-inline-end: .45rem; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.cat-search .cat-clear:hover { background: var(--brand-soft); color: var(--ink); }
.cat-count { font-size: .82rem; color: var(--muted); white-space: nowrap; }

.cat-sort { position: relative; }
.cat-sort select {
  font: inherit; font-size: .88rem; padding: .55rem .8rem; min-height: 46px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.cat-sort select:focus { border-color: var(--cat-teal); outline: none; box-shadow: 0 0 0 3px rgba(0,127,159,.16); }

/* «فقط موجود‌ها» — one-tap availability shortcut in the toolbar; mirrors
   the stock facet, so it only renders when both buckets exist. */
.cat-instock {
  font: inherit; font-size: .86rem; font-weight: 700; min-height: 46px;
  padding: .45rem .95rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cat-instock::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  background: var(--border); transition: background .15s ease;
}
.cat-instock:hover { border-color: var(--cat-ok); color: var(--ink); }
.cat-instock.on { border-color: var(--cat-ok); color: var(--cat-ok); background: var(--cat-ok-soft, #e9f7ee); }
.cat-instock.on::before { background: var(--cat-ok); }
.cat-instock:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,127,159,.16); }

/* ---- print: compare table, selection list and the detail spec sheet
   are the take-to-store artifacts — visibility trick keeps layout while
   isolating the printable surface; interactive controls never print. */
/* print-only artifact chrome — shop contact on every take-away sheet and a
   title/foot pair for «چاپ نتایج»; never on screen */
.cat-printhead, .cat-printfoot, .cat-printslot, .cat-printfilters { display: none; }

@media print {
  body * { visibility: hidden; }
  #comparePanel, #comparePanel *, .cat-sel-sheet, .cat-sel-sheet *,
  .cat-detail, .cat-detail * { visibility: visible; }
  #comparePanel, .cat-sel-sheet, .cat-detail { position: absolute !important; inset: 0 auto auto 0; width: 100%; }
  #comparePanel .cmp-scroll, .cat-sel-sheet .cat-sheet-body { overflow: visible !important; }
  #comparePanel .cmp-acts, #comparePanel .cmp-diff,
  .cat-sel-sheet .cat-sheet-foot, .cat-sel-sheet #selClose,
  .cat-detail .fdd-actions, .cat-detail .fd-share, .cat-detail .fd-sel-link,
  .cat-detail .breadcrumb, .cat-detail .fd-thumbs { display: none !important; }
  .cat-sel-sheet .cat-printfoot, #comparePanel .cat-printfoot, .cat-detail .cat-printfoot {
    display: block; margin: 1.2rem 0 0; padding-top: .6rem;
    border-top: 1px solid var(--border); font-size: .8rem; color: var(--ink-soft);
  }
  /* «چاپ نتایج» — isolate the filtered cards as a mini-catalog sheet */
  body.print-grid .cat-layout { display: block; }
  body.print-grid .cat-side, body.print-grid #active,
  body.print-grid #moreBox, body.print-grid #empty { display: none !important; }
  body.print-grid #gridPrintZone { position: absolute !important; inset: 0 auto auto 0; width: 100%; }
  body.print-grid #gridPrintZone, body.print-grid #gridPrintZone * { visibility: visible; }
  body.print-grid .cat-printhead {
    display: block; margin: 0 0 .8rem; font-size: 1.05rem; font-weight: 800; color: var(--ink);
  }
  body.print-grid .cat-printfilters {
    display: block; margin: -.5rem 0 .8rem; font-size: .78rem; color: var(--ink-soft);
  }
  body.print-grid .cat-printfilters:empty { display: none; }
  body.print-grid .cat-printslot { display: block; }
  body.print-grid .cat-printfoot {
    display: block; margin: 1rem 0 0; padding-top: .6rem;
    border-top: 1px solid var(--border); font-size: .8rem; color: var(--ink-soft);
  }
}

.cat-mbtns { display: none; gap: .5rem; }
.cat-mbtn {
  font: inherit; font-size: .86rem; font-weight: 700; min-height: 44px;
  padding: .45rem .9rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
}
.cat-mbtn .cat-fn { min-width: 20px; height: 20px; border-radius: 999px; background: var(--cat-teal); color: #fff; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem; }

/* ---------- quick category chips ---------- */
.cat-kinds {
  display: flex; gap: .45rem; flex-wrap: wrap; padding: .1rem 0 .9rem;
}
.cat-kind {
  font: inherit; font-size: .88rem; font-weight: 700; min-height: 40px;
  padding: .35rem 1rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.cat-kind:hover { border-color: var(--cat-teal); color: var(--cat-teal); }
.cat-kind.on { background: var(--cat-navy); border-color: var(--cat-navy); color: #fff; }
.cat-kind .n { font-size: .75rem; opacity: .7; font-weight: 400; }
.cat-kind-fav { border-style: dashed; }
.cat-kind-fav.on { background: #e0245e; border-color: #e0245e; border-style: solid; color: #fff; }

/* ---------- layout: sidebar + grid ---------- */
.cat-layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 1.4rem; align-items: start; }

.cat-side { position: sticky; top: 128px; max-height: calc(100vh - 150px); overflow: auto; padding-inline-end: .2rem; }
.cat-side .cat-fclear { width: 100%; margin-bottom: .8rem; }
.cat-fgroup { border-top: 1px solid var(--border); padding: .7rem 0; }
.cat-fgroup > h4 { margin: 0 0 .55rem; font-size: .88rem; color: var(--ink); }
.cat-fopt { display: flex; align-items: center; gap: .55rem; padding: .28rem 0; font-size: .88rem; color: var(--ink-soft); cursor: pointer; min-height: 34px; }
.cat-fopt input { width: 18px; height: 18px; accent-color: var(--cat-teal); flex-shrink: 0; }
.cat-fopt .lbl { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-fopt .n {
  flex-shrink: 0; margin-inline-start: .4rem; font-size: .72rem; font-weight: 700;
  color: var(--ink-soft); background: var(--brand-soft); border-radius: 999px;
  min-width: 1.9em; text-align: center; padding: .08rem .45rem; line-height: 1.5;
}
/* facet expander — own style, not the red "clear all" look */
.cat-fmore {
  font: inherit; font-size: .8rem; font-weight: 700; width: 100%; min-height: 38px;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  margin-top: .3rem; padding: .45rem .8rem; cursor: pointer;
  color: var(--cat-teal); background: transparent;
  border: 1px dashed var(--border); border-radius: 10px;
}
.cat-fmore:hover { border-color: var(--cat-teal); background: var(--cat-teal-soft); }
.cat-fmore .arr { font-size: .9em; line-height: 1; }

/* active filter chips */
.cat-active { display: none; flex-wrap: wrap; gap: .45rem; padding: 0 0 .8rem; }
.cat-active.show { display: flex; }
.cat-achip {
  font: inherit; font-size: .8rem; display: inline-flex; align-items: center; gap: .4rem;
  background: var(--cat-teal-soft); color: var(--brand-ink); border: 1px solid var(--border);
  border-radius: 999px; padding: .25rem .7rem; min-height: 32px; cursor: pointer;
}
.cat-achip:hover { text-decoration: line-through; }
.cat-achip b { font-weight: 700; }
.cat-achip .x { font-size: .95rem; line-height: 1; }
.cat-clearall {
  font: inherit; font-size: .8rem; color: var(--cat-err); background: none; border: 0;
  cursor: pointer; padding: .25rem .4rem; text-decoration: underline;
}
.cat-sharelink {
  font: inherit; font-size: .8rem; color: var(--cat-teal); background: none;
  border: 1px dashed var(--cat-teal); border-radius: 999px; cursor: pointer;
  padding: .15rem .7rem;
}
.cat-sharelink:hover { background: var(--brand-soft); }

/* ---------- product grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }

.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #cfdce9; }
.cat-card-media { position: relative; }
.cat-card-img {
  display: block; aspect-ratio: 1/1; box-sizing: border-box;
  padding: 3.5%; background: #fff;
  border-bottom: 1px solid var(--border);
  touch-action: pan-y;
}
.cat-card-img img { width: 100%; height: 100%; object-fit: contain; }
.cat-card-ph { aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 42%, #fff, var(--brand-soft) 78%); color: var(--brand); }
.cat-card-ph svg { width: 64px; height: 64px; opacity: .5; }
[data-theme="dark"] .cat-card-ph { background: radial-gradient(circle at 50% 42%, #1e3342, var(--brand-soft) 80%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cat-card-ph { background: radial-gradient(circle at 50% 42%, #1e3342, var(--brand-soft) 80%); }
}

.cat-badge {
  position: absolute; top: .6rem; inset-inline-start: .6rem; z-index: 2;
  font-size: .72rem; font-weight: 800; padding: .2rem .6rem; border-radius: 999px;
}
.cat-badge-new { background: var(--cat-teal); color: #fff; }
.cat-badge-in { background: var(--cat-ok); color: #fff; }
.cat-badge-oos { background: #eef1f5; color: #5b7186; border: 1px solid var(--border); }
[data-theme="dark"] .cat-badge-oos { background: #243447; color: #9fb2c6; border-color: #2c3e55; }

/* actions live in the body top row — never overlaid on the product image */
.cat-card-top { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.cat-card-acts { display: flex; gap: .3rem; flex-shrink: 0; }
.cat-ico {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s ease, color .12s ease, border-color .12s ease;
}
.cat-ico svg { width: 16px; height: 16px; }
.cat-ico:hover { transform: scale(1.08); border-color: var(--cat-teal); color: var(--cat-teal); }
.cat-ico.act-fav.on { color: #e0245e; border-color: #e0245e; }
.cat-ico.act-fav.on svg { fill: currentColor; }
.cat-ico.act-cmp.on { color: var(--cat-teal); border-color: var(--cat-teal); background: var(--cat-teal-soft); }
/* «در مقایسه» card ring — site.css only styled .frame-card.cmp-on so the
   mark was invisible on catalog cards; subtle outline, never covers badges. */
.cat-card.cmp-on { outline: 2px solid var(--cat-teal); outline-offset: 1px; }

.cat-card-body { padding: .5rem .8rem .7rem; display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.cat-brand { margin: 0; font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: var(--cat-teal); text-transform: uppercase; min-height: 1.1em; }
.cat-brand-la { font-size: .85em; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
/* model code is the readable headline — latin code → ltr, clamped so every
   card in a row reserves the same two lines and keeps price/CTA aligned */
.cat-name { margin: 0; font-size: .92rem; font-weight: 700; line-height: 1.35; min-height: 2.7em; }
.cat-name a {
  color: var(--ink); text-decoration: none; unicode-bidi: plaintext;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-name a:hover { color: var(--cat-teal); }
.cat-spec {
  margin: .1rem 0 0; font-size: .78rem; color: var(--muted); min-height: 1.25em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-swatches { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.cat-sw {
  font: inherit; font-size: .72rem; padding: .15rem .55rem; min-height: 28px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--ink-soft); cursor: pointer;
}
.cat-sw.on, .cat-sw:hover { border-color: var(--cat-teal); color: var(--cat-teal); }
/* «+N رنگ» — sibling-colorway cue; a link, not a swatch button */
.cat-sw-more { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; font-weight: 700; border-style: dashed; }
.cat-sw-more:hover { text-decoration: none; }
/* OOS card with an in-stock sibling — the chip itself says so */
.cat-sw-more.has-avail { border-color: var(--cat-ok); border-style: solid; color: var(--cat-ok); }
.cat-sw-avdot { width: 7px; height: 7px; border-radius: 50%; background: var(--cat-ok); display: inline-block; }
.cat-price { margin: auto 0 0; padding-top: .35rem; font-weight: 800; font-size: 1.02rem; color: var(--brand-ink); }
.cat-price small { font-size: .72rem; font-weight: 400; color: var(--muted); }
.cat-price-inq { color: var(--muted); font-size: .85rem; font-weight: 700; }
.cat-cta { margin-top: .4rem; text-align: center; }

/* skeleton loading */
.cat-skel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.cat-skel .m { background: linear-gradient(100deg, var(--border) 30%, var(--brand-soft) 50%, var(--border) 70%); background-size: 200% 100%; animation: cat-shine 1.2s linear infinite; }
.cat-skel .i { aspect-ratio: 1/1; }
.cat-skel .t { height: .9rem; margin: .8rem .85rem .4rem; border-radius: 6px; }
.cat-skel .s { height: .7rem; margin: 0 .85rem .9rem; width: 55%; border-radius: 6px; }
@keyframes cat-shine { to { background-position: -200% 0; } }

/* «نمایش بیشتر» */
.cat-more { display: flex; justify-content: center; padding: 1.2rem 0 .2rem; }
.cat-more .btn { min-width: 220px; }

/* ---------- mobile filter sheet ---------- */
.cat-sheet {
  position: fixed; inset: auto 0 0 0; z-index: 60; max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 44px rgba(16,42,53,.25);
}
.cat-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.cat-sheet-head h3 { margin: 0; font-size: 1rem; }
.cat-sheet-body { overflow: auto; padding: .4rem 1rem 1rem; flex: 1; }
.cat-sheet-foot { display: flex; gap: .6rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.cat-sheet-foot .btn { flex: 1; }
.cat-sheet-foot .cat-sheet-count { flex: 2; }
.cat-sheet .cat-fgroup { border-top: 0; }

/* ---------- recently viewed + guide + post-grid sections ---------- */
.cat-after { max-width: var(--cat-maxw); margin: 0 auto; padding: 0 1rem; }
.cat-after .cat-grid { padding-top: .4rem; }
.cat-after-head { display: flex; align-items: baseline; justify-content: space-between; padding: 1.6rem 0 .4rem; }
.cat-after-head h2 { margin: 0; font-size: 1.15rem; }
.cat-after-head button { font: inherit; font-size: .8rem; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; }

.cat-sim-why { margin: .3rem 0 0; font-size: .72rem; color: var(--muted); }

.cat-guide {
  max-width: var(--cat-maxw); margin: 1.8rem auto 0; padding: 0 1rem;
}
.cat-guide-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.1rem 1.2rem 1.3rem;
}
.cat-guide-box h2 { margin: 0 0 .2rem; font-size: 1.1rem; }
.cat-guide-box > p { margin: 0 0 .9rem; color: var(--muted); font-size: .88rem; }
.cat-gsteps { display: grid; gap: .8rem; }
@media (min-width: 720px) { .cat-gsteps { grid-template-columns: repeat(3, 1fr); } }
.cat-gstep h3 { margin: 0 0 .45rem; font-size: .86rem; color: var(--brand-ink); }
.cat-gopts { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat-gopt {
  font: inherit; font-size: .8rem; padding: .35rem .8rem; min-height: 36px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  color: var(--ink-soft); cursor: pointer;
}
.cat-gopt.on { background: var(--cat-teal); border-color: var(--cat-teal); color: #fff; }
.cat-gresult { margin-top: .9rem; display: none; align-items: center; gap: .8rem; flex-wrap: wrap; }
.cat-gresult.show { display: flex; }
.cat-gresult p { margin: 0; font-size: .85rem; color: var(--ink-soft); }

/* ---------- compare bar + panel ---------- */
.compare-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(16,42,53,.12);
}
body.has-quick-bar .compare-bar { bottom: 58px; }
.compare-bar span { font-size: .86rem; font-weight: 700; }
.compare-panel {
  max-width: var(--cat-maxw); margin: 1.2rem auto; padding: 0 1rem;
}
.compare-panel .cmp-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.cmp-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.cmp-head h2 { margin: 0; font-size: 1.05rem; }
.cmp-scroll { overflow-x: auto; }
.cmp-table { display: table; width: 100%; min-width: 560px; border-collapse: collapse; }
.cmp-row { display: table-row; }
.cmp-cell { display: table-cell; padding: .55rem .8rem; border-bottom: 1px solid var(--border); font-size: .85rem; vertical-align: middle; }
.cmp-row:last-child .cmp-cell { border-bottom: 0; }
.cmp-label { font-weight: 700; color: var(--muted); width: 110px; background: var(--bg); }
.cmp-cell img { width: 72px; height: 72px; object-fit: contain; }
.cmp-cell .cmp-name a { color: var(--ink); font-weight: 700; text-decoration: none; }

/* ---------- detail page ---------- */
.cat-detail { max-width: var(--cat-maxw); margin: 0 auto; padding: 0 1rem 2rem; }
.fdd-grid { display: grid; gap: 1.4rem; }
@media (min-width: 900px) { .fdd-grid { grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); align-items: start; } }
.fdd-gallery .fd-main { aspect-ratio: 1/1; background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.fdd-gallery .fd-main img { width: 100%; height: 100%; object-fit: contain; }
.fdd-info h2 { margin: 0 0 .15rem; font-size: 1.35rem; line-height: 1.4; }
.fdd-brandline { font-size: .85rem; color: var(--cat-teal); font-weight: 800; letter-spacing: .03em; text-transform: uppercase; margin: 0 0 .3rem; }
.fdd-sku { font-size: .78rem; color: var(--muted); margin: 0 0 .8rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.fdd-sku code { direction: ltr; unicode-bidi: embed; background: var(--bg); padding: .1rem .45rem; border-radius: 6px; border: 1px solid var(--border); }
.fdd-price { margin: .6rem 0; font-size: 1.3rem; font-weight: 800; color: var(--brand-ink); }
.fdd-price small { font-weight: 400; font-size: .8rem; }
.fdd-stock { font-size: .85rem; color: var(--muted); margin: .2rem 0 .8rem; }
.fdd-stock .ok { color: var(--cat-ok); font-weight: 700; }
.fdd-stock .oos { color: var(--cat-err); font-weight: 700; }
.fdd-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .8rem 0 1rem; }
.fdd-actions .btn { min-height: 46px; }

/* sticky mobile action bar on detail */
.cat-mbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 54;
  display: none; align-items: center; gap: .7rem;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: .55rem .9rem calc(.55rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(16,42,53,.12);
}
/* 72px = measured quick-bar height (content ~60px + padding); without the
   safe-area term the bar slides under it on notched phones. */
body.has-quick-bar .cat-mbar { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
.cat-mbar .cat-price { margin: 0; padding: 0; font-size: 1rem; }
.cat-mbar .btn { flex: 1; }
body.cat-has-mbar main { padding-bottom: 74px; }
/* the same always-reachable CTA above phone width — a centered pair, not
   the full-bleed mobile strip, so long spec/related sections keep an
   inquiry one click away on every viewport. */
@media (min-width: 561px) {
  .cat-mbar { display: flex; justify-content: center; gap: 1.2rem; padding: .6rem 1.5rem; }
  .cat-mbar .btn { flex: 0 0 auto; min-width: 240px; }
}

/* scroll lock while a modal/sheet is open */
body.no-scroll { overflow: hidden; }

/* fav button state outside the round .cat-ico (detail page inline button) */
.act-fav.on { color: #e0245e; border-color: #e0245e; }
.act-fav.on svg { fill: currentColor; }
.fd-cmp.on { color: var(--cat-teal); border-color: var(--cat-teal); }
.cat-ico-inline { display: inline-flex; align-items: center; gap: .45rem; }

/* detail extras — share row, size diagram, face hint */
.fd-sel-link { margin: -.2rem 0 .7rem; font-size: .82rem; }
.fd-sel-link a { color: var(--cat-teal); text-decoration: none; font-weight: 600; }
.fd-sel-link a:hover { text-decoration: underline; }
.fd-share { display: flex; gap: .45rem; margin: 0 0 .9rem; }
.fd-share-btn {
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .12s ease, color .12s ease, transform .12s ease;
}
.fd-share-btn svg { width: 19px; height: 19px; }
.fd-share-btn:hover { border-color: var(--cat-teal); color: var(--cat-teal); transform: translateY(-1px); }
.fd-share-btn.done { border-color: var(--cat-ok); color: var(--cat-ok); }

/* «همین مدل — رنگ‌های دیگر» — sibling colorway chips on the detail page */
.fd-var-t { font-size: .8rem; font-weight: 700; color: var(--muted); margin: .1rem 0 .35rem; }
.fd-var-row { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .5rem; }
.fd-var {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 40px;
  padding: .25rem .55rem .25rem .35rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--ink);
  text-decoration: none; font-size: .78rem; font-weight: 700;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fd-var:hover, .fd-var:focus-visible { border-color: var(--cat-teal); box-shadow: 0 3px 10px rgba(10,22,40,.07); outline: none; }
.fd-var img { width: 32px; height: 32px; border-radius: 7px; object-fit: cover; background: #fff; }
.fd-var-st { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fd-var-st.in { background: var(--cat-ok); }
.fd-var-st.out { background: var(--cat-err); }
.fd-var-st.inq { background: var(--border); }
.fd-size-svg svg { width: 100%; max-width: 300px; height: auto; display: block; margin: .3rem 0 .7rem; }
.fd-svg-num { font-weight: 700; font-size: 11px; font-family: inherit; fill: var(--ink-soft); }
.fd-face { border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .4rem; }
.fd-face h3 { margin: 0 0 .3rem; font-size: .92rem; }
.fd-face h3 small { font-weight: 400; color: var(--muted); font-size: .72rem; }
.fd-face p { margin: 0; font-size: .85rem; color: var(--ink-soft); }

/* inquiry modal extras */
.cat-inq .cat-inq-sub { margin: -.3rem 0 .8rem; font-size: .82rem; color: var(--muted); }
.cat-inq-types { border: 0; margin: 0 0 .6rem; padding: 0; }
.cat-inq-types legend { font-size: .82rem; color: var(--ink-soft); font-weight: 700; padding: 0 0 .4rem; }
.cat-inq-type { display: inline-flex; margin: 0 0 .35rem .35rem; }
.cat-inq-type input { position: absolute; opacity: 0; }
.cat-inq-type span {
  font-size: .82rem; padding: .4rem .85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); color: var(--ink-soft); min-height: 38px;
  display: inline-flex; align-items: center;
}
.cat-inq-type input:checked + span { background: var(--cat-teal); border-color: var(--cat-teal); color: #fff; }
.cat-inq-type input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.cat-inq-msg { min-height: 1.2rem; font-size: .85rem; color: var(--cat-err); margin: .3rem 0; }

/* search suggestions */
.cat-suggest {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 340px; overflow-y: auto;
}
.cat-suggest a {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem;
  text-decoration: none; color: var(--ink); font-size: .88rem;
}
.cat-suggest a:hover, .cat-suggest a:focus-visible { background: var(--brand-soft); }
.cat-suggest img { width: 44px; height: 44px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; flex-shrink: 0; }
.cat-suggest .ph { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; color: var(--brand); flex-shrink: 0; }
.cat-suggest .ph svg { width: 26px; height: 26px; opacity: .6; }
.cat-suggest small { color: var(--muted); display: block; font-size: .74rem; }
/* three-state stock dot on suggestions — green/red/grey matches detail chips */
.sug-st { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-inline-start: auto; }
.sug-st-available { background: var(--cat-ok); }
.sug-st-unavailable { background: var(--cat-err); }
.sug-st-inquiry { background: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .cat-layout { grid-template-columns: 1fr; }
  .cat-side { display: none; }
  .cat-mbtns { display: flex; }
  .cat-toolbar { top: 56px; flex-wrap: wrap; }
  .cat-sort { display: none; }          /* moved into the sheet */
  .cat-sheet .cat-sort { display: block; margin-bottom: .6rem; }
  .cat-sheet .cat-sort select { width: 100%; }
}
@media (max-width: 560px) {
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .cat-card-body { padding: .55rem .65rem .7rem; }
  .cat-name { font-size: .85rem; }
  .cat-spec { display: none; }          /* keep the small card tight */
  .cat-count { display: none; }
  .cat-mbar { display: flex; }
}
@media (max-width: 340px) {
  .cat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .cat-card, .cat-ico, .zoom-veil img { transition: none !important; }
  .cat-skel .m { animation: none; }
}

/* ---------- selections room («انتخاب‌های من») ---------- */
.cat-fsearch {
  width: 100%; font: inherit; font-size: .82rem; padding: .35rem .6rem;
  margin: 0 0 .35rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface,#fff); color: inherit;
}
.cat-fopt.zero .lbl, .cat-fopt.zero .n { opacity: .45; }
.cat-fnone { font-size: .82rem; color: var(--muted); margin: .2rem 0 .4rem; }

.cat-toast {
  position: fixed; bottom: calc(1rem + env(safe-area-inset-bottom)); inset-inline-start: 50%;
  transform: translate(50%, 1rem); z-index: 70;
  display: flex; align-items: center; gap: .8rem;
  background: var(--cat-navy); color: #fff; font-size: .88rem;
  padding: .65rem 1rem; border-radius: 12px; box-shadow: 0 8px 28px rgba(16,46,96,.28);
  opacity: 0; transition: opacity .18s ease, transform .18s ease;
  max-width: min(92vw, 30rem);
}
.cat-toast.on { opacity: 1; transform: translate(50%, 0); }
.cat-toast-act {
  font: inherit; font-weight: 700; color: #8fd8e8; background: none; border: 0;
  cursor: pointer; padding: .15rem .35rem; white-space: nowrap;
}
.cat-toast-act:hover { color: #c4ecf5; text-decoration: underline; }

.cat-selbar {
  position: fixed; bottom: calc(.8rem + env(safe-area-inset-bottom));
  inset-inline-start: 50%; transform: translate(50%, 0); z-index: 55;
  display: flex; align-items: stretch; gap: .4rem;
  background: var(--cat-navy); color: #fff; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(16,46,96,.32); padding: .35rem .45rem .35rem .35rem;
  max-width: min(94vw, 30rem);
}
.cat-selbar-main {
  font: inherit; font-size: .86rem; color: #fff; background: none; border: 0;
  cursor: pointer; padding: .55rem .8rem; white-space: nowrap; border-radius: 10px;
}
.cat-selbar-main b { color: #8fd8e8; font-weight: 800; }
.cat-selbar-main:hover { background: rgba(255,255,255,.1); }
.cat-selbar-min {
  font: inherit; font-size: 1.1rem; line-height: 1; width: 2.2rem; flex-shrink: 0;
  color: rgba(255,255,255,.75); background: rgba(255,255,255,.08); border: 0;
  border-radius: 10px; cursor: pointer;
}
.cat-selbar-min:hover { background: rgba(255,255,255,.18); color: #fff; }
.cat-selfab {
  position: fixed; bottom: calc(.9rem + env(safe-area-inset-bottom));
  inset-inline-end: .9rem; z-index: 55;
  font: inherit; font-weight: 700; font-size: .85rem;
  background: var(--cat-navy); color: #fff; border: 0; border-radius: 999px;
  padding: .7rem 1rem; cursor: pointer; box-shadow: 0 8px 24px rgba(16,46,96,.32);
}
/* back-to-top — stacked above the selfab corner zone; clears the mobile
   action bar on frame pages (selFab lives on the catalog page only). */
.cat-topfab {
  position: fixed; bottom: calc(4.6rem + env(safe-area-inset-bottom));
  inset-inline-end: .9rem; z-index: 55;
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: var(--cat-navy);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(16,46,96,.18); backdrop-filter: blur(6px);
}
@media (min-width: 901px) { .cat-topfab { bottom: 1.2rem; } }

.cat-sel-hint {
  margin: 0; padding: .7rem 1rem .3rem; font-size: .8rem; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.cat-sel-item {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.cat-sel-thumb {
  width: 64px; height: 64px; flex-shrink: 0; border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: #fff; display: block;
}
.cat-sel-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cat-sel-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.cat-sel-name { font-weight: 700; font-size: .9rem; text-align: right; color: inherit; }
.cat-sel-meta { font-size: .78rem; color: var(--muted); }
.cat-sel-meta .sug-st { display: inline-block; margin-inline-start: 0; margin-inline-end: .35rem; vertical-align: middle; }
.cat-sel-changed {
  font-size: .74rem; font-weight: 700; color: #9a6700;
  background: #fff8e6; border: 1px solid #f0dcae; border-radius: 7px;
  padding: .15rem .5rem; align-self: flex-start;
}
.cat-sel-field { font-size: .8rem; color: var(--ink-soft); display: flex; align-items: center; gap: .45rem; }
.cat-sel-field select, .cat-sel-field input {
  font: inherit; font-size: .82rem; padding: .3rem .55rem; max-width: 12rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface,#fff); color: inherit;
}
.cat-sel-acts { display: flex; flex-direction: column; gap: .3rem; }
.cat-sel-acts .cat-ico { width: 30px; height: 30px; font-size: .95rem; }
.cat-sel-del { color: var(--cat-err); }
.cat-inq-items {
  list-style: none; margin: 0 0 .8rem; padding: .6rem .7rem; max-height: 9rem; overflow: auto;
  background: var(--cat-teal-soft); border-radius: 10px; font-size: .82rem;
}
.cat-inq-items li { padding: .12rem 0; }
.cat-inq-items .n { font-weight: 700; color: var(--cat-teal); }
.cat-inq-ic { color: var(--muted); }
.cat-inq-oos { color: var(--cat-err); font-weight: 600; font-size: .82em; }
.cat-inq-in { color: var(--muted); font-style: italic; }

@media (min-width: 861px) {
  .cat-selbar { inset-inline-start: auto; inset-inline-end: 1.4rem; transform: none; }
}
@media (max-width: 860px) {
  .cat-sel-sheet .cat-sel-acts { flex-direction: row; }
}
@media (prefers-reduced-motion: reduce) {
  .cat-toast { transition: none; }
}

/* ---------- decision-help + optometry blocks (detail + catalog) ---------- */
.fd-decide, .fd-optic {
  margin-top: .9rem; padding: .85rem 1rem; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface,#fff);
}
.fd-decide h3, .fd-optic h3 { margin: 0 0 .4rem; font-size: .92rem; }
.fd-decide ul { margin: 0; padding-inline-start: 1.1rem; font-size: .85rem; color: var(--ink-soft); }
.fd-decide li { margin: .2rem 0; }
.fd-optic { background: var(--cat-teal-soft); border-color: transparent; }
.fd-optic p { margin: 0 0 .55rem; font-size: .85rem; color: var(--ink-soft); }

/* «مناسب چه کسی؟» — usage-context cards (kind/material-driven, honest). */
.fd-fit { border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .4rem; }
.fd-fit h3 { margin: 0 0 .55rem; font-size: .92rem; }
.fd-fit h3 small { font-weight: 400; color: var(--muted); font-size: .72rem; }
.fd-fit-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .55rem; }
.fd-fit-card {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface, #fff);
}
.fd-fit-card svg { color: var(--brand, #087eaa); margin-bottom: .15rem; }
.fd-fit-card b { font-size: .84rem; }
.fd-fit-card span { font-size: .76rem; color: var(--muted); line-height: 1.55; }

/* lens upsell strip — Lunato-style «عدسی هم لازم دارید؟» cross-sell */
.fd-upsell {
  display: flex; gap: .8rem; align-items: flex-start;
  margin-top: .9rem; padding: .9rem 1rem; border-radius: 12px;
  background: linear-gradient(135deg, var(--cat-teal-soft, #e6f7f5), var(--brand-soft, #eaf5fa));
  border: 1px solid rgba(8, 126, 170, .12);
}
.fd-upsell-ic { color: var(--brand, #087eaa); flex: none; margin-top: .1rem; }
.fd-upsell h3 { margin: 0 0 .3rem; font-size: .95rem; }
.fd-upsell p { margin: 0 0 .55rem; font-size: .85rem; color: var(--ink-soft); }
.fd-upsell .btn { white-space: nowrap; }
.cat-optic {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 1280px; margin: .6rem auto 0; padding: .8rem 1.1rem;
  background: var(--cat-teal-soft); border-radius: 14px;
}
.cat-optic h2 { margin: 0 0 .15rem; font-size: .95rem; }
.cat-optic p { margin: 0; font-size: .82rem; color: var(--ink-soft); }
.cat-optic .btn { flex-shrink: 0; }
@media (max-width: 560px) {
  .cat-optic { flex-direction: column; align-items: stretch; text-align: center; }
  .cat-optic .btn { align-self: center; }
}
[data-theme="dark"] .cat-qv-sw .cat-sw,[data-theme="dark"] .cat-qv-x{background:#22323e;color:#cfe0ea}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .cat-qv-media{background:#1a2833}:root:not([data-theme="light"]) .cat-qv-sw .cat-sw,:root:not([data-theme="light"]) .cat-qv-x{background:#22323e;color:#cfe0ea}}

/* ==== cat-img-dots — mini-gallery position indicators (catalog.js) ====
   Rendered inside .cat-card-media for products with >1 photo. Always
   visible (honest «more photos» affordance), pointer-events:none so the
   image link/swipe stays primary. */
.cat-img-dots { position: absolute; inset-inline: 0; bottom: .55rem; display: flex; justify-content: center; gap: .3rem; pointer-events: none; z-index: 2; }
.cat-img-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(16,42,67,.30); transition: background .15s ease, transform .15s ease; }
.cat-img-dots i.on { background: var(--brand); transform: scale(1.3); }
[data-theme="dark"] .cat-img-dots i { background: rgba(255,255,255,.35); }
[data-theme="dark"] .cat-img-dots i.on { background: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cat-img-dots i { background: rgba(255,255,255,.35); }
  :root:not([data-theme="light"]) .cat-img-dots i.on { background: var(--accent); }
}


/* ============================================================
   Catalog V2 — flag-gated redesign (body.dg-v2). Everything here
   is scoped under .dg-v2; when the flag is off nothing applies.
   ============================================================ */

/* layout: 1560 container, 240 sidebar, >=280px cards */
.dg-v2 .cat-shell { max-width: 1560px; padding-inline: 1.5rem; }
.dg-v2 .cat-layout { grid-template-columns: 240px minmax(0,1fr); gap: 1.5rem; }
.dg-v2 .cat-side { top: 120px; }
.dg-v2 .cat-grid { grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1.1rem; }
.dg-v2 .cat-grid.dgv-large { grid-template-columns: repeat(auto-fill, minmax(350px,1fr)); }
.dg-v2 .cat-grid.dgv-compact { grid-template-columns: repeat(auto-fill, minmax(205px,1fr)); gap: .8rem; }
@media (min-width:1280px) {
  .dg-v2 .cat-grid.dgv-compact { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
/* default mode stays at «سه ستون بزرگ» — 4-up exists only as the compact option */
@media (min-width:1450px) {
  .dg-v2 .cat-grid:not(.dgv-compact):not(.dgv-large) { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (min-width:1024px) and (max-width:1279px) {
  .dg-v2 .cat-grid.dgv-compact { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width:1023px) {
  .dg-v2 .cat-layout { grid-template-columns: 1fr; }
  .dg-v2 .cat-grid, .dg-v2 .cat-grid.dgv-compact { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width:767px) {
  .dg-v2 .cat-shell { padding-inline: .8rem; }
  .dg-v2 .cat-grid, .dg-v2 .cat-grid.dgv-compact { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; }
  .dg-v2 .cat-grid.dgv-large { grid-template-columns: 1fr; }
}
@media (max-width:359px) {
  .dg-v2 .cat-grid, .dg-v2 .cat-grid.dgv-compact, .dg-v2 .cat-grid.dgv-large { grid-template-columns: 1fr; }
}

/* view-size control */
.dgv-view { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; margin-inline-start: auto; }
.dgv-vbtn { border: 0; background: transparent; padding: .32rem .7rem; border-radius: 7px; font: inherit; font-size: .78rem; color: var(--muted); cursor: pointer; }
.dgv-vbtn.on { background: var(--brand); color: #fff; }
@media (max-width:767px){ .dgv-view .dgv-vbtn[data-m="dgv-compact"]{display:none} }

/* card v2 */
.dg-v2 .cat-card-body { display: flex; flex-direction: column; }
.dg-v2 .dgv-fav {
  position: absolute; top: .55rem; inset-inline-end: .55rem; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: 1px solid var(--border);
  display: grid; place-items: center; color: #8296ac; cursor: pointer;
  box-shadow: 0 2px 8px rgba(16,42,67,.08); transition: color .16s, transform .16s;
}
.dg-v2 .dgv-fav svg { width: 17px; height: 17px; }
.dg-v2 .dgv-fav.on { color: #d6336c; }
.dg-v2 .dgv-fav:hover { transform: scale(1.08); }
.dg-v2 .dgv-desc { margin: .05rem 0 .1rem; font-size: .8rem; color: var(--muted); }
.dg-v2 .cat-name { font-size: .98rem; line-height: 1.6; }
.dg-v2 .cat-name a { color: var(--ink); }
.dg-v2 .cat-name .dgv-code { font-weight: 700; }
.dg-v2 .dgv-acts { display: flex; gap: .5rem; margin-top: .65rem; }
.dg-v2 .dgv-acts .cat-cta { flex: 1; text-align: center; }
.dg-v2 .dgv-qvbtn { flex: none; white-space: nowrap; }
.dg-v2 .dgv-cmpline {
  margin-top: .45rem; background: none; border: 0; padding: .15rem 0;
  font: inherit; font-size: .76rem; color: var(--muted); cursor: pointer; text-align: start;
}
.dg-v2 .dgv-cmpline:hover { color: var(--brand); }
.dg-v2 .dgv-cmpline[aria-pressed="true"] { color: var(--cat-teal); font-weight: 700; }

/* quick view v2 */
.dgv-qv {
  position: relative; flex: none;
  width: min(1120px, calc(100vw - 48px)); max-width: none;
  max-height: calc(100dvh - 48px); overflow: hidden;
  border-radius: 20px; padding: 0; display: flex; flex-direction: column;
}
.dgv-qv-in { display: grid; grid-template-columns: 58% 42%; min-height: 0; flex: 1; }
.dgv-qv-media { background: #f2f6fa; display: flex; flex-direction: column; min-height: 0; }
.dgv-qv-main { position: relative; flex: 1; min-height: 320px; display: grid; place-items: center; padding: 1.2rem; }
.dgv-qv-img { max-width: 100%; max-height: 52vh; object-fit: contain; }
.dgv-qv-ph { width: 100%; height: 100%; }
.dgv-qv-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: rgba(255,255,255,.95); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(16,42,67,.14);
}
.dgv-qv-arrow svg { width: 20px; height: 20px; }
.dgv-qv-arrow.dgv-prev { inset-inline-start: .8rem; }
.dgv-qv-arrow.dgv-next { inset-inline-end: .8rem; }
.dgv-qv-count {
  position: absolute; bottom: .8rem; inset-inline-end: .9rem;
  background: rgba(16,42,67,.72); color: #fff; font-size: .74rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 999px;
}
.dgv-qv-zoom {
  position: absolute; bottom: .8rem; inset-inline-start: .9rem;
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.95); border: 1px solid var(--border);
  border-radius: 999px; padding: .34rem .8rem; font: inherit; font-size: .76rem;
  font-weight: 700; color: var(--ink); cursor: pointer; box-shadow: 0 4px 14px rgba(16,42,67,.12);
}
.dgv-qv-zoom svg { width: 15px; height: 15px; }
.dgv-qv-thumbs { display: flex; gap: .5rem; padding: .7rem .9rem; overflow-x: auto; background: #fff; border-top: 1px solid var(--border); }
.dgv-qv-th { width: 62px; height: 62px; flex: none; border-radius: 10px; border: 2px solid transparent; background: #f6f9fc; padding: 4px; cursor: pointer; }
.dgv-qv-th img { width: 100%; height: 100%; object-fit: contain; }
.dgv-qv-th.on { border-color: var(--brand); }
.dgv-qv-info { padding: 1.5rem 1.4rem 1.3rem; overflow-y: auto; min-height: 0; }
.dgv-qv-brand { font-size: .85rem; font-weight: 800; color: var(--brand); text-decoration: none; }
.dgv-qv-brand:hover { text-decoration: underline; }
.dgv-qv-title { margin: .35rem 0 .2rem; font-size: 1.28rem; line-height: 1.55; }
.dgv-qv-title .dgv-code { font-weight: 800; }
.dgv-copycode {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: .1rem;
  background: var(--surface2,#f4f7fa); border: 1px dashed var(--border);
  border-radius: 8px; padding: .3rem .6rem; font: inherit; font-size: .78rem;
  color: var(--muted); cursor: pointer;
}
.dgv-copycode bdi { color: var(--ink); font-weight: 700; }
.dgv-copycode:hover { border-color: var(--brand); color: var(--brand); }
.dgv-size { margin: .35rem 0 .5rem; font-size: .86rem; color: var(--ink-soft); font-weight: 600; }
.dgv-sw { margin: .3rem 0 .2rem; }
.dgv-qv-cta { display: flex; gap: .6rem; margin-top: .9rem; }
.dgv-qv-cta .btn-primary { flex: 1; }
.dgv-qv-sub { display: flex; gap: .4rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
.dgv-qv-x {
  position: absolute; top: .7rem; inset-inline-start: .7rem; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; color: var(--ink); font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(16,42,67,.15); line-height: 1;
}
.dgv-qv-mbar { display: none; }
.dg-v2 .modal-veil { background: rgba(10,25,42,.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* zoom layer */
.dgv-zooml {
  position: fixed; inset: 0; z-index: 1200; background: rgba(8,18,32,.88);
  display: flex; align-items: center; justify-content: center;
}
.dgv-zooml .dgv-zwrap { max-width: 92vw; max-height: 82vh; overflow: visible; }
.dgv-zooml img { max-width: 92vw; max-height: 82vh; object-fit: contain; transition: transform .12s ease; cursor: zoom-in; user-select: none; }
.dgv-zooml .dgv-zwrap.on img { cursor: grab; }
.dgv-zx {
  position: fixed; top: 14px; inset-inline-start: 14px; z-index: 1202;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.14); color: #fff; font-size: 1.5rem; cursor: pointer;
}
.dgv-zx:hover { background: rgba(255,255,255,.26); }
.dgv-zhint { position: fixed; bottom: 16px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.75); font-size: .8rem; pointer-events: none; }

/* mobile fullscreen sheet */
@media (max-width: 860px) {
  .dgv-qv {
    width: 100vw; max-height: none; height: 100dvh; border-radius: 0;
  }
  .dgv-qv-in { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .dgv-qv-media { position: sticky; top: 0; z-index: 2; }
  .dgv-qv-main { min-height: 0; padding: .8rem; }
  .dgv-qv-img { max-height: 38vh; }
  .dgv-qv-thumbs { padding: .5rem .7rem; }
  .dgv-qv-th { width: 52px; height: 52px; }
  .dgv-qv-info { overflow: visible; padding: 1rem 1rem 6rem; }
  .dgv-qv-cta { display: none; }
  .dgv-qv-mbar {
    display: flex; align-items: center; gap: .7rem;
    position: sticky; bottom: 0; z-index: 4;
    background: #fff; border-top: 1px solid var(--border);
    padding: .6rem .9rem calc(.6rem + env(safe-area-inset-bottom));
  }
  .dgv-qv-mprice { flex: 1; font-size: .9rem; font-weight: 700; color: var(--ink); }
  .dgv-qv-mprice .dgv-mq { color: var(--muted); font-weight: 600; }
  .dgv-qv-mbar .btn-primary { flex: none; min-width: 130px; }
  .dgv-qv-x { top: .5rem; inset-inline-start: .5rem; width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .dg-v2 .cat-card, .dg-v2 .dgv-fav, .dgv-zooml img { transition: none !important; }
}
