/* ─────────────────────────────────────────────────────────
   TT Shop — витрина
   Шрифты: Golos Text (интерфейс), JetBrains Mono (данные).
   Оба лежат локально в /static/fonts, лицензия SIL OFL.
   ───────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/golos-text-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/golos-text-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f1f2f5;
  --panel: #ffffff;
  --ink: #16181d;
  --ink-soft: #414852;
  --muted: #767e8a;
  --line: #e0e3e8;
  --line-strong: #c6cbd3;
  --zebra: #fafbfc;

  --dark: #16181d;
  --dark-2: #1f232b;

  --brand: #e0233f;
  --brand-dark: #c21b34;
  --link: #1a56b0;
  --green: #1a8f45;
  --green-dark: #147038;
  --amber: #e2a00f;
  --amber-dark: #c28709;
  --red: #c8323c;

  --radius: 4px;

  --font: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

  /* Поверхности и состояния — переопределяются тёмной темой */
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #f2f4f7;
  --btn-bg: #eceef2;
  --hover: #f3f6fa;
  --flag-line: rgba(22, 24, 29, .15);
  --backdrop: rgba(15, 17, 21, .6);
  --focus-ring: #b9cdec;
  --focus-line: #7aa0da;

  --ok-text: #1a8f45;
  --ok-bg: #f1f9f3;   --ok-line: #bfe0c9;   --ok-ink: #125e32;
  --err-bg: #fdf3f3;  --err-line: #ecc4c7;  --err-ink: #9c2028;
  --info-bg: #f2f6fd; --info-line: #c8d9f2; --info-ink: #17478f;
  --warn-text: #b3700c;
  --warn-bg: #fdf8ec; --warn-line: #ecd6a4; --warn-ink: #7d5a06;
  --violet-bg: #f3f2fa; --violet-line: #cdc8e8; --violet-ink: #45397f;
}

* { box-sizing: border-box; }

/* Скрытое скрыто всегда — даже там, где адаптив задаёт строкам таблицы display: grid */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: 25px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.pos { color: var(--ok-text); }
.neg { color: var(--red); }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Верхняя строка ─────────────────────────────────────── */

.topline {
  background: #0f1115;
  color: #98a0ac;
  font-size: 12.5px;
  border-bottom: 1px solid #22262e;
}
.topline__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
}
.topline__news {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: default;
}
.topline__text { min-width: 0; }
.topline__support { color: #d4d9e0; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }

/* ── Шапка ──────────────────────────────────────────────── */

.header {
  background: var(--dark);
  border-bottom: 2px solid var(--brand);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header__inner { display: flex; align-items: center; gap: 24px; min-height: 60px; }

.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo:hover { text-decoration: none; }
/* Словесный знак unitraff — SVG, красится цветом ссылки */
.logo__word { display: block; height: 22px; width: auto; flex: none; }
.logo__tag {
  font-size: 11.5px; line-height: 1.25; color: #8d95a1; max-width: 220px;
  padding-left: 12px; border-left: 1px solid #2f3540;
}

.nav { display: flex; gap: 20px; margin-left: 8px; }
.nav a {
  color: #bcc3cd;
  font-size: 14px;
  font-weight: 500;
  padding: 5px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: #fff; text-decoration: none; }
.nav a.is-active { color: #fff; border-bottom-color: var(--brand); }

.header__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.cart-link {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid #333944;
  color: #d4d9e0;
  display: flex; align-items: center; justify-content: center;
}
.cart-link:hover { border-color: #4a525f; color: #fff; }
.cart-link__count {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.balance {
  display: flex; flex-direction: column;
  padding: 3px 12px;
  border-radius: var(--radius);
  border: 1px solid #333944;
  line-height: 1.25;
}
.balance:hover { text-decoration: none; border-color: #4a525f; }
.balance__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #868e9a; }
.balance__value { font-size: 14px; font-weight: 600; color: #fff; }

/* ── Кнопки ─────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:active { transform: translateY(1px); }
.btn.is-done { background: var(--ok-bg); color: var(--ok-ink); }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--buy { background: var(--green); color: #fff; }
.btn--buy:hover { background: var(--green-dark); }
.btn--cart { background: var(--amber); color: #2e2100; padding: 8px 11px; }
.btn--cart:hover { background: var(--amber-dark); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--muted); color: var(--ink); }
.btn--danger { background: var(--surface); color: var(--red); border-color: var(--err-line); }
.btn--danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn--disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
.btn--mini { padding: 5px 10px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--link {
  background: none; border: none; padding: 3px 0;
  color: var(--link); font-weight: 400; font-size: 13.5px;
}
.btn--link:hover { color: var(--brand); text-decoration: underline; }

/* ── Сообщения ──────────────────────────────────────────── */

.flash {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid;
  border-left-width: 3px;
  font-size: 14px;
}
.flash--success { background: var(--ok-bg); border-color: var(--ok-line); border-left-color: var(--green); color: var(--ok-ink); }
.flash--error { background: var(--err-bg); border-color: var(--err-line); border-left-color: var(--red); color: var(--err-ink); }
.flash--info { background: var(--info-bg); border-color: var(--info-line); border-left-color: var(--link); color: var(--info-ink); }

/* ── Общие блоки ────────────────────────────────────────── */

.main { padding-bottom: 48px; min-height: 60vh; }
.page-title { margin: 24px 0 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.panel__head h1, .panel__head h2 { margin: 0; }
.panel--empty { text-align: center; padding: 44px 20px; margin-top: 24px; }
.panel--empty h1, .panel--empty h2 { margin-bottom: 8px; }
.panel--article { margin-top: 24px; padding: 26px 30px; }

/* ── Строка над каталогом ───────────────────────────────── */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.lead { padding: 26px 0 4px; max-width: 760px; }
.lead h1 { font-size: 24px; margin-bottom: 8px; }
.lead p { margin: 0; color: var(--muted); font-size: 14.5px; }

.topstats {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 16px 0 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}
.topstats__facts { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.topstats__facts span { position: relative; }
.topstats__facts span + span { padding-left: 19px; }
.topstats__facts span + span::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong);
  transform: translateY(-50%);
}
.topstats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.topstats__sale b { color: var(--ok-text); }
.topstats__link { font-size: 13.5px; }

/* ── Навигация по категориям ────────────────────────────── */

.catnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 20px; }
.catnav__item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.catnav__item:hover { text-decoration: none; border-color: var(--line-strong); color: var(--ink); }
.catnav__item span { font-size: 12px; font-weight: 600; color: var(--muted); }
.catnav__item--blue    { border-left: 3px solid #2d5f9e; }
.catnav__item--red     { border-left: 3px solid #a43038; }
.catnav__item--orange  { border-left: 3px solid #b5651b; }
.catnav__item--violet  { border-left: 3px solid #55499b; }
.catnav__item--crimson { border-left: 3px solid #97294b; }
.catnav__item--rose    { border-left: 3px solid #b03260; }
.catnav__item--green   { border-left: 3px solid #1c7a46; }
.catnav__item--slate   { border-left: 3px solid #3c4655; }

/* ── Категория ──────────────────────────────────────────── */

.category { margin-bottom: 26px; scroll-margin-top: 76px; }

.category__head { border-radius: var(--radius) var(--radius) 0 0; padding: 14px 18px; color: #fff; }
.category__head h2 { margin: 0 0 3px; font-size: 18px; font-weight: 600; }
.category__head p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .8); max-width: 880px; }

.category__head--blue    { background: #2d5f9e; }
.category__head--red     { background: #a43038; }
.category__head--orange  { background: #b5651b; }
.category__head--violet  { background: #55499b; }
.category__head--crimson { background: #97294b; }
.category__head--rose    { background: #b03260; }
.category__head--green   { background: #1c7a46; }
.category__head--slate   { background: #3c4655; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow-x: auto;
}

.goods { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.goods thead th {
  background: var(--surface-2);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.goods__col-price { width: 170px; }
.goods__col-stock { width: 105px; }
.goods__col-sold { width: 200px; }
.goods__col-actions { width: 190px; }

.goods tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.goods__row--alt td { background: var(--zebra); }
.goods__row:hover td { background: var(--hover); }
.goods tbody tr:last-child td { border-bottom: none; }

.goods__title { display: flex; align-items: flex-start; gap: 11px; }
.goods__link { color: var(--ink); font-weight: 500; }
.goods__link:hover { color: var(--brand); text-decoration: none; }

.flag {
  width: 30px; height: 22px;
  border-radius: 2px;
  flex: none;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--flag-line);
  margin-top: 2px;
}
.flag.fi { line-height: 22px; }
.flag--lg { width: 44px; height: 32px; }
.flag--tt {
  background: #16181d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M16.6 5.8a4.3 4.3 0 0 1-1-2.8h-3v11.3a2.5 2.5 0 1 1-1.8-2.4V8.8a5.5 5.5 0 1 0 4.8 5.4V9.4c1 .7 2.3 1.1 3.6 1.1V7.5c-1 0-1.9-.6-2.6-1.7z'/%3E%3C/svg%3E") center/15px no-repeat;
}

.goods__more {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 1px;
  padding: 0;
  background: none; border: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--link);
  border-bottom: 1px dashed color-mix(in srgb, currentColor 45%, transparent);
  cursor: pointer;
}
.goods__more:hover { color: var(--brand); }
.goods__more svg { transition: transform .12s linear; }
.goods__more.is-open svg { transform: rotate(180deg); }

.goods__price { font-weight: 600; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.goods__sold { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.goods__sold b { color: var(--ink); font-weight: 600; font-size: 14px; }
.goods__lastsale { display: flex; align-items: center; gap: 4px; margin-top: 1px; font-size: 11.5px; color: var(--muted); }
.goods__actions { white-space: nowrap; }
.goods__actions .btn + form { margin-left: 5px; }
.goods__actions form { display: inline-block; vertical-align: middle; }

.stock { display: inline-block; font-weight: 600; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock--ok { color: var(--ok-text); }
.stock--low { color: var(--warn-text); }
.stock--out { color: var(--red); }

/* Раскрытие «Подробнее»: строка всегда в разметке, анимируется её высота
   (grid-template-rows 0fr → 1fr — единственный способ плавно раскрыть
   блок неизвестной высоты без JS-замеров). */
.goods tbody tr.goods__details > td { padding: 0; border-bottom: none; background: none; }
.details-wrap {
  display: grid;
  grid-template-rows: 0fr;
  background: var(--surface-2);
  transition: grid-template-rows .22s ease;
}
.details-wrap > div { overflow: hidden; min-height: 0; }
.goods__details.is-open .details-wrap { grid-template-rows: 1fr; }

.details {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 14px 16px 16px 41px;
  border-left: 3px solid var(--line-strong);
}
.details__text { flex: 1 1 420px; font-size: 13.5px; color: var(--ink-soft); }
.details__text ul, .details__text ol { margin: 8px 0; padding-left: 18px; }
.details__text li { margin-bottom: 4px; }
.details__text p:last-child { margin-bottom: 0; }
.details__format {
  flex: 0 1 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  align-self: flex-start;
}
.details__format span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.details__format code { font-family: var(--font-mono); font-size: 12px; color: var(--ink); word-break: break-all; }

/* ── Блок доверия под заголовком ────────────────────────── */

.trust {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 12px;
}
.trust__item {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12.5px; line-height: 1.4;
}
.trust__item b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.trust__item div > span { color: var(--muted); }
.trust__icon {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.trust__icon--green  { background: var(--ok-bg); color: var(--ok-text); }
.trust__icon--blue   { background: var(--info-bg); color: var(--link); }
.trust__icon--amber  { background: var(--warn-bg); color: var(--warn-text); }
.trust__icon--violet { background: var(--violet-bg); color: var(--violet-ink); }

.paybadges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 12.5px; }
.paybadges__label { color: var(--muted); margin-right: 2px; }
.paybadge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 500;
  white-space: nowrap;
}
.paybadge--crypto b { color: #1a9a7a; font-weight: 700; }

/* ── Поиск и фильтр каталога ────────────────────────────── */

.filters {
  margin: 0 0 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.filters__row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters__search { position: relative; flex: 1 1 280px; }
.filters__search svg { position: absolute; left: 11px; top: 50%; margin-top: -8px; color: var(--muted); pointer-events: none; }
.filters__search .input { padding-left: 34px; }
.filters__sort { flex: 0 1 200px; }
.filters__instock { margin: 0; white-space: nowrap; font-size: 13.5px; color: var(--ink-soft); }
.filters__empty { margin-top: 0; }

.geo { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.geo__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}
.geo__chip:hover { border-color: var(--line-strong); color: var(--ink); }
.geo__chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.geo__chip.is-active .geo__count { color: inherit; opacity: .7; }
.geo__flag { width: 18px; height: 13px; border-radius: 2px; box-shadow: 0 0 0 1px var(--flag-line); }
.geo__count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Товар ──────────────────────────────────────────────── */

.breadcrumbs { display: flex; gap: 7px; flex-wrap: wrap; margin: 20px 0 14px; font-size: 13px; color: var(--muted); }
.breadcrumbs b { color: var(--ink-soft); font-weight: 500; }

.product { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.product__main { padding: 24px 26px; }
.product__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.product__head h1 { margin-bottom: 3px; font-size: 22px; }
.product__sub { margin: 0; font-size: 13px; color: var(--muted); }
.product__desc { font-size: 14px; color: var(--ink-soft); }
.product__desc ul, .product__desc ol { padding-left: 18px; }
.product__price { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.product__stockline { margin: 3px 0 14px; }
.product__form { margin-bottom: 8px; }
.product__facts {
  list-style: none; margin: 16px 0 0; padding: 14px 0 0;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.product__facts li { padding-left: 15px; position: relative; margin-bottom: 6px; }
.product__facts li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; background: var(--muted);
}

/* ── Формы ──────────────────────────────────────────────── */

.form { max-width: 720px; }
.form__row { display: flex; gap: 14px; flex-wrap: wrap; }
.form__row .field { flex: 1 1 200px; }
.field--grow { flex: 2 1 300px; }
.form__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.form--inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; max-width: none; }
.form--inline .field { margin-bottom: 0; }

.field { display: block; margin-bottom: 15px; }
.field__label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 5px; }
.field__label i { font-style: normal; color: var(--muted); font-weight: 400; }
.field__hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--focus-ring); outline-offset: -1px; border-color: var(--focus-line); }
.input:disabled { background: var(--surface-3); color: var(--muted); }
textarea.input { resize: vertical; min-height: 64px; }
.input--code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.input--qty { width: 74px; }
.input--search { width: 240px; }
.input--mini { width: 130px; padding: 5px 8px; font-size: 13px; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23767e8a' d='M8 11 3 5.5 4.2 4.4 8 8.6l3.8-4.2L13 5.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 13px;
  padding-right: 30px;
}

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 14px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.qty__btn {
  width: 36px; height: 38px;
  border: none; background: var(--surface-3);
  font-family: inherit; font-size: 16px; color: var(--ink-soft);
  cursor: pointer;
}
.qty__btn:hover { background: var(--hover); }
.qty__input {
  width: 70px; height: 38px;
  border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center;
  font-family: inherit; font-size: 15px; font-weight: 600;
  background: var(--surface); color: var(--ink);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.qty__input:focus { outline: none; }
.qty__input::-webkit-outer-spin-button, .qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.search { display: flex; gap: 8px; }

/* ── Авторизация ────────────────────────────────────────── */

.auth { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 28px; }
.auth__box { padding: 24px 26px; }
.auth__box h1 { font-size: 21px; margin-bottom: 4px; }
.auth__alt { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }
.auth__side { padding: 24px 8px; }
.auth__side h3 { font-size: 15px; }
.auth__side ul, .auth__side ol { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 14px; }
.auth__side li { margin-bottom: 9px; }

/* ── Корзина ────────────────────────────────────────────── */

.cart { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.cart__list { padding: 0; overflow: hidden; }
.goods--cart { min-width: 560px; }
.cart__qty { display: flex; gap: 6px; align-items: center; }
.cart__clear { padding: 10px 16px; border-top: 1px solid var(--line); }
.cart__total h3 { margin-bottom: 12px; }
.cart__row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.cart__row--total { border-bottom: none; font-size: 15px; padding-top: 10px; }
.cart__row--total b { font-size: 17px; }
.cart__total .btn { margin-top: 12px; }
.cart__total .muted { font-size: 12.5px; margin-top: 12px; margin-bottom: 0; }

/* ── Кабинет ────────────────────────────────────────────── */

.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; align-items: start; padding-top: 24px; }
.layout__content { min-width: 0; }
.layout .page-title { margin-top: 0; }

.sidenav { position: sticky; top: 78px; }
.sidenav__card { background: var(--dark-2); color: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.sidenav__label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #8d95a1; }
.sidenav__balance { display: block; font-size: 23px; font-weight: 600; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sidenav__sub { display: block; font-size: 12.5px; color: #8d95a1; margin-bottom: 10px; }
.sidenav__menu { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sidenav__menu a {
  display: block;
  padding: 10px 15px;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.sidenav__menu a:last-child { border-bottom: none; }
.sidenav__menu a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.sidenav__menu a.is-active { border-left-color: var(--brand); color: var(--ink); font-weight: 500; background: var(--surface-2); }
.sidenav__logout { padding: 10px 4px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tile { background: var(--surface); padding: 13px 16px; }
.tile span { display: block; font-size: 12px; color: var(--muted); }
.tile b { display: block; font-size: 20px; font-weight: 600; line-height: 1.3; margin: 1px 0; font-variant-numeric: tabular-nums; }
.tile i { font-style: normal; font-size: 12.5px; color: var(--muted); }
.tile--alert { background: var(--warn-bg); }

.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid thead th {
  text-align: left;
  font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover td { background: var(--zebra); }
.grid .flag { display: inline-block; vertical-align: middle; margin-right: 8px; width: 24px; height: 18px; }
.wrap-text { max-width: 320px; white-space: normal; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid;
}
.badge--green { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.badge--red { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.badge--amber { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.badge--grey { background: var(--surface-3); border-color: var(--line-strong); color: var(--muted); }
.badge--violet { background: var(--violet-bg); border-color: var(--violet-line); color: var(--violet-ink); }

.order-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.order-meta span { display: block; font-size: 12px; color: var(--muted); }
.order-meta b { font-size: 14px; font-weight: 500; }

.delivery { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.delivery__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.delivery__head h3 { margin: 0; font-size: 14.5px; }
.delivery__head span { font-size: 13px; color: var(--muted); }
.delivery__head .btn { margin-left: auto; }
.delivery__data {
  margin: 0;
  padding: 12px 13px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--surface);
  max-height: 340px;
  overflow: auto;
}

.requisites {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 20px;
}
.topup { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.topup .panel { margin-bottom: 0; }
.profile__meta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 9px; }
.profile__meta span { display: block; font-size: 12px; color: var(--muted); }

/* ── Статьи ─────────────────────────────────────────────── */

.article { font-size: 14.5px; color: var(--ink-soft); }
.article h2 { margin-top: 0; font-size: 21px; color: var(--ink); }
.article h3 { margin-top: 20px; color: var(--ink); }
.article ol, .article ul { padding-left: 20px; }
.article li { margin-bottom: 7px; }

/* ── Страница заказа и оплаты ───────────────────────────── */

.orderpage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.orderpage .panel__head h1 { font-size: 22px; }
.orderpage__cancel { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.orderpage__side h3 { font-size: 15px; }

.ordersum { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
.ordersum th {
  text-align: left; font-weight: 500; color: var(--muted);
  width: 150px; padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.ordersum td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.ordersum tr:last-child th, .ordersum tr:last-child td { border-bottom: none; }
.ordersum__amount { font-size: 18px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }

.reserve {
  border: 1px solid var(--warn-line);
  border-left: 3px solid var(--amber);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  transition: border-color .2s ease, background .2s ease;
}
.reserve.is-soon { border-color: var(--err-line); border-left-color: var(--red); background: var(--err-bg); }
.reserve b { font-size: 14.5px; }
.reserve p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.reserve__clock {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}

.pay { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; }
.pay__qr {
  flex: none;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 0;
}
.pay__qr svg { width: 160px; height: 160px; display: block; }
.pay__data { flex: 1 1 300px; }
.pay__network { font-size: 13.5px; margin-bottom: 10px; }
.pay__network b { color: var(--brand); }
.copyrow { display: flex; gap: 8px; }
.copyrow .input { font-family: var(--font-mono); font-size: 12.5px; }

/* Способы оплаты — плитками по две в ряд */
.paytiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 10px; }
.paytile {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  min-height: 54px;
  padding: 8px 11px 8px 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  line-height: 1.25;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.paytile::before {
  content: "";
  position: absolute; left: 10px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}
.paytile:hover { border-color: var(--muted); }
.paytile:has(input:checked) { border-color: var(--green); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--green); }
.paytile:has(input:checked)::before { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 2px var(--surface); }
.paytile:has(input:focus-visible) { outline: 2px solid var(--focus-line); outline-offset: 1px; }
.paytile__title { font-size: 14px; font-weight: 600; color: var(--ink); }
.paytile__sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.paytile__sub.neg { color: var(--red); }

.tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 2px;
  background: var(--ok-bg);
  color: var(--ok-ink);
  font-size: 11px;
  font-weight: 500;
  vertical-align: 1px;
}

.steps { list-style: none; margin: 0 0 16px; padding: 0; counter-reset: step; }
.steps li {
  position: relative;
  padding: 0 0 14px 28px;
  font-size: 13.5px;
  color: var(--muted);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.steps li::after {
  content: "";
  position: absolute; left: 9px; top: 21px; bottom: 2px;
  width: 1px; background: var(--line);
}
.steps li:last-child::after { display: none; }
.steps li.is-current { color: var(--ink); font-weight: 500; }
.steps li.is-current::before { border-color: var(--amber); background: var(--amber); color: #2e2100; }
.steps li.is-done { color: var(--ink-soft); }
.steps li.is-done::before { content: "✓"; border-color: var(--green); background: var(--green); color: #fff; }

.actions-row {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  padding: 14px; margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--zebra);
}
.actions-row .form--inline { flex: 1 1 380px; }
.panel--inset { background: var(--zebra); border-color: var(--line); padding: 14px 16px; margin-bottom: 18px; }
.panel--inset h3 { font-size: 14.5px; }
.delivery__empty { margin: 0; padding: 14px; font-size: 13px; }

/* ── Модалка ────────────────────────────────────────────── */

.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity .16s ease;
}
.modal.is-open .modal__backdrop { opacity: 1; }
/* Окно — колонкой: прокручивается только середина, итог и кнопка всегда видны внизу */
.modal__box {
  position: relative;
  display: flex;
  width: 100%; max-width: 440px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease;
}
.modal__form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.modal__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 22px 12px; overscroll-behavior: contain; }
.modal__footer {
  flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.modal__row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.modal__row .field { margin-bottom: 12px; }
.modal__email { flex: 1 1 180px; }
.modal__submit { flex: 1 1 auto; padding-top: 11px; padding-bottom: 11px; font-size: 15px; }
.modal.is-open .modal__box { opacity: 1; transform: none; }
.modal__close {
  position: absolute; top: 8px; right: 11px;
  background: none; border: none;
  font-size: 22px; line-height: 1; color: var(--muted);
  cursor: pointer;
}
.modal__close:hover { color: var(--ink); }
.modal__title { margin-bottom: 12px; font-size: 17px; }
.modal__product { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 16px; font-size: 14.5px; }
.modal__flag { width: 28px; height: 21px; border-radius: 2px; border: 1px solid var(--flag-line); flex: none; }
.modal__hint { font-size: 12.5px; color: var(--muted); margin: 7px 0; }
.modal__total { display: flex; flex-direction: column; line-height: 1.2; flex: none; }
.modal__total span { font-size: 12px; color: var(--muted); }
.modal__total b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Подвал ─────────────────────────────────────────────── */

.footer { background: var(--dark); color: #98a0ac; padding: 32px 0 18px; font-size: 13.5px; }
.footer__inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 26px; }
.footer__col h4 { color: #fff; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.footer__col a { display: block; color: #aeb6c1; margin-bottom: 7px; }
.footer__col a:hover { color: #fff; }
.footer__note { font-size: 12.5px; color: #757d89; margin: 9px 0 0; max-width: 300px; }
.logo--footer { align-items: center; }
.logo--footer .logo__tag { color: #757d89; border-left-color: #2a2f38; }
.footer__bottom {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 24px; padding-top: 14px;
  border-top: 1px solid #2a2f38;
  font-size: 12.5px; color: #757d89;
}

/* ── Переходы ───────────────────────────────────────────── */

a,
.nav a,
.cart-link,
.balance,
.catnav__item,
.sidenav__menu a,
.admin__nav a,
.tabs a,
.goods__link,
.goods__more,
.footer__col a {
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}

.goods__row td,
.grid tbody tr td { transition: background .12s ease; }
.input { transition: border-color .14s ease, box-shadow .14s ease; }
.flash { animation: flash-in .22s ease both; }

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* Уважаем системную настройку «меньше движения» */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Адаптив ────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .orderpage { grid-template-columns: minmax(0, 1fr); }
  .product, .cart { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__side { padding: 0 8px 8px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; }
  .sidenav__menu { display: flex; flex-wrap: wrap; }
  .sidenav__menu a { flex: 1 1 140px; border-bottom: none; border-left: none; border-top: 3px solid transparent; text-align: center; }
  .sidenav__menu a.is-active { border-left: none; border-top-color: var(--brand); }
  .footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  /* Шапка в одну строку: логотип, корзина, вход, бургер. Разделы — в выпадающем меню */
  .header__inner { gap: 10px; min-height: 56px; position: relative; }
  .header__actions { gap: 8px; }
  .logo__tag { display: none; }
  .logo__word { height: 19px; }
  .balance { padding: 3px 9px; }
  .balance__label { display: none; }
  .header__register, .header__cabinet, .header__actions .theme-toggle { display: none; }
  .header__auth .btn { padding: 8px 12px; }
  .header .burger { display: inline-flex; }

  .nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    margin: 0; padding: 6px 0 10px;
    background: var(--dark);
    border-bottom: 2px solid var(--brand);
    box-shadow: 0 14px 28px rgba(0, 0, 0, .35);
  }
  .header.is-menu-open .nav { display: flex; }
  .nav a, .nav__theme {
    padding: 12px 16px; font-size: 16px;
    border-bottom: none; border-left: 3px solid transparent;
  }
  .nav a.is-active { border-left-color: var(--brand); background: rgba(255, 255, 255, .04); }
  .header .nav__theme { border-left: 3px solid transparent; }
  .header .nav__extra { display: flex; flex-direction: column; margin-top: 6px; padding-top: 6px; border-top: 1px solid #2a2f38; }

  /* Строка с часами работы и гарантией — одной строкой, по нажатию целиком */
  .topline__support { display: none; }
  .topline__inner { min-height: 30px; }
  .topline__news { cursor: pointer; width: 100%; }
  .topline__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topline__news.is-expanded { padding: 6px 0; }
  .topline__news.is-expanded .topline__text { white-space: normal; }

  .lead { padding: 20px 0 2px; }
  .lead h1 { font-size: 21px; }
  .lead p { font-size: 14px; }
  .topstats { padding: 12px 0 10px; font-size: 13px; }
  .topstats__facts { gap: 4px 12px; }
  .topstats__facts span + span { padding-left: 13px; }

  /* Категории — лентой, чтобы не занимать пол-экрана */
  .catnav {
    flex-wrap: nowrap; overflow-x: auto;
    margin: 0 -16px 18px; padding: 0 16px 4px;
    scrollbar-width: none;
  }
  .catnav::-webkit-scrollbar { display: none; }
  .catnav__item { flex: none; }

  .category__head { padding: 12px 14px; }
  .category__head h2 { font-size: 16px; }
  .category__head p { font-size: 12.5px; }

  /* 16px в полях — иначе iOS зумит страницу при фокусе */
  .input, .qty__input { font-size: 16px; }
  .btn { padding: 10px 15px; }
  .btn--mini { padding: 7px 11px; }

  .panel { padding: 16px; }
  .panel--article { padding: 18px 16px; }
  .layout__content .panel { overflow-x: auto; }
  .footer__inner { grid-template-columns: 1fr; }
  .footer { padding: 26px 0 16px; }

  .ordersum th { width: 112px; font-size: 13px; padding-right: 10px; }
  .pay { gap: 14px; }
  .pay__qr { margin: 0 auto; }
  .actions-row { padding: 12px; }
}

/* Каталог на телефоне: строка таблицы превращается в карточку товара.
   Селекторы намеренно длинные — иначе их перебивает `.goods tbody td`. */
@media (max-width: 720px) {
  .table-wrap { overflow: visible; }
  .goods { display: block; min-width: 0; }
  .goods thead { display: none; }
  .goods tbody { display: block; }

  .goods tbody tr.goods__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name    name"
      "price   stock"
      "sold    sold"
      "actions actions";
    align-items: center;
    gap: 2px 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }
  .goods tbody tr.goods__row--alt { background: var(--zebra); }

  .goods tbody tr.goods__row > td {
    display: block;
    padding: 0;
    border-bottom: none;
    background: none;
  }
  .goods tbody tr.goods__row:hover > td { background: none; }

  .goods tbody tr.goods__row > td.goods__name { grid-area: name; margin-bottom: 8px; }
  .goods tbody tr.goods__row > td.goods__price { grid-area: price; font-size: 18px; }
  .goods tbody tr.goods__row > td.goods__stock { grid-area: stock; justify-self: end; }
  .goods tbody tr.goods__row > td.goods__sold {
    grid-area: sold;
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px;
    font-size: 12.5px; color: var(--muted);
    margin-top: 2px;
  }
  .goods tbody tr.goods__row > td.goods__actions {
    grid-area: actions;
    display: flex; gap: 8px;
    margin-top: 12px;
  }

  .goods__sold b { font-weight: 600; color: var(--ink-soft); font-size: 12.5px; }
  .goods__lastsale { margin-top: 0; }
  .goods__title { align-items: center; }
  .goods__link { font-size: 15px; }
  .goods__stock { font-size: 14px; }

  /* Форма «в корзину» не должна мешать кнопкам встать в ряд */
  .goods tbody tr.goods__row > td.goods__actions form { display: contents; }
  .goods tbody tr.goods__row > td.goods__actions .btn { flex: 1; padding: 11px 14px; }
  .goods tbody tr.goods__row > td.goods__actions .btn--cart { flex: 0 0 52px; }

  /* Раскрытая часть примыкает к карточке, а не отделяется от неё */
  .goods tbody tr.goods__row:has(+ .goods__details.is-open) { border-bottom: none; }
  .goods tbody tr.goods__details { display: block; }
  .goods tbody tr.goods__details.is-open { border-bottom: 1px solid var(--line); }
  .goods tbody tr.goods__details > td { display: block; padding: 0; border-bottom: none; }
  .details { padding: 12px 14px 14px; border-left: none; gap: 12px; }
  .details__format { flex: 1 1 100%; }

  /* Корзина: тот же приём */
  .goods--cart { min-width: 0; }
  .goods--cart tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name  name"
      "price qty"
      "total remove";
    align-items: center;
    gap: 10px 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }
  .goods--cart tbody tr > td { display: block; padding: 0; border-bottom: none; }
  .goods--cart tbody tr > td:nth-child(1) { grid-area: name; }
  .goods--cart tbody tr > td:nth-child(2) { grid-area: price; }
  .goods--cart tbody tr > td:nth-child(3) { grid-area: qty; justify-self: end; }
  .goods--cart tbody tr > td:nth-child(4) { grid-area: total; font-size: 17px; }
  .goods--cart tbody tr > td:nth-child(4)::before {
    content: attr(data-label);
    font-size: 12.5px; font-weight: 400; color: var(--muted);
  }
  .goods--cart tbody tr > td:nth-child(5) { grid-area: remove; justify-self: end; }
}

/* Совсем узкие экраны */
@media (max-width: 560px) {
  h1 { font-size: 21px; }
  .page-title { margin: 18px 0 14px; }
  .breadcrumbs { margin: 16px 0 12px; }

  /* Модалка оформления — шторкой снизу, как в мобильных приложениях */
  .modal { align-items: flex-end; padding: 0; }
  .modal__box {
    max-width: none;
    max-height: 92vh;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    max-height: 92dvh;
    transform: translateY(20px);
  }
  .modal.is-open .modal__box { transform: none; }

  .copyrow { flex-direction: column; align-items: stretch; }
  .delivery__head { gap: 8px; }
  .delivery__head .btn { margin-left: 0; }
  .order-meta { gap: 10px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .form--inline { flex-direction: column; align-items: stretch; }
  .form--inline .btn { width: 100%; }
  .danger-zone { flex-direction: column; align-items: stretch; }
  .danger-zone .btn { width: 100%; }
  .search { width: 100%; }
  .input--search { width: 100%; }
}

/* ── Кнопки-иконки в шапке, бургер, тема ────────────────── */

.header__auth { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 36px; height: 36px;
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border: 1px solid #333944;
  border-radius: var(--radius);
  background: none;
  color: #d4d9e0;
  font: inherit;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}
.icon-btn:hover { border-color: #4a525f; color: #fff; }

.burger { display: none; }
.burger__close { display: none; }
.header.is-menu-open .burger__open { display: none; }
.header.is-menu-open .burger__close { display: inline; }

.nav__extra { display: none; }
.nav__theme {
  background: none; border: 0; text-align: left;
  font: inherit; font-weight: 500; color: #bcc3cd; cursor: pointer;
}
.nav__theme:hover { color: #fff; }

.theme-icon-light, .theme-label-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark,
:root[data-theme="dark"] .theme-label-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: inline; }
:root[data-theme="dark"] .theme-label-light { display: inline; }

/* Быстрые суммы на странице пополнения */
.amount-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }

/* ── Предупреждение о сети на странице оплаты ───────────── */

.netwarn {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--err-bg);
  border: 1px solid var(--err-line);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
}
.netwarn__icon {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.netwarn b { display: block; font-size: 15px; color: var(--err-ink); margin-bottom: 2px; }
.netwarn div > span { font-size: 13px; color: var(--ink-soft); }
.netwarn__net {
  display: inline-block;
  padding: 0 7px;
  border-radius: 3px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13.5px;
}

/* ── Выдача: по аккаунту в строке ───────────────────────── */

.accounts {
  list-style: none;
  margin: 0; padding: 2px 0;
  max-height: 440px;
  overflow-y: auto;
  background: var(--surface);
}
.accounts__row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 0;
  border-bottom: 1px solid var(--line);
}
.accounts__row:last-child { border-bottom: none; }
.accounts__row:hover { background: var(--hover); }
.accounts__num { text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.accounts__data {
  display: block;
  padding: 7px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
  scrollbar-width: thin;
}
.accounts__data:focus { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.accounts__copy { width: 30px; height: 30px; border-color: var(--line); background: var(--surface); color: var(--muted); }
.accounts__copy:hover { border-color: var(--line-strong); color: var(--ink); }
.accounts__copy.is-done { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-text); }

/* ── Адаптив новых блоков ───────────────────────────────── */

@media (max-width: 980px) {
  .trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .filters { padding: 10px; }
  .filters__search { flex-basis: 100%; }
  .filters__sort { flex: 1 1 160px; }

  /* Гео и способы оплаты — лентой, чтобы не занимать пол-экрана */
  .geo, .paybadges {
    flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none;
  }
  .geo { margin: 10px -10px 0; padding: 0 10px 2px; }
  .paybadges { margin: 0 -16px 4px; padding: 0 16px 2px; }
  .geo::-webkit-scrollbar, .paybadges::-webkit-scrollbar { display: none; }
  .geo__chip, .paybadge { flex: none; }
}

@media (max-width: 560px) {
  /* Гарантии — свайпаемой лентой карточек */
  .trust {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    margin: 14px -16px 10px; padding: 0 16px 2px;
    scrollbar-width: none;
  }
  .trust::-webkit-scrollbar { display: none; }
  .trust__item { scroll-snap-align: start; }

  .modal__body { padding: 18px 16px 8px; }
  .modal__footer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal__row { gap: 0 12px; }
  .modal__email { flex-basis: 100%; }

  .netwarn { padding: 10px 12px; }
  .accounts__row { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 6px; padding-right: 6px; }
}

/* ── Тёмная тема ────────────────────────────────────────── */
/* Включается атрибутом data-theme на <html>: его ставит скрипт в <head> витрины
   по выбору покупателя или по системной настройке. Админка остаётся светлой. */

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e1014;
  --panel: #161a20;
  --ink: #e7eaef;
  --ink-soft: #c2c8d1;
  --muted: #8a93a1;
  --line: #262b34;
  --line-strong: #363d49;
  --zebra: #181c22;

  --dark: #0a0c0f;
  --dark-2: #1c2129;

  --link: #6fa3ff;
  --green: #1f9a50;
  --green-dark: #1a8545;
  --red: #f0646c;

  --surface: #161a20;
  --surface-2: #1c2028;
  --surface-3: #232833;
  --btn-bg: #262c36;
  --hover: #1f242d;
  --flag-line: rgba(255, 255, 255, .14);
  --backdrop: rgba(0, 0, 0, .7);
  --focus-ring: #2b4a7d;
  --focus-line: #5b8fe0;

  --ok-text: #3ecf7c;
  --ok-bg: #11251a;   --ok-line: #1f4a31;   --ok-ink: #86dca9;
  --err-bg: #2a1417;  --err-line: #5a2630;  --err-ink: #ff9ca3;
  --info-bg: #121d31; --info-line: #24467a; --info-ink: #a2c2ff;
  --warn-text: #f0b23a;
  --warn-bg: #2a2111; --warn-line: #5a4716; --warn-ink: #f2c969;
  --violet-bg: #1d1a31; --violet-line: #3d356b; --violet-ink: #bcb2f7;
}

:root[data-theme="dark"] .topline { background: #07080a; border-bottom-color: #1a1e25; }
:root[data-theme="dark"] .footer { background: #0a0c0f; }
