/* VITRINA KO'RINISHI (KAM-939) — chizma: docs/design/telegram-vitrina-2026-11-21/chizma.html.
   Uch shablon — BITTA belgilash ustidagi uch uslub: `.tpl-grid` (Katakcha),
   `.tpl-list` (Ro'yxat), `.tpl-show` (Peshtaxta). Do'kon rangi — `--shop`
   (do'kon egasi ERP da tanlaydi; skript `:root` ga qo'yadi). */
:root {
  --shop: #3a6b9f;
  --v-bg: #ffffff;
  --v-text: #1e2430;
  --v-muted: #667085;
  --v-line: #edf0f4;
  --v-soft: #f2f4f7;
  --v-dash: #c9d0da;
  --v-ok: #2e7d4f;
  --v-low: #7a5210;
  --v-on-shop: #ffffff;
  --v-tile: color-mix(in srgb, var(--shop) 11%, #ffffff);
  --v-tile-ink: color-mix(in srgb, var(--shop) 60%, #667085);
  color-scheme: light;
}
:root[data-dark] {
  --v-bg: #171b21;
  --v-text: #e6e9ee;
  --v-muted: #a3adba;
  --v-line: #2a313a;
  --v-soft: #222831;
  --v-dash: #4a5462;
  --v-ok: #6cc392;
  --v-low: #e0b565;
  --v-tile: color-mix(in srgb, var(--shop) 22%, #171b21);
  --v-tile-ink: color-mix(in srgb, var(--shop) 45%, #c9d0da);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--v-bg);
  color: var(--v-text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--shop); outline-offset: 2px; }

.v {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px max(14px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px))
    max(14px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
}

/* Sarlavha */
.v-head { display: flex; align-items: center; gap: 10px; }
.v-logo {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--shop); color: var(--v-on-shop); font-weight: 700; font-size: 17px;
}
.v-name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.v-sub { color: var(--v-muted); font-size: 12px; overflow-wrap: anywhere; }
.v-hero {
  margin: -14px calc(-1 * max(14px, env(safe-area-inset-right, 0px))) 0 calc(-1 * max(14px, env(safe-area-inset-left, 0px)));
  padding: 20px 16px 16px;
  background: var(--shop); color: var(--v-on-shop);
  display: flex; flex-direction: column; gap: 3px;
}
.v-hero .v-name { font-size: 22px; font-weight: 700; line-height: 1.2; }
.v-hero .v-sub { color: var(--v-on-shop); opacity: 0.88; }

.v-search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border-radius: 12px; background: var(--v-soft); color: var(--v-muted);
}
.v-search svg { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.v-search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--v-text);
}
.v-search input::placeholder { color: var(--v-muted); }

.v-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.v-cats::-webkit-scrollbar { display: none; }
.v-cat {
  flex: 0 0 auto; padding: 7px 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--v-soft); color: var(--v-muted); font-size: 13px; white-space: nowrap;
}
.v-cat[aria-pressed='true'] { background: var(--shop); color: var(--v-on-shop); }

/* Tovar qatori (uchala shablonda bir xil belgilash) */
.it { color: inherit; text-decoration: none; min-width: 0; }
.ph {
  display: grid; place-items: center; overflow: hidden; border-radius: 12px;
  background: var(--v-tile); color: var(--v-tile-ink);
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph svg { width: 40%; height: 40%; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; fill: none; }
.it-n { font-size: 13px; overflow-wrap: anywhere; }
.it-p { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.it-s { font-size: 12px; }
.s-ok { color: var(--v-ok); }
.s-low { color: var(--v-low); }
.s-no { color: var(--v-muted); }
.it.out .ph, .it.out .it-n, .it.out .it-p { opacity: 0.5; }

/* 1-shablon: Katakcha */
.tpl-grid .v-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.tpl-grid .it { display: flex; flex-direction: column; gap: 6px; }
.tpl-grid .ph { aspect-ratio: 1 / 1; }
.tpl-grid .it-b { display: flex; flex-direction: column; gap: 1px; }
@media (min-width: 520px) { .tpl-grid .v-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 2-shablon: Ro'yxat */
.tpl-list .v-items { display: flex; flex-direction: column; }
.tpl-list .it { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--v-line); }
.tpl-list .ph { width: 48px; height: 48px; border-radius: 10px; }
.tpl-list .it-b { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.tpl-list .it-n { grid-column: 1; }
.tpl-list .it-p { grid-column: 2; grid-row: 1 / span 2; }
.tpl-list .it-s { grid-column: 1; grid-row: 2; }

/* 3-shablon: Peshtaxta */
.tpl-show .v-items { display: flex; flex-direction: column; gap: 16px; }
.tpl-show .it { display: flex; flex-direction: column; gap: 8px; }
.tpl-show .ph { aspect-ratio: 16 / 9; border-radius: 16px; }
.tpl-show .ph svg { width: 22%; height: 55%; }
.tpl-show .it-b { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.tpl-show .it-n { grid-column: 1; font-size: 15px; font-weight: 600; }
.tpl-show .it-p { grid-column: 2; grid-row: 1 / span 2; font-size: 16px; }
.tpl-show .it-s { grid-column: 1; grid-row: 2; }

.v-more, .v-btn {
  display: grid; place-items: center; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 12px; cursor: pointer; font-weight: 600; text-decoration: none;
  background: var(--v-soft); color: var(--v-text);
}
.v-more { width: 100%; }
.v-btn-main { background: var(--shop); color: var(--v-on-shop); }
.v-note { color: var(--v-muted); text-align: center; padding: 28px 8px; }
.v-note b { display: block; color: var(--v-text); font-size: 16px; margin-bottom: 4px; }

/* Tovar kartasi */
.d-back { align-self: flex-start; border: 0; background: transparent; padding: 6px 0; color: var(--v-muted); cursor: pointer; }
.d-gal { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.d-gal::-webkit-scrollbar { display: none; }
.d-gal .ph { flex: 0 0 100%; aspect-ratio: 1 / 1; scroll-snap-align: center; border-radius: 16px; }
.d-n { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; margin: 0; }
.d-p { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.d-l { font-size: 12px; color: var(--v-muted); margin-top: 4px; }
.d-sz { display: flex; flex-wrap: wrap; gap: 8px; }
.d-v {
  padding: 8px 12px; border: 1px solid var(--v-dash); border-radius: 10px; cursor: pointer;
  background: transparent; font-size: 13px; text-align: left;
}
.d-v[aria-pressed='true'] { border-color: var(--shop); background: var(--v-tile); font-weight: 600; }
.d-v.off { color: var(--v-muted); text-decoration: line-through; border-style: dashed; }
.d-t { color: var(--v-muted); white-space: pre-line; overflow-wrap: anywhere; margin: 0; }
.d-act { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: auto; padding-top: 8px; }
.d-act > :only-child { grid-column: 1 / -1; }

@media (prefers-reduced-motion: no-preference) {
  .d-gal { scroll-behavior: smooth; }
}
