/* ============================================================
   Чек-Чирик — единая дизайн-система внутренних страниц.
   Этап 0 редизайна: каркас, шапка, подвал, кнопки, пустые состояния.
   Токены — из docs/GUIDELINES.md (лендинг) + расширения по макетам
   docs/mockups/ (тёмные панели, зелёная цена, бейдж).
   Подключается ПОСЛЕ basic.css и modules.css и перекрывает их.
   ============================================================ */

:root {
  /* базовые токены — синхронизированы с лендингом (GUIDELINES.md §2) */
  --bg: #fff;
  --ink: #161616;
  --muted: #6d6d75;
  --faint: #8d8d95;
  --line: #ececef;
  --soft: #f6f7f8;
  --card: #f4f5f7;
  --accent: #A85CFF;
  --accent-dark: #9343f2;
  --accent-soft: #F0E5FC;
  --yes: #067647;
  --yes-bg: #e7f6ee;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 12px 32px rgba(40, 24, 12, 0.07);
  --font: "Onest", "Segoe UI", sans-serif;
  --pad: clamp(20px, 3.5vw, 56px);

  /* расширения по макетам подбора (docs/mockups) */
  --panel: #1C1C1E;        /* тёмная панель: виджеты, блок рекомендаций */
  --panel-2: #2B2B2E;      /* карточка внутри тёмной панели */
  --panel-ink: #F5F5F7;    /* текст на тёмной панели */
  --price: #1F9D55;        /* цена товара (зелёный по макетам) */
  --price-soft: #E9F7EF;
  --badge: #FFD84D;        /* жёлтый бейдж «X% подходит» */
  --badge-ink: #4A3A00;

  --header-h: 72px;
}

/* ---------- Каркас страницы: подвал всегда прижат к низу ---------- */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main.container {
  flex: 1 0 auto;
  width: 100%;
  padding-top: 20px;
  padding-bottom: 40px;
}

/* Заголовок страницы + подзаголовок */
.page-head { margin: 8px 0 20px; }
.page-head h1 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin: 0;
}
.page-head .sub {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 60ch;
}

/* ---------- Кнопки (единые с лендингом) ---------- */

.btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
}
a.btn--accent, a.btn, a.btn-primary, a.btn--ghost, a.btn-ghost, a.btn--light { text-decoration: none; }
.btn:hover, .btn-primary:hover { background: #000; }
.btn:active, .btn-primary:active { transform: translateY(1px); }
.btn--accent, a.btn--accent {
  background: var(--accent);
  color: #fff;
}
.btn--accent:hover { background: var(--accent-dark); }
.btn--sm, .btn-primary.btn-sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 12px; }
.btn--light {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--light:hover { background: #f3f3f3; }
.btn--ghost, .btn-ghost {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn--ghost:hover, .btn-ghost:hover { color: var(--ink); border-color: #d8d6e0; background: #fff; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }

/* ---------- Шапка сервиса ---------- */

.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px var(--pad);
}
.site-header .logo {
  width: clamp(104px, 16vw, 140px);
}
.site-header .logo img { width: 100%; height: auto; }

/* центральный поиск */
.header-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 16px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.header-search:focus-within {
  border-color: var(--accent);
  background: #fff;
}
.header-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 8px 0;
}
.header-search input:focus { outline: none; }
.header-search button {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.header-search button:hover { background: var(--accent); }

/* правая часть: город + нав + аккаунт */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}
.city-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.city-chip svg { color: var(--accent); }

/* навигация-кнопки */
.sitenav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sitenav a {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sitenav a:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}
.sitenav a.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.auth-links { display: flex; align-items: center; gap: 8px; margin-left: 4px; }
.auth-links .btn--login {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.auth-links .btn-login:hover { background: var(--accent-dark); }
.auth-links .who {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-links .link-like {
  font-size: 0.82rem;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}
.auth-links .link-like:hover { color: var(--accent-dark); }

/* вторая строка шапки (нав) — на десктопе раскрывается, на мобиле панель бургера */
.header-navrow {
  display: none;
}
.burger {
  display: none;
}

/* ---------- Подвал (компактный) ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  margin-top: 0;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px var(--pad) 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px 32px;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  justify-self: start;
  font-size: 0.82rem;
}
.footer-logo { display: inline-block; flex: none; }
.footer-logo img { display: block; width: 132px; height: auto; }
.footer-brand .copy { color: var(--faint); }
.footer-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 22px;
  font-size: 0.84rem;
}
.footer-menu a { color: var(--muted); text-decoration: none; }
.footer-menu a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-supported {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}
.footer-supported .cap {
  font-size: 0.78rem;
  color: var(--faint);
}
.footer-supported img {
  height: 30px;
  width: auto;
  display: block;
  object-fit: contain;
}
.footer-supported a img:hover { opacity: 0.8; }

/* Кнопка-обводка (пустые состояния) */
.btn--outline {
  display: inline-block;
  padding: 12px 28px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  color: var(--accent);
  background: transparent;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.btn--outline:hover { background: var(--accent); color: #fff; }

/* Плашка «фильтры подставлены из Подбора» */
.ctx-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 0.88rem;
}
.ctx-note a { color: var(--accent); font-weight: 600; }

/* ---------- Пустые состояния ---------- */

.empty-state {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 24px auto 40px;
  max-width: 720px;
  box-shadow: var(--shadow);
}
.empty-state .es-icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.empty-state .es-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.empty-state p { margin: 0; max-width: 46ch; }
.empty-state .btn, .empty-state .btn--accent, .empty-state .btn-primary { margin-top: 14px; }

/* ---------- Адаптив ---------- */

@media (max-width: 1180px) {
  .city-chip .city-name { display: none; }
}

@media (max-width: 980px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }
  .header-search { display: none; }
  .header-nav { display: none; }
  .burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    order: 1;
  }
  .burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-header .logo { order: 2; }
  .header-right { order: 3; }
  .city-chip { display: none; }

  /* панель бургера: поиск + нав */
  .header-navrow {
    display: none;
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 14px var(--pad) 18px;
  }
  .header-navrow.open { display: block; }
  .header-navrow .header-search {
    display: flex;
    margin: 0 0 12px;
    max-width: none;
  }
  .header-navrow .sitenav {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .header-navrow .sitenav a {
    justify-content: center;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.95rem;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .footer-brand { align-items: center; justify-self: center; }
  .footer-supported { justify-self: center; flex-direction: column; align-items: center; gap: 10px; }
}

@media (max-width: 640px) {
  main.container { padding-top: 12px; }
  .auth-links .who { display: none; }
  .empty-state { padding: 36px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sitenav a, .btn, .btn-primary, .header-search button { transition: none; }
}

/* ---------- Каталог: раскладка, фильтры-аккордеоны, карточки ---------- */

.catalog-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.cat-side {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}

.avg-widget {
  background: var(--panel);
  color: var(--panel-ink);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.avg-widget .cap { margin: 0; color: #9a9aa2; font-size: 0.78rem; font-weight: 500; }
.avg-widget .val { margin: 6px 0 2px; font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 600; letter-spacing: -0.03em; color: #fff; }
.avg-widget .sub { margin: 0; color: #9a9aa2; font-size: 0.8rem; }

.cat-filters { display: flex; flex-direction: column; gap: 10px; }
.f-acc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.f-acc summary {
  cursor: pointer;
  padding: 13px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.f-acc summary::-webkit-details-marker { display: none; }
.f-acc summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex: none;
}
.f-acc[open] summary::after { transform: rotate(45deg); }
.f-acc summary:hover { color: var(--accent-dark); }
.f-body {
  padding: 2px 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.f-cap { font-size: 0.78rem; color: var(--faint); font-weight: 500; width: 100%; }
.f-tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  user-select: none;
}
.f-tile:hover { border-color: var(--accent); }
.f-tile input { position: absolute; opacity: 0; pointer-events: none; }
.f-tile:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.f-price input[type=number] {
  width: 84px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
}
.f-price .f-cap { width: auto; }
.f-reset {
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.f-reset:hover { color: var(--accent-dark); background: var(--accent-soft); }

/* карточка товара */
.product-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.pcard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.pcard:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.pcard__link { text-decoration: none; color: inherit; display: flex; flex-direction: column; flex: 1; }
.pcard__img {
  background: #fff;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.pcard__img img { width: 100%; height: 100%; object-fit: contain; }
.pcard__img svg { width: 46%; color: #c7c7d0; }
.pcard__body { padding: 12px 16px 6px; display: flex; flex-direction: column; gap: 7px; }
.pcard__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.pcard__specs {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pcard__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 16px;
  margin-top: auto;
}
.pcard__price {
  color: var(--price);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.pcard__buy {
  margin-left: auto;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.pcard__buy:hover { background: var(--accent); }
.pcard__fav {
  flex: none;
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.pcard__fav:hover { border-color: var(--accent); color: var(--accent); }
.pcard__fav.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 980px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .cat-side { position: static; }
  .avg-widget { display: flex; align-items: baseline; gap: 12px; padding: 14px 18px; }
  .avg-widget .val { margin: 0; font-size: 1.3rem; }
  .avg-widget .sub { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .pcard, .f-tile { transition: none; }
}

/* ---------- Карточка товара (этап 2, по макету 4) ---------- */

.pd-top {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 28px;
  align-items: start;
  margin: 14px 0 8px;
}
.pd-media {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  overflow: hidden;
  justify-content: center;
  padding: 28px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.pd-media img { width: 100%; height: 100%; object-fit: contain; }

/* Заглушка «фото уточняется» — для моделей без заводского снимка */
.pd-media__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--faint);
  text-align: center;
}
.pd-media__empty svg { width: 45%; max-width: 190px; opacity: .55; }
.pd-media__empty span {
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 240px;
}
.pd-media svg { width: 55%; color: #c7c7d0; }
.pd-stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pd-thumbs { display: flex; gap: 8px; overflow-x: auto; }
.pd-thumb {
  flex: none;
  width: 76px;
  height: 58px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.pd-thumb.is-on { border-color: var(--ink); }
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

.pd-info h1 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 8px 0 4px;
}
.match-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--badge);
  color: var(--badge-ink);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 10px 0 4px;
}
.match-badge__num { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.match-cta {
  display: inline-block;
  margin: 10px 0 4px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.match-cta:hover { background: #e4d2fb; }

.pd-price-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
}
.pd-price {
  color: var(--price);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  letter-spacing: -0.03em;
}
.pd-buy {
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 13px 28px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.pd-buy:hover { background: var(--accent); }

.feat-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feat-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
}
.feat-list li::before {
  content: '✓';
  flex: none;
  width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--yes-bg);
  color: var(--yes);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(3px);
}

.pd-section { margin-top: 26px; }
.pd-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.pd-edit {
  font-size: 0.82rem;
  color: var(--accent-dark);
  margin-left: 10px;
  font-weight: 500;
}
.pd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.pd-chip.ok { background: var(--accent-soft); color: var(--accent-dark); border-color: #ddc6fa; }
.pd-chip.no { background: var(--soft); color: var(--faint); border-color: var(--line); }

.offer-list { display: flex; flex-direction: column; gap: 8px; }
.offer-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.offer-row.best { border-color: var(--price); box-shadow: 0 0 0 1px var(--price) inset; }
.offer-row.out-of-stock { opacity: 0.6; }
.offer-row__who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; font-weight: 500; }
.offer-best {
  background: var(--price-soft);
  color: var(--price);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}
.offer-row__price { color: var(--price); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.offer-row__go {
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.offer-row__go:hover { background: var(--accent); }

@media (max-width: 980px) {
  .pd-top { grid-template-columns: 1fr; }
  .pd-media { position: static; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* Сравнение: победитель строки — фиолетовая ячейка, проигравшие — со стрелкой */
.cmp-best { background: var(--accent-soft) !important; color: var(--accent-dark); font-weight: 600; }
.cmp-mark { color: var(--price); font-weight: 700; margin-left: 6px; }
.cmp-arrow--bad { color: #b42318; font-size: 0.72rem; margin-left: 6px; }
.diff-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--accent);
  margin-left: 7px;
  vertical-align: middle;
}

/* Кнопка «в сравнение» на карточке каталога */
.pcard { position: relative; }
.pcard__cmpform { position: absolute; top: 10px; right: 10px; z-index: 5; }
.pcard__cmp {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pcard__cmp:hover { border-color: var(--accent); color: var(--accent); }
.pcard__cmp.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Опросник: раскладка + тёмная панель рекомендаций (этап 3) ---------- */

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.quiz-main { min-width: 0; }
.quiz-main .quiz-box { max-width: none; margin: 0; }

.qpanel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--panel-ink);
  position: sticky;
  top: calc(var(--header-h) + 16px);
  box-shadow: var(--shadow);
}
.qpanel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}
.qpanel__sub { margin: 4px 0 0; font-size: 0.78rem; color: #9a9aa2; }
.qpanel__card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--panel-2);
  border-radius: 14px;
  padding: 10px;
  margin-top: 10px;
  text-decoration: none;
  color: var(--panel-ink);
  transition: background 0.15s ease;
}
.qpanel__card:hover { background: #353539; }
.qpanel__img {
  flex: none;
  width: 64px; height: 52px;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qpanel__img img { width: 100%; height: 100%; object-fit: contain; }
.qpanel__img svg { width: 60%; color: #c7c7d0; }
.qpanel__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qpanel__name {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}
.qpanel__price { color: #4fd08a; font-weight: 700; font-size: 0.95rem; }
.qpanel__more {
  display: block;
  margin-top: 14px;
  color: #b9a0f5;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.qpanel__more:hover { color: #d3c1fb; }
.qpanel__empty {
  margin-top: 14px;
  border: 1px dashed #4a4a4e;
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  color: #9a9aa2;
  font-size: 0.85rem;
  line-height: 1.5;
}
.qpanel__empty span { font-size: 26px; display: block; margin-bottom: 6px; }

@media (max-width: 980px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .qpanel { position: static; }
}

/* ---------- Чат: аватары, приветствие, чипы-подсказки (этап 4) ---------- */

.msg { flex-direction: row; align-items: flex-end; gap: 10px; }
.msg.user { flex-direction: row-reverse; }
.msg__ava {
  width: 34px; height: 34px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.msg__ava img { width: 20px; height: 20px; }
.msg__ava--lg { width: 56px; height: 56px; }
.msg__ava--lg img { width: 32px; height: 32px; }
.msg__col { display: flex; flex-direction: column; max-width: min(82%, 580px); }
.msg.user .msg__col { align-items: flex-end; }

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 12px 18px;
  text-align: center;
}
.chat-welcome__name { margin: 0; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; }
.chat-welcome__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 46ch;
}

.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 9px 15px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

/* ---------- Toast сравнения (UC-05) ---------- */
.cmp-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  max-width: min(92vw, 480px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #1c1c1f;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 90;
}
.cmp-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* История завершённых подборов */
.quiz-history { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.quiz-history a {
  display: inline-block; padding: 10px 14px; border: 1px solid var(--line, #ececef);
  border-radius: 10px; color: var(--ink, #161616); text-decoration: none; font-size: 0.9rem;
}
.quiz-history a:hover { border-color: #A85CFF; color: #A85CFF; }

/* Узкие экраны (320-360px): шапка с двумя иконками и «Войти» не должна давать гор. скролл */
@media (max-width: 400px) {
  .header-inner { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .site-header .logo { max-width: 92px; }
  .header-right { gap: 4px; }
  .header-fav { width: 32px; height: 32px; }
  /* «Войти» переносим в бургер-панель (ссылка добавлена в navrow) */
  .auth-links { display: none; }
}

/* Таблица характеристик: не растягивает страницу на узких экранах */
.spec-table { table-layout: fixed; }
.spec-table td { overflow-wrap: anywhere; }
.spec-table th { overflow-wrap: anywhere; }
/* Разрываем «grid item ↔ таблица» на узких экранах: элемент разрешено сжимать */
.detail-grid > * { min-width: 0; }
.spec-table { max-width: 100%; }

/* Узкие экраны: строка предложения — цена и кнопка переносятся вниз */
@media (max-width: 480px) {
  .offer-row { grid-template-columns: 1fr; gap: 8px; }
  .offer-row__price { font-size: 1rem; }
  .offer-row__go { justify-self: start; }
}

/* Юридические документы: комфортная ширина строки */
.legal-doc { max-width: 860px; }
.legal-doc h1 { font-size: 1.5rem; line-height: 1.35; margin-bottom: 6px; }
.legal-doc p { margin: 0 0 12px; line-height: 1.65; color: var(--ink); }
.legal-doc h2 { font-size: 1.12rem; margin: 26px 0 10px; }
.legal-doc h1 { overflow-wrap: anywhere; }
