:root {
  --accent: #0b6efd;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e6e8eb;
  --bg: #f5f6f8;
  --gutter: 28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding-top: 10px;
  padding-bottom: 20px;
}

/* .brand-sub стоит абсолютно и не входит в высоту .brand — иначе выросшая
   с подписью шапка сбивает вертикальное центрирование лого относительно
   меню (было выровнено ровно, пока подписи не было). */
.brand { position: relative; display: inline-block; line-height: 1.15; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: .2px; color: var(--accent); }
.brand-sub {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}
.count { color: var(--muted); font-size: 14px; }

.tagline-band {
  background: linear-gradient(135deg, #eaf1ff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.page-tagline { padding: 22px var(--gutter) 20px; }
.page-tagline h1 {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.2px;
  color: var(--text);
}
@media (max-width: 640px) {
  .page-tagline h1 { font-size: 18px; }
}
.back { color: var(--accent); font-size: 14px; }

/* верхнее меню: инлайн-ссылки на десктопе, бургер + выпадашка на мобильном
   (так меню не занимает лишнее место на узких экранах) */
.topnav { display: flex; gap: 24px; }
.topnav a {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.topnav a:hover { color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-dropdown {
  position: absolute;
  top: 60px;
  right: var(--gutter);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 30;
}
.nav-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown a {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border-radius: 8px;
}
.nav-dropdown a:hover { background: var(--bg); }

@media (min-width: 701px) {
  .nav-dropdown { display: none; }
}
@media (max-width: 700px) {
  .topnav { display: none; }
  .nav-toggle { display: flex; }
  .topbar-inner { gap: 12px; }
}

.layout {
  padding-top: 4px;
  padding-bottom: 40px;
}

.static-page {
  padding: 32px var(--gutter) 60px;
  max-width: 720px;
}
.static-page h1 { font-size: 26px; margin-bottom: 16px; }
.static-page p { font-size: 15px; line-height: 1.6; color: var(--text); margin: 0 0 14px; }
.static-page-title { font-size: 26px; padding: 20px 0 0; margin: 0 0 4px; }

/* панель быстрого поиска (как у крупных агрегаторов) — основные селекторы
   сразу на виду, без модалки; НЕ прилипает — когда прокручивается за экран,
   роль быстрого доступа к фильтрам берёт на себя липкая .toolbar ниже */
.quicksearch-wrap { padding: 20px var(--gutter) 4px; }

.quicksearch {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.qs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 160px;
  min-width: 140px;
}
.qs-field label { font-size: 12px; font-weight: 600; color: var(--muted); }

.qs-field select,
.qs-range input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  width: 100%;
  min-width: 0;
}

.qs-price { flex: 1 1 200px; }
.qs-range { display: flex; gap: 8px; }

.qs-field select:disabled { background: #f2f3f5; color: var(--muted); cursor: not-allowed; }

.qs-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.qs-submit:hover { opacity: 0.9; }

@media (max-width: 700px) {
  .quicksearch { flex-direction: column; align-items: stretch; }
  .qs-field { flex: 1 1 auto; width: 100%; }
  .qs-submit { width: 100%; }
}

/* плавающая панель "Фильтры" + "Сортировка" (паттерн маркетплейсов) */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px var(--gutter);
  position: sticky;
  top: 60px;
  z-index: 9;
  background: var(--bg);
}

.tb-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.tb-btn:hover { border-color: var(--accent); }
.tb-count { color: var(--muted); font-weight: 500; }

.tb-clear {
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.tb-clear:hover { text-decoration: underline; }

.sort-form { margin: 0; }
.sort-select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%236b7280'/></svg>") no-repeat right 14px center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 32px 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  max-width: 220px;
}

/* затемнение под шторкой/модалкой */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.sheet-overlay.open { opacity: 1; visibility: visible; }

/* шторка с фильтрами: снизу на мобильном, плавающая панель у кнопки на десктопе */
.filter-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 21;
}
.filter-sheet.open { transform: translateY(0); }

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.sheet-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

.sheet-body { padding: 16px 20px; overflow-y: auto; }

.sheet-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.f-group { margin-bottom: 14px; }
.f-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.f-group select, .f-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}
.f-range { display: flex; gap: 8px; }
.f-range input { width: 50%; }
.f-group select:disabled { background: #f2f3f5; color: var(--muted); cursor: not-allowed; }

.btn-apply {
  flex: 1;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Модалка "войдите + подпишитесь", всплывает по клику на сердечко без входа —
   переиспользует .sheet-overlay из шторки фильтров (тот же затемняющий фон). */
.auth-prompt {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 90%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px 24px;
  text-align: center;
  z-index: 21;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
.auth-prompt.open { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.auth-prompt .sheet-close { position: absolute; top: 10px; right: 10px; }
.auth-prompt-icon { margin-bottom: 12px; }
.auth-prompt-icon svg {
  width: 34px;
  height: 34px;
  fill: #e0245e;
  stroke: #e0245e;
  stroke-width: 1.5;
}
.auth-prompt p { font-size: 14px; line-height: 1.5; color: var(--text); margin: 0 0 18px; }
.auth-prompt .btn-apply { display: block; width: 100%; text-decoration: none; box-sizing: border-box; }
.btn-reset {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
}

@media (min-width: 801px) {
  .filter-sheet {
    left: auto;
    right: 20px;
    bottom: auto;
    top: 116px;
    width: 360px;
    max-width: 360px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
  }
  .filter-sheet.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }

.card-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;      /* фикс. пропорция — высота карточек в сетке не пляшет */
  background: #eee;
  overflow: hidden;
  border-radius: 12px 12px 0 0; /* верхние углы карточки — контейнер их обрезает сам */
}

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.fav-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #8b95a1;
  stroke-width: 2.4;
  stroke-linejoin: round;
  transition: fill 0.15s ease, stroke 0.15s ease, transform 0.15s ease;
}
.fav-btn:hover svg { stroke: #e0245e; transform: scale(1.08); }
.fav-btn.active svg { fill: #e0245e; stroke: #e0245e; }
.fav-btn:active svg { transform: scale(0.9); }

/* Горизонтальные/квадратные фото с cover+center выглядят хорошо почти всегда
   (машина по горизонтали снята центрированно). Вертикальные (с телефона) —
   ровно наоборот: машина там обычно НИЖЕ центра кадра, сверху лишний запас
   неба/двора, и центр кадра резал капот/крышу. Единый object-position для
   обоих случаев работать не может — поэтому ориентацию каждого конкретного
   фото определяем в браузере на onload (naturalWidth/naturalHeight) и для
   вертикальных сдвигаем точку фокуса вниз кадра (см. inline onload в
   _card.html); для горизонтальных остаётся дефолтный center.
   Не хранит это в БД — задаётся на клиенте, работает сразу для всех фото. */
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.no-photo {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  background: repeating-linear-gradient(
    135deg, #eef0f3, #eef0f3 10px, #e6e9ed 10px, #e6e9ed 20px
  );
}
.no-photo svg { width: 30px; height: 30px; opacity: .55; }
.no-photo span {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 160px;
}

.card-body { padding: 12px; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.card-specs span {
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 7px;
}
.card-price { font-size: 17px; font-weight: 700; }
.card-city { font-size: 12px; color: var(--muted); margin-top: 4px; }
.card-date { font-size: 12px; color: var(--muted); }

.empty { color: var(--muted); padding: 40px 0; grid-column: 1 / -1; text-align: center; }

.grid-loader {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card-body { padding: 8px; }
  .card-title { font-size: 13px; margin-bottom: 4px; }
  .card-specs { font-size: 11px; gap: 4px; margin-bottom: 6px; }
  .card-price { font-size: 15px; }
  .card-city, .card-date { font-size: 11px; }
}

/* detail page */
.detail {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  padding-top: 24px;
  padding-bottom: 60px;
}

.gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #eee;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }

.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.detail-info {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  align-self: start;
}
.detail-info h1 { font-size: 22px; margin: 0; }
.detail-city { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 4px; }
.detail-fav-btn { position: static; flex-shrink: 0; background: var(--bg); }

.specs-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.specs-table td { padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--bg); }
.specs-table td:first-child { color: var(--muted); width: 50%; }
.specs-table td:last-child { font-weight: 600; text-align: right; }

.detail-price { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.detail-phone { font-size: 16px; font-weight: 600; margin-bottom: 14px; }

.phone-gate {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}
.phone-gate p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.gate-btn { display: inline-block; width: auto; padding: 8px 16px; margin-right: 10px; }
.gate-recheck { display: inline-block; margin-top: 0; font-size: 13px; }

.autoteka-link {
  display: inline-block;
  margin-bottom: 16px;
  padding: 8px 14px;
  background: #eef4ff;
  color: var(--accent);
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}

.detail-text {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.login-wrap { display: flex; justify-content: center; padding-top: 60px; }
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  max-width: 420px;
  text-align: center;
}
.login-card h1 { font-size: 20px; margin: 0 0 12px; }
.login-card p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-btn { display: inline-block; width: auto; padding: 10px 24px; margin: 14px 0; }
.login-status { font-size: 13px; }

@media (max-width: 800px) {
  .detail { grid-template-columns: 1fr; }
}


/* ===== страница "Откуда здесь тачки?" ===== */
.about-page { padding: 32px var(--gutter) 8px; max-width: 900px; }
.about-page h1 { font-size: 28px; margin: 0 0 12px; }
.about-page h2 { font-size: 22px; margin: 0 0 18px; }
.about-lead { font-size: 16px; line-height: 1.6; color: var(--text); max-width: 700px; margin: 0 0 28px; }

.about-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.about-feature {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.about-feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #eaf1ff;
  color: var(--accent);
  margin-bottom: 12px;
}
.about-feature-icon svg { width: 22px; height: 22px; }
.about-feature h3 { font-size: 15px; margin: 0 0 6px; }
.about-feature p { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin: 0; }

.about-qa {
  display: grid;
  gap: 14px;
  margin-bottom: 36px;
}
.about-qa-item {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 16px 18px;
}
.about-qa-item h3 { font-size: 15px; margin: 0 0 6px; }
.about-qa-item p { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0; }

.about-roadmap {
  background: linear-gradient(135deg, #eaf1ff 0%, var(--bg) 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
}
.roadmap-items { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.roadmap-item { display: flex; gap: 12px; align-items: flex-start; }
.roadmap-icon {
  flex: none;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.roadmap-icon svg { width: 20px; height: 20px; }
.roadmap-item h3 { font-size: 15px; margin: 0 0 4px; }
.roadmap-item p { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin: 0; }

/* блок продукта "Помощник перекупа" — визуально отделён цветным фоном */
.product-band { background: #10182b; margin-top: 8px; }
.product-page { padding: 44px var(--gutter) 52px; max-width: 1040px; }
.product-header { text-align: center; margin-bottom: 30px; }
.product-eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7fb2ff;
  background: rgba(127, 178, 255, .12);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.product-header h2 { color: #fff; font-size: 24px; margin: 0; max-width: 640px; margin: 0 auto; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.product-card {
  background: #171f36;
  border: 1px solid #2a3452;
  border-radius: 16px;
  padding: 22px;
}
.product-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(127, 178, 255, .14);
  color: #7fb2ff;
  margin-bottom: 12px;
}
.product-card-icon svg { width: 22px; height: 22px; }
.product-card h3 { color: #fff; font-size: 15.5px; margin: 0 0 8px; }
.product-card p { color: #a9b3cc; font-size: 13.5px; line-height: 1.6; margin: 0; }

.product-cta {
  display: block;
  width: fit-content;
  margin: 0 auto;
  text-decoration: none;
  padding: 14px 32px;
}

.about-channels { padding: 32px var(--gutter) 60px; max-width: 900px; }
.about-channels h2 { font-size: 20px; margin: 0 0 16px; }
.channel-links { display: flex; gap: 12px; flex-wrap: wrap; }
.channel-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px 10px 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  transition: box-shadow .15s, transform .15s;
}
.channel-link:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-1px); }
.channel-link svg { width: 30px; height: 30px; flex: none; }

@media (max-width: 800px) {
  .about-features { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .roadmap-items { grid-template-columns: 1fr; }
  .about-page h1 { font-size: 24px; }
  .product-header h2 { font-size: 20px; }
}
