/* ─────────── Design tokens ─────────── */
:root {
  --accent: #2f6fed;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --ink: #1c1b19;
  --ink-2: #57544e;
  --ink-3: #8b8781;
  --line: #e3e0d9;
  --line-strong: #d2cec5;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(28, 27, 25, .06);
  --shadow: 0 6px 24px -12px rgba(28, 27, 25, .22);
  --shadow-lg: 0 22px 48px -22px rgba(28, 27, 25, .32);
  --tab-h: 62px;
  --top-h: 56px;
  --max: 720px;
  --ease: cubic-bezier(.32, .72, .24, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #131312;
  --surface: #1c1c1a;
  --surface-2: #232322;
  --ink: #f3f1ec;
  --ink-2: #b3afa7;
  --ink-3: #817d76;
  --line: #2c2c29;
  --line-strong: #3a3a36;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 28px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 24px 52px -24px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Атрибут hidden должен побеждать display из классов ниже
   (.sheet, .toast, .tab-badge задают свой display). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ─────────── Shell ─────────── */
#app {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--top-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--line); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-size: 15px;
  overflow: hidden;
}
/* Когда логотип — картинка, тёмная подложка не нужна:
   она просвечивала фоном вокруг прозрачного PNG/SVG. */
.brand-mark.has-image {
  background: transparent;
  border-radius: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name { font-weight: 640; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tag { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: var(--ink-2);
  position: relative;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.ghost { width: 32px; height: 32px; }
.icon-btn svg { width: 20px; height: 20px; }

.badge-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--bg);
}

.view { flex: 1; padding: 4px 16px 28px; }

/* ─────────── Tabbar ─────────── */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 45;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: var(--max);
  margin: 0 auto;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  color: var(--ink-3);
  position: relative;
  transition: color .18s var(--ease);
}
.tab-ico { display: grid; place-items: center; }
.tab-ico svg { width: 21px; height: 21px; }
.tab.active { color: var(--ink); }
.tab.active .tab-ico svg { stroke-width: 2.1; }
.tab-badge {
  position: absolute; top: 7px; left: 50%; margin-left: 5px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 9.5px; font-weight: 700; font-style: normal;
  display: grid; place-items: center;
}

/* ─────────── Banners ─────────── */
/* ─────────── Banners ─────────── */
/* Баннер статичный: не закрывается, не затеняется, пропорция 3:1.
   Рекомендуемое изображение — 1200×400 px (2× для Retina: 2400×800). */
.banner-host { padding: 10px 16px 0; }
.banner-host:empty { display: none; }

.hscroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hscroll::-webkit-scrollbar { display: none; }

.banner {
  position: relative;
  display: block;
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 3 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: opacity .16s var(--ease);
}
a.banner:hover { opacity: .94; }
a.banner:active { opacity: .88; }

/* Никаких наложений: цвет фото остаётся ровно таким, каким его загрузили. */
.banner > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 1;
}

/* Текст кладётся поверх только если он есть в настройках баннера. */
.banner-body {
  position: absolute; inset: 0;
  padding: 14px 16px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 3px;
}
.banner.has-text .banner-body {
  background: linear-gradient(to top,
    color-mix(in srgb, #0c0c0b 62%, transparent) 0%,
    color-mix(in srgb, #0c0c0b 30%, transparent) 46%,
    transparent 100%);
}
.banner.has-text .banner-title,
.banner.has-text .banner-text { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.banner-title { font-weight: 640; font-size: 14.5px; letter-spacing: -.01em; }
.banner-text { font-size: 12.5px; opacity: .92; max-width: 40ch; line-height: 1.35; }

/* Если фото нет — баннер выглядит как текстовый блок. */
/* Картинка баннера обязана заполнить рамку. Без этого правила браузер
   рисует её в натуральную величину, а overflow: hidden обрезает —
   вместо баннера виден случайный кусок картинки. */
.banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner.no-image { aspect-ratio: auto; min-height: 92px; background: var(--surface); }
.banner.no-image .banner-body { position: relative; }

/* ─────────── Section headings ─────────── */
.page-head { padding: 18px 0 6px; }
.page-title { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.03em; font-weight: 660; }
.page-sub { margin: 6px 0 0; color: var(--ink-2); font-size: 13.5px; }

.row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 22px 0 10px;
}
.row-title { font-size: 13px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.row-link { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }

/* ─────────── Search ─────────── */
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 44px;
  margin: 14px 0 4px;
  transition: border-color .16s var(--ease);
}
.search:focus-within { border-color: var(--line-strong); }
.search svg { width: 17px; height: 17px; color: var(--ink-3); flex: 0 0 auto; }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 14.5px; min-width: 0; }
.search input::placeholder { color: var(--ink-3); }
.search-clear { color: var(--ink-3); font-size: 15px; padding: 4px; }

/* ─────────── Chips / filters ─────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all .16s var(--ease);
}
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .chip-count { opacity: .5; margin-left: 5px; font-size: 11.5px; }

/* ─────────── Section tiles ─────────── */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
  min-height: 108px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.tile:active { transform: scale(.985); }
/* Картинка раздела на всю плитку.
   Раньше стояло opacity: .42 — это делалось для декоративных SVG-заглушек,
   у которых и так светлый фон. Настоящее фото при 42% выглядело выцветшим.
   Теперь картинка полная, а текст читается за счёт градиента снизу. */
.tile-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Затемнение только под текстом, а не по всей картинке */
/* Затемнение только под подписью. Раньше градиент шёл почти до верха
   плитки и «смывал» фото цветом фона — картинка выглядела бледной. */
.tile::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 42%;
  background: linear-gradient(to top,
    color-mix(in srgb, var(--bg) 78%, transparent) 0%,
    transparent 100%);
  pointer-events: none;
}

/* Если картинки нет — тот же градиент не нужен, плитка и так читается */
.tile.no-image::after { display: none; }
.tile-body { position: relative; display: flex; flex-direction: column; gap: 2px; }
.tile-title { font-weight: 620; font-size: 14.5px; letter-spacing: -.01em; }
.tile-meta { font-size: 11.5px; color: var(--ink-2); }
.tile-badge {
  position: absolute; top: 9px; left: 9px;
  font-size: 10px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px;
  background: var(--ink); color: var(--bg);
}
.tile-icon {
  position: absolute; top: 10px; right: 11px;
  font-size: 16px; color: var(--ink-2);
}
.tile.wide { grid-column: span 2; min-height: 96px; flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 16px; }
.tile.wide .tile-body { flex: 1; }

/* ─────────── Product grid ─────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card:active { transform: scale(.99); }

.card-media { position: relative; display: block; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card-media img { transform: scale(1.03); }

.fav-btn {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(8px);
  color: var(--ink-2);
  transition: color .16s var(--ease), background .16s var(--ease), transform .16s var(--ease);
}
.fav-btn svg { width: 16px; height: 16px; }
.fav-btn:hover { color: var(--ink); }
.fav-btn:active { transform: scale(.88); }
.fav-btn.active { color: #d1495b; }
.fav-btn.active svg { fill: currentColor; }

.card-badges { position: absolute; bottom: 7px; left: 7px; display: flex; gap: 4px; flex-wrap: wrap; }
.card-badges span {
  font-size: 10px; font-weight: 650; padding: 3px 6px; border-radius: 5px;
  background: var(--ink); color: var(--bg); letter-spacing: .01em;
}

.card-body { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card-title { font-size: 13px; font-weight: 570; line-height: 1.3; letter-spacing: -.005em; }
.card-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.card-price { display: flex; align-items: baseline; gap: 6px; margin-top: auto; padding-top: 3px; }
.price-now { font-size: 14.5px; font-weight: 660; letter-spacing: -.02em; }
.price-old { font-size: 11.5px; color: var(--ink-3); text-decoration: line-through; }
.rating-line { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-2); }
.star { color: #d99a2b; }

/* ─────────── Qty stepper ─────────── */
.stepper {
  display: flex; align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 32px;
  background: var(--surface);
}
.stepper button {
  width: 30px; height: 100%;
  display: grid; place-items: center;
  color: var(--ink-2);
  font-size: 15px;
  transition: background .14s var(--ease);
}
.stepper button:hover { background: var(--surface-2); color: var(--ink); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
/* Qty теперь поле ввода: человек может сразу написать «12»,
   а не клацать плюс двенадцать раз. Ширина по содержимому,
   стрелки браузера убираем — на телефоне они мешают. */
.stepper .qty {
  min-width: 26px; width: 34px; text-align: center;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: transparent; border: 0; color: var(--ink); padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper .qty::-webkit-outer-spin-button,
.stepper .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .qty:focus { outline: none; background: var(--surface-2); border-radius: 5px; }
.stepper.sm { height: 28px; }
.stepper.sm button { width: 26px; font-size: 14px; }

.card-actions { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.card-actions .stepper { flex: 1; }

/* Не в корзине — одна кнопка во всю ширину. Раньше рядом стояли
   степпер с нулём и кнопка: два конкурирующих действия, и «0» слева
   читался как «ничего нельзя купить». */
.btn-add {
  flex: 1 1 auto;
  height: 32px; padding: 0 11px;
  border-radius: var(--radius-sm);
  background: var(--ink); color: var(--bg);
  font-size: 12.5px; font-weight: 600;
  display: grid; place-items: center;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.btn-add:active { transform: scale(.97); }
.btn-add.in-cart {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.btn-add:active { transform: scale(.95); }
.btn-add.in-cart { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* ─────────── Buttons ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  background: var(--ink); color: var(--bg);
  transition: opacity .16s var(--ease), transform .16s var(--ease), background .16s var(--ease);
  white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.985); }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn.sm svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.danger { background: transparent; color: #c0403f; border: 1px solid color-mix(in srgb, #c0403f 30%, var(--line)); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.icon { width: 44px; padding: 0; }

/* ─────────── Product page ─────────── */
.pdp-top { position: sticky; top: 0; z-index: 30; padding: 8px 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px 0 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px; font-weight: 550; color: var(--ink-2);
}
.back-btn svg { width: 16px; height: 16px; }

.gallery { margin: 6px -16px 0; }
.gallery-track {
  display: flex; gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 1; background: var(--surface-2); }
.gallery-slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery-dots { display: flex; justify-content: center; gap: 5px; padding: 10px 0 2px; }
.gallery-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--line-strong);
  transition: all .2s var(--ease);
}
.gallery-dots i.on { background: var(--ink); width: 16px; border-radius: 3px; }

.pdp-title { margin: 14px 0 3px; font-size: 22px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; }
.pdp-sub { color: var(--ink-2); font-size: 13.5px; }
.pdp-rating { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 12.5px; color: var(--ink-2); }
.pdp-price { display: flex; align-items: baseline; gap: 9px; margin-top: 12px; }
.pdp-price .price-now { font-size: 25px; letter-spacing: -.03em; }

.pdp-actions { display: flex; gap: 8px; margin-top: 16px; align-items: stretch; }
.pdp-actions .btn { flex: 1; height: 46px; }

/* Покупка в карточке товара — два состояния:

   не в корзине:  [ В корзину ]  ♡
   в корзине:     [ −  2  + ]    ♡

   Промежуточный вариант «− [0] + В корзину» из четырёх элементов
   на телефоне разваливался: минус — квадрат, поле — прямоугольник,
   плюс — с подписью. Теперь элементов ровно столько, сколько нужно. */

.pdp-buy-btn {
  flex: 1; height: 46px; border-radius: 12px;
  background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 600;
}
.pdp-buy-btn:active { opacity: .82; }

.pdp-stepper {
  flex: 1; display: flex; align-items: center;
  height: 46px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  overflow: hidden;
}
.pdp-stepper button {
  flex: 0 0 46px; height: 100%;
  font-size: 19px; line-height: 1; color: var(--ink);
}
.pdp-stepper button:active { background: var(--surface-2); }
.pdp-stepper input {
  flex: 1; min-width: 0; height: 100%;
  text-align: center; font-size: 15px; font-weight: 600;
  color: var(--ink); background: transparent; border: 0;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.pdp-stepper input::-webkit-outer-spin-button,
.pdp-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pdp-stepper input:focus { outline: none; background: var(--surface-2); }

/* Кнопка-ссылка: «12 отзывов» в шапке товара */
.linkish {
  color: var(--ink-3); font-size: inherit; text-decoration: underline;
  text-decoration-color: var(--line-strong); text-underline-offset: 2px;
}
.linkish:active { color: var(--ink); }
.pdp-actions .fav-btn.lg {
  position: static; width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  backdrop-filter: none;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
}
.panel-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 10px; }

/* Markdown body */
.md { font-size: 14px; line-height: 1.62; color: var(--ink-2); }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { color: var(--ink); font-weight: 640; letter-spacing: -.015em; margin: 18px 0 7px; line-height: 1.3; }
.md h1 { font-size: 18px; }
.md h2 { font-size: 16px; }
.md h3 { font-size: 14.5px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin-bottom: 4px; }
.md li::marker { color: var(--ink-3); }
.md strong { color: var(--ink); font-weight: 620; }
.md em { color: var(--ink); }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; padding: 1px 5px; border-radius: 5px;
  background: var(--surface-2); color: var(--ink);
}
.md pre { background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; margin: 0 0 10px; }
.md pre code { background: none; padding: 0; }
.md blockquote {
  margin: 0 0 10px; padding: 9px 13px;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 0 8px 8px 0;
  color: var(--ink-2);
}
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md img { border-radius: 10px; margin: 6px 0; }
.md-emoji { font-size: 15px; line-height: 1; }

/* Attributes */
.attrs { display: grid; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; }
.attr-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 12px; background: var(--surface); font-size: 13px; }
.attr-label { color: var(--ink-3); }
.attr-value { color: var(--ink); font-weight: 520; text-align: right; }

/* Reviews */
.rating-summary { display: flex; align-items: center; gap: 16px; }
.rating-big { font-size: 34px; font-weight: 660; letter-spacing: -.03em; line-height: 1; }
.rating-stars { color: #d99a2b; font-size: 14px; letter-spacing: 1px; }
.rating-bars { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.rating-bar { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-3); }
.rating-bar .track { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rating-bar .fill { height: 100%; background: #d99a2b; border-radius: 2px; }

.review { padding: 13px 0; border-top: 1px solid var(--line); }
.review:first-of-type { border-top: 0; }
.review-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.avatar {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface-2); color: var(--ink-2);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 620; overflow: hidden; flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; }
.review-author { font-size: 13px; font-weight: 570; }
.review-date { font-size: 11px; color: var(--ink-3); }
.review-stars { margin-left: auto; font-size: 11px; color: #d99a2b; }
.review-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

.star-input { display: flex; gap: 5px; font-size: 26px; line-height: 1; }
.star-input button { color: var(--line-strong); transition: color .12s, transform .12s; }
.star-input button.on { color: #d99a2b; }
.star-input button:active { transform: scale(.9); }

/* ─────────── Cart / checkout ─────────── */
.line-item { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); }
.line-item:first-child { border-top: 0; }
.line-img { width: 66px; height: 66px; border-radius: 11px; object-fit: cover; background: var(--surface-2); flex: 0 0 66px; }
.line-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.line-title { font-size: 13.5px; font-weight: 560; line-height: 1.3; }
.line-meta { font-size: 11.5px; color: var(--ink-3); }
.line-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.line-price { font-size: 14px; font-weight: 650; letter-spacing: -.015em; }

.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; color: var(--ink-2); }
.summary-row.total { padding-top: 11px; margin-top: 6px; border-top: 1px solid var(--line); font-size: 16px; font-weight: 660; color: var(--ink); }
.summary-row .neg { color: #2f8f5b; }

.promo-row { display: flex; gap: 7px; margin: 4px 0 2px; }
.promo-row .search { margin: 0; flex: 1; height: 40px; }
.promo-row .btn { height: 40px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.field label { font-size: 12px; font-weight: 560; color: var(--ink-2); }
.field input, .field textarea, .field select {
  height: 42px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  font-size: 14px;
  transition: border-color .16s var(--ease);
  width: 100%;
}
.field textarea { height: auto; min-height: 74px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--line-strong); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }

.delivery-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.delivery-opt:hover { border-color: var(--line-strong); }
.delivery-opt.on { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 3%, var(--surface)); }
.delivery-radio {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  flex: 0 0 17px; margin-top: 2px;
  display: grid; place-items: center;
}
.delivery-opt.on .delivery-radio { border-color: var(--ink); }
.delivery-opt.on .delivery-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.delivery-body { flex: 1; min-width: 0; }
.delivery-title { font-size: 13.5px; font-weight: 570; }
.delivery-desc { font-size: 11.5px; color: var(--ink-3); }
.delivery-price { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ─────────── Profile ─────────── */
.profile-card {
  display: flex; align-items: center; gap: 13px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  margin-top: 14px;
}
.profile-name { font-size: 17px; font-weight: 640; letter-spacing: -.02em; }
.profile-handle { font-size: 12.5px; color: var(--ink-3); }
.profile-id { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat {
  padding: 11px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
  text-align: center;
}
.stat-val { font-size: 17px; font-weight: 660; letter-spacing: -.02em; }
.stat-key { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

.list { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; margin-top: 10px; }
.list-item {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  width: 100%;
  text-align: left;
  transition: background .14s var(--ease);
}
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-ico { width: 20px; display: grid; place-items: center; color: var(--ink-3); }
.list-item .li-ico svg { width: 17px; height: 17px; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13.5px; font-weight: 540; }
.list-item .li-sub { font-size: 11.5px; color: var(--ink-3); }
.list-item .li-right { color: var(--ink-3); font-size: 12px; display: flex; align-items: center; gap: 6px; }

.order-card { padding: 13px 14px; border-top: 1px solid var(--line); }
.order-card:first-child { border-top: 0; }
.order-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-num { font-size: 13px; font-weight: 620; letter-spacing: -.01em; }
.order-date { font-size: 11px; color: var(--ink-3); }
.order-sum { font-size: 13.5px; font-weight: 640; }
.order-items-preview { display: flex; gap: 5px; margin-top: 8px; }
.order-items-preview img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 620; letter-spacing: .01em;
  background: var(--surface-2); color: var(--ink-2);
}
.pill.new { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.pill.shipped { background: color-mix(in srgb, #2f8f5b 14%, transparent); color: #2f8f5b; }
.pill.paid { background: color-mix(in srgb, #2f8f5b 14%, transparent); color: #2f8f5b; }
.pill.cancelled { background: color-mix(in srgb, #c0403f 12%, transparent); color: #c0403f; }
.pill.done { background: color-mix(in srgb, #57544e 12%, transparent); color: var(--ink-2); }

/* ─────────── Empty & error states ─────────── */
.empty { text-align: center; padding: 54px 20px; }
.empty-ico { font-size: 30px; opacity: .28; margin-bottom: 10px; }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-text { font-size: 13px; color: var(--ink-3); margin: 5px auto 16px; max-width: 30ch; }

.skeleton { background: var(--surface-2); border-radius: var(--radius); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.sk-card { height: 220px; }

/* ─────────── Кастомные иконки ─────────── */
/* Подставляются из web/assets/icons/ через manifest.json — размеры совпадают
   со встроенными SVG, чтобы вёрстка не ехала. */
/* Иконка, вставленная текстом: <<vesi.svg>> */
.md-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.18em;
  object-fit: contain;
  margin: 0 1px;
  /* SVG с currentColor не перекрасится, но прозрачный фон сохранит тему */
}
.attr-row .md-icon { width: 1.1em; height: 1.1em; }
.md p .md-icon, .md li .md-icon { margin-right: 3px; }

.icon-img {
  width: 20px; height: 20px;
  object-fit: contain;
  display: block;
}
.icon-btn .icon-img { width: 20px; height: 20px; }
.icon-btn.ghost .icon-img { width: 16px; height: 16px; }
.tab-ico .icon-img { width: 21px; height: 21px; }
.btn .icon-img { width: 18px; height: 18px; }
.btn.sm .icon-img { width: 15px; height: 15px; }
.list-item .li-ico .icon-img { width: 17px; height: 17px; }
.fav-btn .icon-img { width: 16px; height: 16px; }

/* ─────────── Segmented control ─────────── */
.seg {
  display: flex; gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
}
.seg button {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-3);
  transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
  white-space: nowrap;
}
.seg button:hover { color: var(--ink-2); }
.seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ─────────── Admin ─────────── */
/* ── Навигация админки: два ряда ──
   Группы сверху, вкладки открытой группы снизу.

   Круглых «пилюль» больше нет: четыре залитых овала рядом выглядели
   как рекламные баннеры, а не как разделы панели. Теперь группа —
   это подпись с подчёркиванием у активной. Тише и понятнее: сразу
   видно, что это уровни одной навигации, а не кнопки действий. */

.admin-nav {
  position: sticky; top: var(--top-h); z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.admin-groups-row {
  display: flex; overflow-x: auto;
  scrollbar-width: none;
}
.admin-groups-row::-webkit-scrollbar { display: none; }

.admin-group-pill {
  flex: 0 0 auto;
  padding: 11px 14px 9px;
  font-size: 13px; font-weight: 560; color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;   /* подчёркивание ложится на линию блока */
  transition: color .14s, border-color .14s;
}
.admin-group-pill:active { color: var(--ink-2); }
.admin-group-pill.active {
  color: var(--ink); font-weight: 640;
  border-bottom-color: var(--ink);
}

/* Вкладки открытой группы. Без sticky — навигация уже закреплена
   родительским .admin-nav, второй закреплённый ряд только съедал место. */
.admin-tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 0 2px;
}
.admin-tabs::-webkit-scrollbar { display: none; }
/* Вкладки группы: обычный текст, активная — жирная с точкой.
   Заливка осталась только у одного элемента на экране, и это
   переключатель периода внутри раздела, а не навигация. */
.admin-tab {
  flex: 0 0 auto; padding: 7px 11px;
  font-size: 13px; color: var(--ink-3); font-weight: 520;
}
.admin-tab.active { color: var(--ink); font-weight: 640; }

.admin-body { padding-top: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi { padding: 12px 13px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.kpi-val { font-size: 19px; font-weight: 660; letter-spacing: -.025em; }
.kpi-key { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 1px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }

.admin-sec { padding: 11px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.admin-sec:last-child { border-bottom: 0; }
.admin-sec .admin-sec .sec-title { flex: 1; font-size: 13.5px; font-weight: 550; }
.admin-sec .sec-meta { font-size: 11px; color: var(--ink-3); }
.sec-thumb { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; background: var(--surface-2); }

.form-grid { display: grid; gap: 10px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; font-size: 13.5px; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 12px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .18s var(--ease); flex: 0 0 40px; }
.switch input:checked { background: var(--accent); }
.switch input::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.switch input:checked::after { transform: translateX(17px); }

/* ── Полоски времени в админке ── */
/* Показывают, сколько человек провёл в магазине: длина = доля от максимума.
   Сделаны тонкими и в фоне — чтобы таблица не превратилась в гистограмму. */
.mini-bar-wrap {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.mini-bar-wrap .mini-bar {
  height: 5px; min-width: 2px; border-radius: 3px;
  background: var(--accent); opacity: .75; transition: width .2s;
}
.mini-bar-wrap .tiny { min-width: 46px; text-align: right; }

/* Отступ для сообщений-заглушек вместо контента */
.pad { padding: 18px 4px; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 6px; }
.bars .bar { flex: 1; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .82; transition: opacity .14s; position: relative; }
.bars .bar:hover { opacity: 1; }
.bars .bar.muted { background: var(--line-strong); }

.chips-input { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 42px; }
.chips-input .tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; }
.chips-input input { border: 0; outline: none; background: none; flex: 1; min-width: 70px; font-size: 13px; }

.img-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.img-thumb { position: relative; width: 58px; height: 58px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb button { position: absolute; top: 2px; right: 2px; width: 17px; height: 17px; border-radius: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; display: grid; place-items: center; }
.img-add { width: 58px; height: 58px; border-radius: 9px; border: 1px dashed var(--line-strong); display: grid; place-items: center; color: var(--ink-3); font-size: 18px; }

/* ─────────── Демо-режим вне Telegram ─────────── */
.devbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 16px 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.devbar::-webkit-scrollbar { display: none; }
.devbar-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-right: 2px;
}
.devbar-btn {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all .14s var(--ease);
}
.devbar-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.devbar-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ─────────── Toast & sheet ─────────── */
.toast {
  position: fixed; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%) translateY(8px);
  z-index: 90;
  padding: 10px 16px;
  border-radius: 11px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 540;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet::before { content: ""; position: absolute; inset: 0; background: rgba(12, 12, 11, .42); backdrop-filter: blur(2px); animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-panel {
  position: relative;
  width: 100%; max-width: var(--max);
  max-height: 88vh;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; flex-direction: column;
  animation: slideUp .26s var(--ease);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 16px 11px; border-bottom: 1px solid var(--line); }
.sheet-head strong { font-size: 15px; font-weight: 620; letter-spacing: -.01em; }
.sheet-body { padding: 14px 16px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ─────────── Misc ─────────── */
.muted { color: var(--ink-3); }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.flex { display: flex; } .between { justify-content: space-between; } .aic { align-items: center; }
.gap6 { gap: 6px; } .gap10 { gap: 10px; }
.grow { flex: 1; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.card-actions .qty-val { flex: 1; text-align: center; font-weight: 600; font-size: 14px; }

.pdp-remove-btn {
  width: 48px; height: 48px; flex: 0 0 48px; border: 0; border-radius: 14px;
  background: #c0403f; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.pdp-remove-btn svg { width: 22px; height: 22px; }
.pdp-remove-btn:disabled { opacity: .6; }
