:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e2e2e2;
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --accent: #1a1a1a;
  --ok: #1f7a3d;
  --warn: #b5651d;
  --red: #e4002b;
  --red-hover: #d13636;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; }

.site-header {
  background: #0d0d0d;
  color: #fff;
}
.site-header__bar {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
/* height задаёт размер, width: auto держит пропорции 3.8:1 при любой высоте. */
.logo__img {
  height: 28px;
  width: auto;
  display: block;
}
.logo__img--footer { height: 32px; }
.logo__suffix { font-weight: 400; font-size: 14px; color: #9a9a9a; }

.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav__link {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.site-nav__link--btn { text-transform: none; font-weight: 400; opacity: 0.8; }
.site-nav__link--btn:hover { opacity: 1; }
.site-nav__user { font-size: 13px; color: #cfcfcf; }

.site-nav__dropdown { position: relative; }
.site-nav__dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: #fff;
  color: var(--text);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  min-width: 150px;
  padding: 6px 0;
  z-index: 20;
}
/* Невидимый мостик, закрывающий зазор между кнопкой и меню. Без него курсор
   на пути вниз попадает в пустоту, :hover слетает и меню закрывается раньше,
   чем до него дотянешься. Ширину берём с запасом — меню шире кнопки. */
.site-nav__dropdown-menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}
.site-nav__dropdown:hover .site-nav__dropdown-menu,
.site-nav__dropdown:focus-within .site-nav__dropdown-menu { display: block; }
.site-nav__dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
}
.site-nav__dropdown-menu a:hover { background: var(--bg-alt); }

.site-search { flex: 1; max-width: 320px; display: flex; align-items: center; position: relative; }
.site-search__input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #3a3a3a;
  color: #fff;
  padding: 6px 24px 6px 4px;
  font-size: 13px;
}
.site-search__input::placeholder { color: #8a8a8a; }
.site-search__input:focus { outline: none; border-color: #fff; }
.site-search__btn {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
}
.site-search__btn svg { width: 100%; height: 100%; fill: currentColor; }

/* Телефон в шапке: прижат вправо, звёздочка идёт сразу за ним. */
.site-phone {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.site-phone svg { width: 15px; height: 15px; flex-shrink: 0; }
.site-phone:hover { color: var(--red); }

.site-fav {
  position: relative;
  color: #fff;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.site-fav svg { width: 100%; height: 100%; }
.site-fav__count {
  position: absolute;
  top: -7px;
  right: -9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 999px;
}

@media (max-width: 860px) {
  .site-header__bar { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .site-search { order: 3; max-width: none; flex-basis: 100%; }
  /* На телефоне в строке ещё поиск, телефон и звёздочка — логотип уменьшаем,
     иначе он вытесняет остальное. */
  .logo__img { height: 24px; }
  /* На узком экране номер целиком не помещается рядом с поиском — остаётся
     трубка, по которой так же можно позвонить. */
  .site-phone span { display: none; }
  .site-phone svg { width: 20px; height: 20px; }
}

.price-banner {
  background: var(--bg-alt);
  color: var(--muted);
  text-align: center;
  padding: 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.page { max-width: 1200px; margin: 0 auto; padding: 32px; }

/* Блоки "Поиск по автомобилю" / "Поиск дисков" на главной */
.search-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 0 32px;
}
@media (max-width: 800px) {
  .search-hero { grid-template-columns: 1fr; padding: 0 16px; }
}

.search-box {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  padding: 28px;
}
.search-box--car {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 26px),
    linear-gradient(160deg, #1c1c1c, #0d0d0d);
  color: #fff;
}
.search-box--wheel {
  background: var(--bg-alt);
  color: var(--text);
}

.search-box__title {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.search-box__underline { width: 70px; height: 3px; background: var(--red); margin-bottom: 22px; }
.search-box__hint { margin: 10px 0 0; font-size: 13px; color: rgba(255,255,255,0.6); }

.search-box__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.search-box__grid .btn--accent { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 3px;
}
.search-field__num {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-alt);
  border-radius: 3px;
}
.search-field select {
  width: 100%;
  border: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23e4002b' d='M5 7l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 14px center/12px;
  border-radius: 3px;
  padding: 16px 34px 16px 42px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  appearance: none;
  cursor: pointer;
}
.search-field select:disabled { color: #b3b3b3; cursor: not-allowed; }

.search-box__stack { display: flex; flex-direction: column; gap: 10px; }
.search-box__stack select {
  background:
    #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23e4002b' d='M5 7l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 16px center/12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px 34px 16px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  appearance: none;
  cursor: pointer;
}

.search-box__wheel-icon {
  position: absolute;
  right: -18px;
  top: -18px;
  width: 130px;
  height: 130px;
  color: #d8d8d8;
}
.search-box__wheel-icon svg { width: 100%; height: 100%; }

.btn--accent {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 15px 26px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}
.btn--accent:hover { background: var(--red-hover); }

.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 28px 32px;
  align-items: start;
}
/* Ячейка грида по умолчанию не сжимается уже своего содержимого
   (min-width: auto), поэтому строка инструментов над каталогом — поиск,
   счётчик, переключатель вида, сортировка в один ряд — распирала колонку
   до 730px даже на экране 375px. Правая часть уезжала за край, и каталог
   выглядел неадаптированным. min-width: 0 разрешает колонке ужиматься. */
.catalog-main { min-width: 0; }

.filters {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  position: sticky;
  top: 16px;
}
.filters h2 { margin: 0 0 12px; font-size: 16px; }

.filter-group { margin-bottom: 14px; }
.filter-group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 6px;
}
.filter-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* Цена "от — до" */
.filter-range { display: flex; align-items: center; gap: 6px; }
.filter-range__dash { color: var(--muted); }
.filter-input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.filter-input:focus { outline: none; border-color: var(--accent); }
/* Стрелки-крутилки в поле цены только мешают: шаг в 100 ₽ мелкий, а место
   они занимают и провоцируют случайный клик. */
.filter-input::-webkit-outer-spin-button,
.filter-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.filter-input[type='number'] { -moz-appearance: textfield; appearance: textfield; }

.btn {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn--ghost { width: 100%; background: none; }

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.search-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.results-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
#sort { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.card-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #9a9a9a;
  cursor: pointer;
}
.card-fav svg { width: 100%; height: 100%; }
.card-fav.is-active { color: var(--red); border-color: var(--red); }
.card-fav.is-active svg path { fill: var(--red); }
.card-photo {
  aspect-ratio: 1;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7c7c7;
}
.card-photo svg { width: 55%; height: 55%; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-size: 14px; margin: 0; font-weight: 600; }
.card-specs { font-size: 12px; color: var(--muted); }
.card-finish { font-size: 12px; color: var(--muted); }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.tag--ok { background: #eaf6ee; color: var(--ok); }
.tag--muted { background: var(--bg-alt); color: var(--muted); }
.tag--warn { background: #fbeee0; color: var(--warn); }
.tag--info { background: #eaf1fb; color: #2a5fa5; }
.card-price-group { margin-top: auto; display: flex; flex-direction: column; }
.card-price { font-size: 12px; color: var(--muted); font-style: italic; }
.card-price--value { font-size: 15px; font-weight: 700; color: var(--text); font-style: normal; }
.card-price-type { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; font-style: italic; color: var(--muted); }
.card-price--wholesale { margin-top: 6px; color: var(--ok); }

.empty-state { text-align: center; color: var(--muted); padding: 60px 0; }
.load-more-wrap { display: flex; justify-content: center; margin-top: 24px; }

@media (max-width: 800px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}

/* 760px хватало, пока в админке были только карточки статуса и список
   пользователей. Таблица заявок с составом в такую ширину не помещается —
   расширяем страницу, а карточки и формы держим узкими: читать сплошной
   текст на всю ширину экрана неудобно. */
.admin-page { max-width: 1200px; }
.admin-page > .admin-card,
.admin-page > .admin-banner,
.admin-page > form:not(.admin-form),
.admin-page > p.admin-hint { max-width: 760px; }
.admin-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 20px 0;
  background: var(--bg-alt);
}
.admin-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: none; }
.admin-label { color: var(--muted); }
.admin-value { font-weight: 600; text-align: right; }
.admin-value--ok { color: var(--ok); }
.admin-value--warn { color: var(--warn); }
.admin-value--error { color: #b3261e; }
.admin-hint { color: var(--muted); font-size: 13px; }
.admin-banner { padding: 10px 16px; border-radius: 6px; margin: 16px 0; font-size: 14px; }
.admin-banner--ok { background: #eaf6ee; color: var(--ok); }
.admin-banner--error { background: #fbeaea; color: #b3261e; }
.admin-button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
}
.admin-button:hover { opacity: 0.9; }
.admin-button--ghost {
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 13px;
}

/* Пользователи в админке */
.admin-section { margin-top: 44px; }

/* Телефон занимает всю строку, под ним две скидки рядом — литые и кованые
   читаются как пара. Колонки одинаковой ширины, чтобы поля выглядели
   одинаково: разная ширина намекала бы на разную значимость. */
.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  align-items: end;
}
.admin-form .admin-field:first-child { grid-column: 1 / -1; }
.admin-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.admin-field--wide { grid-column: 1 / -1; }
.admin-field span { color: var(--muted); }
.admin-field input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}
.admin-field input:focus { outline: none; border-color: var(--accent); }
.admin-form .admin-button { grid-column: 1 / -1; justify-self: start; }

/* Выданные доступы: пароль показывается ровно один раз, поэтому крупно и
   моноширинным — чтобы не перепутать символы при пересылке. */
.admin-creds { margin: 10px 0; border-collapse: collapse; }
.admin-creds th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  padding: 3px 16px 3px 0;
}
.admin-creds code { font-size: 15px; color: var(--text); }
.admin-creds__password { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.admin-copy-status { margin-left: 10px; font-size: 13px; color: var(--muted); }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
.admin-table th,
.admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--muted); font-weight: 400; }
.admin-table__note { color: var(--muted); }
.admin-table td { vertical-align: middle; }
.admin-table__actions { white-space: nowrap; }

/* Таблица заявок. В отличие от списка пользователей, здесь длинный текст:
   состав заявки и комментарий покупателя. Поэтому строки не в одну линию,
   а с переносом, и колонка с заявкой ограничена по ширине — иначе она
   растягивает таблицу и «Итого» уезжает за край. */
.admin-table--orders td { vertical-align: top; white-space: normal; }
.admin-table__order { max-width: 520px; min-width: 320px; }
.admin-table__total { white-space: nowrap; font-weight: 600; }
/* Состав заявки: позиции списком, каждая ссылкой на карточку товара. */
.admin-items { margin: 0; padding: 0; list-style: none; }
.admin-items li { padding: 2px 0; line-height: 1.45; }
.admin-items a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.admin-items a:hover { color: var(--red); border-color: currentColor; }

/* Миниатюры фотографий, приложенных к заявке. */
.admin-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.admin-photos img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 3px;
  display: block;
}


/* Действия прямо в строке таблицы: форма не должна ломать раскладку ячейки,
   поэтому inline-flex и никаких внешних отступов. */
.admin-inline { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.admin-inline + .admin-inline { margin-left: 6px; }
.admin-inline__input {
  width: 58px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  text-align: right;
}
.admin-inline__input:focus { outline: none; border-color: var(--accent); }
/* Два поля скидки подряд: литые / кованые. */
.admin-inline__input { width: 52px; }
.admin-inline__sep { color: var(--muted); }

.admin-mini {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.admin-mini:hover { border-color: var(--accent); }
/* Удаление необратимо — цветом отделяем его от безобидных кнопок. */
.admin-mini--danger { color: #b3261e; border-color: #f0c4c0; }
.admin-mini--danger:hover { background: #fbeaea; border-color: #b3261e; }

/* Окно подтверждения */
.modal-card--confirm { max-width: 460px; }
.confirm-text { margin: 0 0 20px; font-size: 15px; line-height: 1.5; }
.confirm-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .admin-form { grid-template-columns: 1fr; }
}

.logout-form { display: inline; margin: 0; }

/* Футер */
.site-footer { background: #0d0d0d; color: #cfcfcf; margin-top: 48px; }
.site-footer__inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 36px 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}
.site-footer__tagline { margin: 8px 0 0; font-size: 13px; color: #8a8a8a; }
/* Подвал тёмный (#0d0d0d), поэтому телефон белый, а не var(--text) —
   тот почти чёрный и на этом фоне не читался. */
.site-footer__phone {
  display: inline-block;
  margin-top: 12px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.site-footer__phone:hover { color: var(--red); }
.site-footer__contacts { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.site-footer__contacts a { color: var(--muted); margin-right: 14px; }
.site-footer__links { display: flex; gap: 20px; align-items: flex-start; }
.site-footer__links a { color: #cfcfcf; text-decoration: none; font-size: 13px; }
.site-footer__links a:hover { color: #fff; }
.site-footer__bottom {
  border-top: 1px solid #262626;
  padding: 16px 32px;
  font-size: 12px;
  color: #7a7a7a;
  text-align: center;
  /* Копирайт и подпись разработчика в одну строку по центру, а на узком
     экране переносятся друг под друга. */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
}
/* Подпись не должна спорить с копирайтом за внимание — тот же приглушённый
   цвет, подчёркивание появляется при наведении. */
.site-footer__author { color: inherit; text-decoration: none; }
.site-footer__author:hover { color: #cfcfcf; text-decoration: underline; }

/* Модалка входа */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,13,13,0.6);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay:not([hidden]) { display: flex; }
body.modal-open { overflow: hidden; }
.modal-card {
  background: #fff;
  border-radius: 6px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}
.modal-title { margin: 0 0 20px; font-size: 18px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.modal-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.modal-hint { margin: 0; font-size: 12px; color: var(--muted); }
.modal-error { margin: 0; font-size: 13px; color: #b3261e; }
.modal-submit { align-self: flex-start; }

/* Хлебные крошки */
.breadcrumbs {
  max-width: 1300px;
  margin: 0 auto;
  padding: 14px 32px 0;
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs span { margin: 0 4px; }

/* Вкладки сайдбара фильтров: "По параметрам" / "По автомобилю" */
.filters__head { display: none; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.filters__close { background: none; border: none; font-size: 22px; cursor: pointer; line-height: 1; }
.filters__tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.filters__tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.filters__tab.is-active { color: var(--text); border-color: var(--red); }
.filters__panel { display: none; }
.filters__panel.is-active { display: block; }

.search-box__grid--plain { grid-template-columns: 1fr; gap: 10px; }
.search-field--plain { background: var(--bg-alt); }
.search-field--plain select {
  background:
    var(--bg-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23e4002b' d='M5 7l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 14px center/12px;
}
.search-box__hint--dark { color: var(--muted); }

.filters__open { display: none; }

/* Переключатель сетка/список */
.view-toggle { display: flex; gap: 4px; }
.view-toggle__btn {
  width: 30px;
  height: 30px;
  padding: 6px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  color: #b3b3b3;
  cursor: pointer;
}
.view-toggle__btn svg { width: 100%; height: 100%; fill: currentColor; }
.view-toggle__btn.is-active { color: var(--text); border-color: var(--text); }

/* Список: цена — отдельная колонка фиксированной ширины, а не последний
   элемент во flex-строке — иначе её позиция зависит от длины остального
   содержимого карточки (finish, число тегов и т.п.) и "плывёт" от строки
   к строке. */
.product-grid--list { grid-template-columns: 1fr; }
.product-grid--list .card-link { flex-direction: row; }
.product-grid--list .card-photo { width: 160px; aspect-ratio: auto; flex-shrink: 0; }
.product-grid--list .card-body {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 150px;
  column-gap: 20px;
  align-items: center;
}
.product-grid--list .card-title,
.product-grid--list .card-specs,
.product-grid--list .card-finish,
.product-grid--list .card-tags {
  grid-column: 1;
}
.product-grid--list .card-price-group {
  grid-column: 2;
  grid-row: 1 / -1;
  margin: 0 38px 0 0;
  align-self: center;
  justify-self: end;
  text-align: right;
}
/* В списке звезда сидит по центру справа от всей строки, а не поверх
   цены — иначе на узкой колонке цены она перекрывает цифры. */
.product-grid--list .card-fav {
  top: 50%;
  transform: translateY(-50%);
  right: 12px;
}

@media (max-width: 800px) {
  .filters__open { display: inline-block; }
  .filters {
    position: fixed;
    inset: 0;
    z-index: 90;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.2s;
    border-radius: 0;
    /* На десктопе панель стоит в потоке и фон ей не нужен, а развёрнутая
       на весь экран без фона она прозрачная — сквозь фильтры видно
       каталог. Плюс запас снизу, чтобы кнопка "Сбросить" не пряталась
       под панелью навигации браузера. */
    background: var(--bg);
    border: none;
    padding-bottom: 40px;
    -webkit-overflow-scrolling: touch;
  }
  .filters.is-open { transform: translateX(0); }
  .filters__head { display: flex; }
}

/* Страница товара */
.product-layout {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 32px 48px;
  display: grid;
  grid-template-columns: 380px 1fr 320px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 1100px) {
  .product-layout { grid-template-columns: 1fr; }
}

.product-gallery__main {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-alt);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* Без padding и с cover — фото занимает плитку целиком, без светлой рамки
   по краям (подложка видна только у совсем непропорциональных снимков). */
.product-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
}
.product-gallery__placeholder { width: 55%; height: 55%; color: #c7c7c7; }
.product-gallery__fav { top: 12px; right: 12px; width: 36px; height: 36px; padding: 8px; }
.product-gallery__count {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.product-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.product-gallery__thumb {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
}
.product-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-gallery__thumb:hover { border-color: var(--muted); }
.product-gallery__thumb.is-active { border-color: var(--red); border-width: 2px; }

/* Заявка: звонок / WhatsApp / MAX (views/partials/order-buttons.ejs) */
/* ── Форма заявки ──────────────────────────────────────────────
   Одна и та же на карточке товара, в избранном и в калькуляторе. В
   калькуляторе она стоит на тёмном фоне — цвета там переопределяются
   (см. .calc-modal .order-box), поэтому здесь всё через переменные темы. */
.order-box {
  margin: 20px 0 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-alt);
}
.order-box[hidden] { display: none; }
.order-box__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.order-box__title { font-size: 15px; font-weight: 700; }
.order-box__hint { font-size: 12px; color: var(--muted); }

.order-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.order-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.order-field--wide { grid-column: 1 / -1; }
.order-field__label { font-size: 12px; color: var(--muted); }
.order-field__opt { color: var(--muted); opacity: 0.75; }

.order-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.order-input:focus-visible { outline: 2px solid var(--red); outline-offset: -1px; }
.order-input--area { resize: vertical; min-height: 42px; }
.order-select {
  appearance: none;
  background:
    #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23e4002b' d='M5 7l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 12px center/12px;
  padding-right: 32px;
  cursor: pointer;
}

.order-consent {
  grid-column: 1 / -1;
  display: flex;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.order-consent input { margin-top: 2px; flex-shrink: 0; }

.order-submit { grid-column: 1 / -1; width: 100%; }
.order-status { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.order-status--ok { color: var(--ok); }
.order-status--error { color: #b3261e; }

.order-box__phone { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.order-box__phone a { color: var(--text); font-weight: 700; text-decoration: none; }
.order-box__phone a:hover { color: var(--red); }

/* Просмотр фото во весь экран. Оверлей лежит в конце <body> и по умолчанию
   скрыт через [hidden], поэтому не мешает разметке страницы. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 34px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }
.lightbox__nav[hidden] { display: none; }
.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}
.lightbox__counter[hidden] { display: none; }
@media (max-width: 640px) {
  .lightbox { padding: 12px; }
  .lightbox__close { top: 8px; right: 8px; }
  .lightbox__nav { width: 40px; height: 40px; font-size: 28px; }
  .lightbox__nav--prev { left: 6px; }
  .lightbox__nav--next { right: 6px; }
}

.product-title { font-size: 20px; text-transform: uppercase; margin: 0 0 16px; line-height: 1.35; }
.product-price { font-size: 28px; font-weight: 700; }
.product-price--none { font-size: 18px; color: var(--muted); font-weight: 400; }
.product-price__type { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.product-price__hint { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.product-variants { margin: 20px 0; }
.product-variants label { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.product-variants select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--red);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  background: #fff;
  cursor: pointer;
}

.spec-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.spec-table tr { border-bottom: 1px solid var(--border); }
.spec-table th, .spec-table td { text-align: left; padding: 10px 0; font-size: 14px; font-weight: 400; }
.spec-table th { color: var(--muted); width: 60%; }
.spec-table td { font-weight: 600; }

.product-description { font-size: 14px; line-height: 1.6; color: var(--text); }
.product-description h2 { font-size: 15px; text-transform: uppercase; margin: 0 0 12px; }
.product-description p { margin: 0 0 16px; }

/* ===================================================================
   Телефоны и планшеты
   ===================================================================
   Каталог смотрят в основном с телефона, поэтому правки здесь не
   косметические: без них страница товара и фильтры неудобны в работе.
   Точки перелома выше по файлу (860/800/640) решают раскладку блоков —
   этот блок добирает то, что от неё не зависит. */

/* Горизонтальной прокрутки у страницы быть не должно ни при каких
   обстоятельствах: длинная строка параметров или широкая таблица иначе
   растягивают весь макет, и заголовки уезжают за край экрана. */
/* Только на html: у body тот же overflow-x делает его контейнером
   прокрутки, и любой position: sticky внутри (например «Итого» в
   калькуляторе) перестаёт прилипать. Значение с html и так переносится
   на область просмотра, так что горизонтальной прокрутки не будет. */
html { overflow-x: hidden; }
img { max-width: 100%; }
/* Названия вроде "KO-901-241123-006" не имеют пробелов и на узком экране
   вылезают за карточку — разрешаем перенос по буквам. */
.card-title, .product-title, .card-specs, .breadcrumbs { overflow-wrap: anywhere; }

@media (max-width: 800px) {
  /* 32px по бокам на экране 360px съедают пятую часть ширины. */
  .page { padding: 20px 16px; }
  .product-layout { padding: 16px 16px 36px; gap: 24px; }
  .site-footer__inner { padding: 28px 16px; }
  .catalog-head { padding: 0 16px; }
  .catalog-layout { padding: 20px 16px; gap: 16px; }

  /* Панель над каталогом в два ряда: поиск занимает всю ширину, под ним —
     кнопка фильтров, счётчик, вид и сортировка. В одну строку они на
     телефоне не помещаются. */
  .catalog-toolbar { flex-wrap: wrap; gap: 10px; }
  .catalog-toolbar .search-input { flex-basis: 100%; order: -1; }
  .catalog-toolbar select { flex: 1; min-width: 0; }
  .results-count { font-size: 13px; }

  /* Плитка в две колонки вместо одной: карточки мелкие, но список
     пролистывается вдвое быстрее — так устроены все каталоги на телефоне. */
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card-title { font-size: 13px; }
  .card-specs { font-size: 11px; }
  .card-price--value { font-size: 16px; }

  /* Режим "списком". Десктопная раскладка тут не годится: фото 160px плюс
     колонка цены 150px не оставляют места под текст на экране 375px —
     название и характеристики схлопывались в пустоту. На телефоне
     раскладываем в один столбец: фото поменьше слева, весь текст справа
     обычным потоком, цена под характеристиками. */
  .product-grid--list { grid-template-columns: 1fr; }
  /* В списке диск показываем целиком: строка узкая, и cover срезал бы у
     фотографии верх и низ — от диска оставалась бы средняя полоса.
     Квадратная пропорция нужна, чтобы contain вписывал снимок в понятную
     рамку, а не в растянутый по высоте карточки блок. */
  .product-grid--list .card-photo {
    width: 110px;
    aspect-ratio: 1;
    align-self: center;
  }
  .product-grid--list .card-photo img { object-fit: contain; }
  .product-grid--list .card-body {
    display: flex;
    flex-direction: column;
    /* Иначе строки центрируются по горизонтали — это наследие десктопной
       раскладки, где тело карточки было гридом с align-items: center. */
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 10px 42px 10px 12px; /* справа — место под звёздочку */
  }
  .product-grid--list .card-price-group {
    grid-column: auto;
    grid-row: auto;
    margin: 4px 0 0;
    /* Сбрасываем выравнивание из десктопной раскладки, где цена стояла
       отдельной колонкой справа и центрировалась по высоте строки. */
    align-self: flex-start;
    justify-self: start;
    text-align: left;
  }
  .product-grid--list .card-fav { top: 8px; right: 8px; transform: none; }

  /* Палец — не курсор: по звёздочке в углу карточки нужно попадать без
     прицеливания. */
  .card-fav { width: 36px; height: 36px; padding: 8px; }

  .product-title { font-size: 17px; }
  .product-price { font-size: 24px; }
  .spec-table th, .spec-table td { font-size: 13px; padding: 8px 0; }
}

@media (max-width: 560px) {
  /* Форма заявки в одну колонку: два поля в ряд на узком экране оставляют
     от подписи «Как связаться» пару букв. */
  .order-form { grid-template-columns: 1fr; }

  /* Миниатюры галереи: 4 в ряд превращаются в марки, 3 ещё различимы. */
  .product-gallery__thumbs { grid-template-columns: repeat(3, 1fr); }

  .modal-card { padding: 24px 20px; }

  /* Таблица пользователей в админке шире экрана — даём ей прокручиваться
     внутри себя, а не растягивать страницу. */
  .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
  .admin-table--orders td { white-space: normal; }
  .admin-table__order { max-width: 260px; }
  .admin-page { padding: 20px 16px; }
}

/* iPhone увеличивает страницу, когда фокус попадает в поле с текстом мельче
   16px, и обратно уже не отдаляет — каталог остаётся в увеличенном виде.
   Поэтому на мобильных у всех полей ввода ровно 16px; на десктопе прежние
   размеры, там проблемы нет. */
@media (max-width: 800px) {
  .site-search__input,
  .search-input,
  .filter-select,
  .filter-input,
  .search-field select,
  .search-box__stack select,
  .product-variants select,
  .modal-form input,
  .admin-field input,
  .order-input,
  select,
  textarea,
  input[type='text'],
  input[type='tel'],
  input[type='search'],
  input[type='number'],
  input[type='password'] {
    font-size: 16px;
  }
}

/* Совсем узкие экраны (iPhone SE и бюджетные Android, 360px и меньше).
   Здесь в шапке уже не помещается всё сразу — убираем то, без чего можно
   обойтись, чтобы строка не разъезжалась на три яруса. */
@media (max-width: 480px) {
  .site-header__bar { gap: 10px; padding: 12px; }
  /* "· диски" рядом с логотипом — украшение; название магазина и так на
     картинке. */
  .logo__suffix { display: none; }
  .logo__img { height: 22px; }
  .site-nav { gap: 14px; }
  .site-nav__link { font-size: 12px; }

  .search-box { padding: 20px 16px; }
  .search-box__title { font-size: 22px; }
  /* Поля подбора по автомобилю в один столбец: вдвоём в ряд у них остаётся
     по 140px на "Выберите марку" — название модели туда не помещается. */
  .search-box__grid { grid-template-columns: 1fr; }

  .page { padding: 16px 12px; }
  .product-layout { padding: 12px 12px 32px; }
  .product-grid { gap: 8px; }
}

/* Страница подбора по автомобилю (/fitment/:id) */
.fitment-page { max-width: 1200px; }

.fitment-title { font-size: 26px; margin: 0 0 20px; }
.fitment-title__sub {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
}

/* Параметры ступицы — то, от чего зависит, встанет диск или нет. */
.fitment-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}
.fitment-spec {
  flex: 1 1 180px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 4px;
  background: var(--bg-alt);
}
.fitment-spec__label { display: block; font-size: 12px; color: var(--muted); }
.fitment-spec__value { display: block; margin-top: 4px; font-size: 18px; font-weight: 700; }

.fitment-sizes { margin-bottom: 36px; }
.fitment-sizes h2,
.fitment-results h2 { font-size: 18px; text-transform: uppercase; margin: 0 0 8px; }
.fitment-sizes__hint { margin: 0 0 16px; font-size: 13px; color: var(--muted); max-width: 720px; }

.fitment-sizes__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.fitment-size {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
/* Диаметр — ссылка в каталог с уже выставленным креплением и размером:
   самый частый следующий шаг после «а что вообще подходит». */
.fitment-size__diameter {
  display: block;
  padding: 8px 12px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.fitment-size__diameter:hover { background: var(--red-hover); }
.fitment-size__list { margin: 0; padding: 10px 12px; list-style: none; }
.fitment-size__list li { font-size: 14px; padding: 3px 0; }

.fitment-results__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.fitment-results__count { color: var(--muted); font-weight: 400; }
.fitment-results__all { width: auto; padding: 8px 16px; font-size: 13px; }
.fitment-results .product-grid { margin-top: 16px; }

@media (max-width: 800px) {
  .fitment-title { font-size: 20px; }
  .fitment-spec { flex-basis: 140px; padding: 10px 12px; }
  .fitment-spec__value { font-size: 16px; }
  .fitment-sizes__grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
}

/* Заголовок для поисковика и скринридеров, невидимый на экране. Убирать
   через display:none нельзя — тогда его не увидит и тот, для кого он нужен. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Калькулятор кованых дисков под заказ ===== */
.calc {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 32px;
}
.calc__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border-radius: 6px;
  padding: 28px;
  color: #fff;
  background: linear-gradient(160deg, #1c1c1c, #0d0d0d);
}
/* Кнопка вместо формы: сам расчёт открывается попапом. На широком экране
   она стоит справа от текста, на узком уходит под него (см. медиазапрос). */
.calc__open { width: auto; flex-shrink: 0; padding: 14px 32px; }
.calc__title {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
}
.calc__lead { margin: 18px 0 0; font-size: 14px; color: rgba(255,255,255,0.65); max-width: 560px; }

/* Окно калькулятора. Общая раскладка модалок (.modal-overlay) подходит, а
   карточку переопределяем: она тёмная, широкая и прокручивается внутри —
   расчёт с формой заявки в 420px белого окна не помещается. */
.calc-modal__card {
  /* 980, а не 900: при меньшей ширине список услуг не набирает две колонки
     и окно вытягивается вниз на два экрана. */
  max-width: 980px;
  max-height: 90vh;
  overflow-y: auto;
  /* Сверху отступа нет: он отдан заголовку. Иначе под липким «Итого»
     оставалась бы полоса, в которой видно проезжающий мимо список услуг. */
  padding: 0 28px 28px;
  color: #fff;
  background: linear-gradient(160deg, #1c1c1c, #0d0d0d);
}
/* Липкая шапка окна: заголовок и крестик остаются на месте, пока
   прокручиваешь услуги и форму заявки. Её высота нужна ещё и «Итого» —
   он на мобильном прилипает сразу под шапкой, а не поверх неё. */
/* Запасное значение: настоящую высоту шапки подставляет calculator.js. */
.calc-modal__card { --calc-head: 74px; }
.calc-modal__head {
  position: sticky;
  top: 0;
  z-index: 7;
  margin: 0 -28px;
  padding: 22px 28px 12px;
  background: #1c1c1c;
}
.calc-modal .modal-close { top: 22px; right: 28px; color: rgba(255,255,255,0.6); font-size: 26px; }
.calc-modal .modal-close:hover { color: #fff; }
.calc-modal .modal-title {
  margin: 0 0 6px;
  padding-right: 32px;
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
}
.calc-modal .calc__lead { margin: 0 0 4px; }

/* Кнопки заявки в окне калькулятора те же, что на карточке товара, но там
   они стоят на светлой странице. Здесь фон тёмный — перекрашиваем, иначе
   заголовок блока получается белым по белому. */
.calc-modal .order-box {
  margin: 0;
  background: rgba(255,255,255,0.05);
  border-color: #2f2f2f;
}
.calc-modal .order-box__title { color: #fff; }
.calc-modal .order-box__hint,
.calc-modal .order-field__label,
.calc-modal .order-consent,
.calc-modal .order-box__phone,
.calc-modal .order-status { color: rgba(255,255,255,0.6); }
.calc-modal .order-consent a,
.calc-modal .order-box__phone a { color: #fff; }
.calc-modal .order-input { border-color: #2f2f2f; }
.calc-modal .order-photos__hint,
.calc-modal .order-photos__empty { color: rgba(255,255,255,0.5); }
.calc-modal .order-photos__drop { border-color: #3a3a3a; }
.calc-modal .order-photos__list { color: rgba(255,255,255,0.6); }
.calc-modal .order-status--ok { color: #8fd39f; }
.calc-modal .order-status--error { color: #ff8a80; }

/* ── Шаги калькулятора ─────────────────────────────────────── */
.calc-steps {
  display: flex;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: calc-step;
}
.calc-steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  counter-increment: calc-step;
}
.calc-steps__item + .calc-steps__item { margin-left: 12px; }
.calc-steps__item::before {
  content: counter(calc-step);
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.calc-steps__item.is-current { color: #fff; }
.calc-steps__item.is-current::before { background: var(--red); border-color: var(--red); color: #fff; }
.calc-steps__item.is-done { color: rgba(255,255,255,0.65); }
.calc-steps__item.is-done::before { content: '✓'; border-color: rgba(255,255,255,0.4); }

/* Кнопка перехода ко второму шагу — в колонке под «Итого». */
.calc__next { grid-area: form; }
.calc__next-btn { width: 100%; padding: 14px; }

.calc-step2 { margin-top: 20px; }
.calc-step2[hidden] { display: none; }
.calc-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255,255,255,0.6);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.calc-back:hover { color: #fff; }

/* Итог на втором шаге: одна строка вместо всего блока расчёта — покупатель
   уже выбрал, ему нужно только подтверждение, за что он оставляет контакты. */
.calc-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--red);
  background: rgba(255,255,255,0.05);
}
.calc-summary__note { font-size: 14px; color: rgba(255,255,255,0.7); }
.calc-summary__totals { text-align: right; }
.calc-summary__retail { display: block; font-size: 12px; color: rgba(255,255,255,0.6); }
.calc-summary__retail b { color: #fff; font-weight: 700; }
.calc-summary__total { font-size: 22px; font-weight: 800; white-space: nowrap; }

/* ── Фотографии в заявке ───────────────────────────────────── */
.order-photos__hint { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.order-photos__drop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.order-photos__drop:hover { border-color: var(--red); }
.order-photos__drop:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
.order-photos__button {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  /* Цвет текста задаём явно: блок наследует его от окружения, а окно
     калькулятора тёмное — без этой строки надпись белая по белому. */
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.order-photos__empty { font-size: 12px; color: var(--muted); }
.order-photos__list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
}
.order-photos__list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}
.order-photos__list li span { white-space: nowrap; }

.calc__body {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-areas:
    'fields total'
    'fields form';
  grid-template-rows: auto 1fr;
  gap: 28px;
  margin-top: 26px;
  align-items: start;
}
/* display перебивает атрибут hidden — без этой строки первый шаг остаётся
   на экране, когда открыт второй (та же ловушка, что у поля «Ширина»). */
.calc__body[hidden] { display: none; }
.calc__fields { grid-area: fields; }
.calc__total-box { grid-area: total; }

.calc__field { display: flex; flex-direction: column; gap: 6px; }
/* display у .calc__field перебивает атрибут hidden — без этой строки поле
   «Ширина» остаётся на экране пустым, когда у типа дисков ширин нет. */
.calc__field[hidden] { display: none; }
.calc__label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: rgba(255,255,255,0.55); }
.calc__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.calc__select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #2f2f2f;
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.calc__select {
  appearance: none;
  background:
    #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23e4002b' d='M5 7l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 14px center/12px;
  padding-right: 34px;
  cursor: pointer;
}
/* Список доп. услуг занимает обе колонки: их много, и в узкой колонке
   названия вроде «Позолота методом гальванического нанесения» не помещаются. */
.calc__label-note { text-transform: none; letter-spacing: 0; color: rgba(255,255,255,0.4); }
.calc__extras { grid-column: 1 / -1; border: none; padding: 0; margin: 6px 0 0; }
.calc__extras-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.calc__extra {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid #2f2f2f;
  border-radius: 3px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font-size: 13px;
}
.calc__extra:hover { border-color: var(--red); }
.calc__extra-name { flex: 1; }
.calc__extra-price { color: rgba(255,255,255,0.55); white-space: nowrap; }
.calc__extra input:checked ~ .calc__extra-price { color: #fff; }

.calc__total-box {
  padding: 18px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--red);
}
.calc__total-label { font-size: 12px; text-transform: uppercase; color: rgba(255,255,255,0.55); }
.calc__total { display: block; margin-top: 6px; font-size: 30px; font-weight: 800; }
/* Оптовая цена под розничной: мельче итога, но заметно — это цена, по
   которой клиент купит. */
.calc__retail { margin: 4px 0 0; font-size: 13px; color: rgba(255,255,255,0.6); }
.calc__retail[hidden] { display: none; }
.calc__retail b { color: #fff; font-weight: 700; }
/* Цена услуги со скидкой — второй строкой под розничной, у правого края. */
.calc__extra-wholesale { display: block; font-size: 11px; color: rgba(255,255,255,0.75); }

.calc__note { margin: 6px 0 0; font-size: 12px; color: rgba(255,255,255,0.5); }


@media (max-width: 900px) {
  /* Кнопка под текстом: рядом с ним на узком экране ей не хватает места, а
     переносить надпись внутри кнопки некрасиво. */
  .calc__inner { flex-direction: column; align-items: stretch; gap: 0; }
  .calc__open { align-self: flex-start; margin-top: 22px; }

  /* Одна колонка, и итог поднимаем над полями: ниже он прилипает к верху
     экрана, и сумма остаётся на виду, пока листаешь список услуг.

     Здесь именно flex, а не grid: у липкого grid-элемента областью
     прилипания служит его собственная ячейка, а она по высоте равна
     самому блоку — прилипать некуда, и итог уезжает за экран. У flex-
     элемента область прилипания — весь контейнер. */
  .calc__body {
    display: flex;
    flex-direction: column;
    /* align-items: start из общего правила в колонке означает «по ширине
       содержимого» — липкий «Итого» становился узким, и мимо него сбоку
       проезжал список услуг. */
    align-items: stretch;
  }
  .calc__total-box { order: 1; }
  .calc__fields { order: 2; }
  .calc__next { order: 3; }
}

@media (max-width: 800px) {
  .calc { padding: 0 16px; }
  .calc__inner { padding: 20px 16px; }
  .calc__title { font-size: 22px; }
  .calc__fields { grid-template-columns: 1fr; }
  .calc__total { font-size: 26px; }

  /* Итог не должен уезжать за экран, пока листаешь длинный список услуг —
     иначе непонятно, на что влияет очередная галочка. Прилипает к верху,
     потому что стоит над полями (см. порядок flex выше). */
  .calc__total-box {
    position: sticky;
    top: var(--calc-head, 0px);
    z-index: 5;
    background: #1c1c1c;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  }
}

/* Текстовые страницы вроде политики обработки данных */
.legal-page { max-width: 760px; }
.legal-page h1 { font-size: 26px; margin: 0 0 20px; }
.legal-page h2 { font-size: 17px; margin: 28px 0 8px; }
.legal-page p { font-size: 15px; line-height: 1.6; margin: 0 0 12px; }
/* Перечни прав и обязанностей в политике: длинные, поэтому строки нужно
   разделять воздухом, иначе абзац читается как сплошная стена. */
.legal-page ul { margin: 0 0 12px; padding-left: 22px; }
.legal-page li { font-size: 15px; line-height: 1.6; margin-bottom: 6px; }
.legal-page strong { font-weight: 700; }
