:root {
  --blue: #005bff;
  --blue-dark: #0046cc;
  --bg: #f2f3f5;
  --text: #1a1a1a;
  --muted: #99a3ae;
  --border: #e3e8ee;
  --danger: #f91155;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: 'Inter', system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a {
  color: inherit;
  text-decoration: none;
}
code {
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

/* ---------- Шапка (как Ozon) ---------- */
.header {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  font-size: 26px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.header-search {
  flex: 1;
  display: flex;
}
.header-search input {
  flex: 1;
  border: 2px solid var(--blue);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
}
.header-search button {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 0 8px 8px 0;
  padding: 0 28px;
  font-size: 15px;
  cursor: pointer;
}
.header-search button:hover {
  background: var(--blue-dark);
}
.header-nav {
  display: flex;
  gap: 26px;
  align-items: stretch;
  white-space: nowrap;
}
.header-nav .nav-item {
  padding: 2px 4px;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #8b95a0;
  font-size: 12px;
  line-height: 1;
  padding: 2px;
  min-width: 48px;
}
.nav-item svg {
  width: 24px;
  height: 24px;
}
.nav-item:hover {
  color: var(--blue);
}
.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}
.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
  white-space: nowrap;
}

/* ---------- Контент ---------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 14px;
}
.muted {
  color: var(--muted);
}

/* ---------- Категории-пилюли ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: #333;
}
.chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ---------- Сетка товаров ---------- */
.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  transform: translateY(-2px);
}
.card-img {
  display: block;
  aspect-ratio: 1 / 0.75;
  position: relative;
  overflow: hidden;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 800;
  color: var(--blue);
  opacity: .55;
}
.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card-title {
  font-size: 14px;
  line-height: 1.35;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-title:hover {
  color: var(--blue);
}
.card-brand {
  font-size: 12px;
  color: var(--muted);
}
.card-price {
  font-size: 19px;
  font-weight: 800;
  margin-top: auto;
}

/* ---------- Кнопки ---------- */
.btn-add {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-add:hover {
  background: var(--blue-dark);
}
.btn-add.big {
  width: auto;
  padding: 12px 32px;
  font-size: 15px;
}
.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-block;
}
.btn-outline:hover {
  background: #f0f5ff;
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
}
.btn-danger:hover {
  background: #fff0f4;
}
.out {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Карточка товара (страница) ---------- */
.product-page {
  display: flex;
  gap: 24px;
  padding: 24px;
}
.product-img {
  width: 340px;
  min-width: 340px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  aspect-ratio: 1;
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.product-img {
  justify-content: center;
  overflow: hidden;
}
.product-img span {
  font-size: 110px;
  font-weight: 800;
  color: var(--blue);
  opacity: .55;
}
.product-info h1 {
  font-size: 22px;
  margin: 0 0 8px;
}
.product-price {
  font-size: 30px;
  font-weight: 800;
  margin: 16px 0 4px;
}
.stock {
  color: #0cb477;
  font-size: 13px;
}
.buy-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}
.buy-row input {
  width: 70px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
}

/* ---------- Таблицы ---------- */
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 12px 0;
}
.grid {
  width: 100%;
  border-collapse: collapse;
}
.grid th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
.grid td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.grid tr:last-child td {
  border-bottom: 0;
}
.grid a {
  color: var(--blue);
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Интерактивное редактирование в админке ---------- */
.cell-e {
  display: none;
  width: 100%;
  min-width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.btn-save {
  width: auto;
  padding: 8px 16px;
}

/* ---------- Корзина ---------- */
.cart-summary .total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ---------- Формы ---------- */
.auth-wrap {
  max-width: 420px;
  margin: 40px auto;
}
.form label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: #555;
}
.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.form input:focus,
.form select:focus,
.form textarea:focus {
  border-color: var(--blue);
}
.form .btn-add {
  margin-top: 18px;
}
.error {
  color: var(--danger);
  font-size: 13px;
}

/* ---------- Админка ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.stat {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  font-size: 13px;
  color: var(--muted);
}
.stat b {
  display: block;
  font-size: 26px;
  color: var(--text);
  margin-top: 4px;
}
.app-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.app-row input {
  flex: 1;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.app-row input:focus {
  border-color: var(--blue);
}

/* ---------- Корзина на витрине, статусы заказов ---------- */
.in-cart {
  color: #0cb477;
  font-size: 12px;
  font-weight: 600;
}
.in-cart-inline {
  color: #0cb477;
  font-weight: 600;
}
.delivery-option {
  display: flex !important;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.delivery-option:hover {
  border-color: var(--blue);
}
.delivery-option input {
  width: auto !important;
  margin-top: 3px;
}
.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.order-total {
  font-size: 18px;
  font-weight: 800;
}
.track {
  font-family: monospace;
  background: #f0f4f8;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
}
.st-new {
  background: #fff7e0;
  color: #b58900;
}
.st-paid {
  background: #e7f0ff;
  color: #005bff;
}
.st-delivered {
  background: #e2f9ef;
  color: #0cb477;
}
.st-cancelled {
  background: #ffe9ef;
  color: #f91155;
}
.ship-photo img {
  max-width: 260px;
  border-radius: 10px;
}

/* ---------- Рейтинг, отзывы, корзина ---------- */
.stars {
  color: #ff9f29;
  letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(255, 159, 41, .35);
}
.card-rating .stars {
  font-size: 15px;
}
.stars-sm {
  font-size: 14px;
}
.stars-lg {
  font-size: 26px;
}
.card-rating {
  font-size: 12px;
}
.btn-add.added {
  background: #0cb477;
}
.btn-add.added:hover {
  background: #0aa066;
}
.cart-badge {
  display: none;
  background: #005bff;
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.product-layout .product-page {
  margin: 0;
}
.product-layout .panel {
  margin: 0;
}

/* колонки стартуют на одной линии */
.review {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.review:last-of-type {
  margin-bottom: 0;
}
.review-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.review-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
}
.review-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}
.review-date {
  font-size: 11px;
}
.review .review-body {
  margin-top: 8px;
}
.review-photo {
  max-width: 140px;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
}

/* ---------- Степпер количества на карточках ---------- */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.card .cart-widget {
  text-align: center;
}
.stepper-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #555;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:hover {
  background: #f0f5ff;
  color: var(--blue);
}
.stepper-btn:disabled {
  opacity: .5;
}
.stepper-remove {
  color: #b0b8c0;
}
.stepper-remove:hover {
  background: #fff0f4;
  color: var(--danger) !important;
}
.qty-value {
  min-width: 30px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 auto;
}
.qty-input {
  width: 36px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  padding: 4px 0;
  border-radius: 6px;
}
.qty-input:focus {
  outline: 2px solid var(--blue);
  background: #fff;
}

/* ---------- Подсказки адреса ---------- */
.address-wrap {
  position: relative;
}
.addr-suggest {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  max-height: 260px;
  overflow: auto;
}
.addr-item {
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.addr-item:last-child {
  border-bottom: 0;
}
.addr-item:hover {
  background: #f0f5ff;
}

/* ---------- Карта 2ГИС в корзине ---------- */
.dgis-map {
  display: none;
  width: 100%;
  height: 240px;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.dgis-map.visible {
  display: block;
}

/* ---------- Модальные окна ---------- */
.modal {
  display: none;
}
.modal.open {
  display: block;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 300;
}
.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  z-index: 301;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #8b95a0;
  cursor: pointer;
}
.modal-close:hover {
  background: #f0f4f8;
  color: #333;
}

/* компактная лента отзывов */
.reviews-list {
  max-height: 420px;
  overflow: auto;
}

/* ---------- Вкладки формы товара ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  font-size: 13.5px;
  color: #6b7684;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}
.tab-btn:hover {
  color: var(--blue);
}
.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

/* ---------- Галерея фото товара ---------- */
.photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.photo-item {
  position: relative;
  width: 96px;
}
.photo-item img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}
.photo-main-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
}
.photo-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
}
.photo-actions .stepper-btn {
  width: 26px;
  height: 26px;
  font-size: 13px;
}
.thumbs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
}
.thumb.active,
.thumb:hover {
  border-color: var(--blue);
}

/* ---------- Формы админки: строки «метка — поле» ---------- */
.fc-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 0;
  flex-wrap: wrap;
}
.fc-label {
  width: 190px;
  flex: 0 0 190px;
  padding-top: 11px;
  font-size: 13px;
  color: #444;
  text-align: left;
}
.fc-row input,
.fc-row select {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.fc-row input:focus,
.fc-row select:focus {
  border-color: var(--blue);
}
.fc-hint {
  flex-basis: 100%;
  margin-left: 202px;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 640px) {
  .fc-label {
    flex-basis: 100%;
    width: auto;
    padding-top: 0;
  }
  .fc-hint {
    margin-left: 0;
  }
}

/* ---------- Dropzone загрузки фото ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer !important;
  transition: border-color .15s, background .15s;
  color: #6b7684;
  user-select: none;
}
.dropzone:hover,
.dropzone.over {
  border-color: var(--blue);
  background: #f5f9ff;
}
.dropzone-hint p {
  margin: 6px 0 2px;
  font-size: 13px;
}
.dropzone-files {
  margin-top: 8px;
}

/* ---------- Фото в отзывах ---------- */
.review-photos {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}
.review-photos .review-photo {
  width: 88px;
  height: 88px;
  max-width: 88px;
  max-height: 88px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 0;
}
.review-photos .review-photo:hover {
  border-color: var(--blue);
}

/* ---------- Миниатюры в dropzone ---------- */
.dropzone-files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.dz-thumb-item {
  position: relative;
  width: 76px;
}
.dz-thumb {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}
.dz-thumb-name {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dz-thumb-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: #f91155;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

/* ---------- WYSIWYG-контент (TinyMCE) ---------- */
.review-body {
  line-height: 1.65;
  margin: 6px 0;
}
.review-body p {
  margin: 0 0 8px;
}
.review-body ul,
.review-body ol {
  margin: 4px 0 8px;
  padding-left: 22px;
}
.review-body a {
  color: var(--blue);
}

/* ---------- Видео в карточке товара ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.video-item iframe,
.video-item video {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #000;
  display: block;
}
.video-link {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background: #1e293b;
  color: #fff;
  border-radius: 10px;
  font-size: 15px;
}
.video-link:hover {
  color: #7dd3fc;
}

/* ---------- Карусель изображений товара ---------- */
.gallery-main {
  position: relative;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.92);
  color: #333;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.gallery-nav:hover {
  background: #fff;
  color: var(--blue);
}
.gallery-nav.prev {
  left: 10px;
}
.gallery-nav.next {
  right: 10px;
}

/* ---------- Корзина (карточки товаров) ---------- */
.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.cart-item-img {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #eaf1ff, #dbe7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--blue);
}
.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  filter: none;
}
.cart-item-img {
  opacity: 1;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cart-item-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.cart-item-name:hover {
  color: var(--blue);
}
.cart-item-price {
  text-align: right;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cart-item-price b {
  font-size: 16px;
}
.cart-item-price .muted {
  font-size: 12px;
}
.cart-item-del button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b0b8c0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-item-del button:hover {
  background: #fff0f4;
  color: var(--danger);
}
.cart-totals {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 10px;
  font-size: 14px;
}
.cart-totals > div {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}
.cart-total-row {
  font-size: 17px;
  font-weight: 800;
  margin-top: 4px;
}

/* ---------- Мессенджеры-иконки ---------- */
.messenger-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.messenger-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.messenger-ico {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px 6px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  color: #667;
  user-select: none;
  transition: border-color .12s, background .12s;
}
.messenger-ico svg {
  display: block;
}
.messenger-opt input:checked + .messenger-ico {
  border-color: var(--blue);
  background: #f0f5ff;
  color: #333;
}

/* ---------- Тумблер «не звонить» ---------- */
.call-toggle {
  display: block;
  margin: 12px 0 4px;
  cursor: pointer;
}
.call-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.call-toggle-box {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  transition: border-color .12s, background .12s;
}
.call-toggle-box small {
  color: var(--muted);
  font-size: 12px;
}
.call-toggle-icon {
  font-size: 24px;
}
.call-toggle input:checked + .call-toggle-box {
  border-color: var(--blue);
  background: #f0f5ff;
}
.mt6 {
  margin: 6px 0 10px;
}

/* ---------- Предложить своё видео ---------- */

/* ---------- Предложить своё видео (заметный блок с анимацией) ---------- */
.suggest-video {
  margin-top: 14px;
  padding: 14px 16px;
  border: 2px dashed var(--blue);
  border-radius: 14px;
  background: linear-gradient(135deg, #f5f9ff, #eef4ff);
  animation: sv-pulse 2.4s ease-in-out infinite;
}
.sv-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sv-icon {
  font-size: 28px;
  line-height: 1;
}
.suggest-video b {
  font-size: 15px;
}
@keyframes sv-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 91, 255, .28); border-color: var(--blue); }
  50% { box-shadow: 0 0 0 7px rgba(0, 91, 255, 0); border-color: #6aa5ff; }
}
@media (prefers-reduced-motion: reduce) {
  .suggest-video {
    animation: none;
  }
}

/* ---------- Карточка товара: центрирование левого блока ---------- */
.product-page {
  text-align: center;
  justify-content: center;
  flex-wrap: wrap;
}
.product-page > div {
  margin-left: auto;
  margin-right: auto;
}
.product-page .product-info h1,
.product-page .product-info > p,
.product-page .card-rating {
  text-align: center;
}
.product-page .buy-row,
.product-page .cart-widget {
  justify-content: center;
}
.product-page .product-price {
  text-align: center;
}

/* ---------- Drag&drop сортировка фото ---------- */
[data-sortable] .photo-item {
  cursor: grab;
}
[data-sortable] .photo-item.dragging {
  opacity: .45;
  cursor: grabbing;
}

/* ---------- Лайтбокс (фото на весь экран) ---------- */
.lightbox .modal-overlay {
  background: rgba(10, 14, 22, .9);
}
.lightbox-body {
  position: fixed;
  inset: 0;
  z-index: 301;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox-body img {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0,0,0,.5);
  object-fit: contain;
  background: #fff;
}
.lightbox .modal-close {
  position: fixed;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 26px;
  z-index: 303;
}
.lightbox .modal-close:hover {
  background: rgba(255,255,255,.25);
}
.lightbox .gallery-nav {
  background: rgba(255,255,255,.15);
  color: #fff;
  width: 48px;
  height: 48px;
}
.lightbox .gallery-nav:hover {
  background: rgba(255,255,255,.3);
  color: #fff;
}

/* ---------- Миниатюры в таблице админки ---------- */
.admin-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.admin-thumb:hover {
  border-color: var(--blue);
}

/* ---------- Иконки действий в таблице ---------- */
.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #6b7684;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.icon-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff0f4;
}

/* ---------- Уведомление об обновлении заказа ---------- */
.order-update {
  animation: sv-pulse 2.4s ease-in-out infinite;
}

/* ---------- Мои заказы: сетка + раскрытие ---------- */
.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}
.orders-grid:has(> :only-child) {
  grid-template-columns: 1fr;
}
.order-card-head {
  cursor: pointer;
  user-select: none;
}
.order-card-head:hover .order-caret {
  color: var(--blue);
}
.order-caret {
  display: inline-block;
  transition: transform .15s ease;
  color: var(--muted);
}
.order-card.open .order-caret {
  transform: rotate(180deg);
}
.order-details {
  border-top: 1px dashed var(--border);
  margin-top: 10px;
  padding-top: 4px;
}
.pp-form {
  border: 2px dashed transparent;
  border-radius: 12px;
  padding: 6px;
  transition: border-color .15s, background .15s;
}
.pp-form.pp-drag {
  border-color: var(--blue);
  background: #f0f5ff;
}
@media (max-width: 860px) {
  .orders-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Рейтинг и отзывы в стиле Ozon ---------- */
.oz-summary {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 12px 0 16px;
}
.oz-num {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.oz-summary-info {
  flex: 1;
  min-width: 0;
}
.oz-bars {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.oz-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.oz-bar-star {
  width: 10px;
  color: var(--muted);
  text-align: right;
}
.oz-bar {
  flex: 1;
  height: 6px;
  background: #e9edf2;
  border-radius: 999px;
  overflow: hidden;
}
.oz-bar-fill {
  height: 100%;
  background: #ff9f29;
  border-radius: 999px;
}
.oz-bar-count {
  width: 24px;
  text-align: left;
}
.oz-helpful {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: #444;
}
.oz-helpful-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #333;
}
.oz-helpful-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.oz-helpful-btn.voted {
  border-color: #0cb477;
  color: #0cb477;
  background: #f0fbf6;
}

/* ---------- Позиции заказа (Мои заказы) ---------- */
.order-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}
.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.order-item-img {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #eaf1ff, #dbe7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--blue);
  opacity: .8;
}
.order-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.order-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.order-item-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.order-item-name:hover {
  color: var(--blue);
}
.order-item-qty {
  font-size: 13px;
  color: #444;
  white-space: nowrap;
}
.order-item-sum {
  white-space: nowrap;
  font-size: 14px;
}

/* ---------- Бейдж обновлений заказов (пульсация) ---------- */
.orders-badge {
  background: #f91155;
}
.orders-badge:not([style*="none"]) {
  animation: orders-pulse 1.8s ease-in-out infinite;
}
@keyframes orders-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 17, 85, .5); }
  50% { box-shadow: 0 0 0 6px rgba(249, 17, 85, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .orders-badge {
    animation: none !important;
  }
}

/* ---------- Сортировка по заголовкам таблицы ---------- */
th.sortable a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
th.sortable a:hover {
  color: var(--blue);
}
th.sortable.active a {
  color: var(--blue);
  font-weight: 700;
}

/* ---------- Форма товара: две колонки + предпросмотр ---------- */
.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
}
.edit-preview {
  position: sticky;
  top: 84px;
}
.preview-card {
  max-width: 280px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .edit-layout {
    grid-template-columns: 1fr;
  }
  .edit-preview {
    position: static;
  }
}

/* ---------- Модалка товара: ровные блоки ---------- */
#part-edit-modal .fc-row {
  margin: 12px 0;
  gap: 10px;
  align-items: center;
}
#part-edit-modal .fc-label {
  width: 140px;
  flex: 0 0 140px;
  padding-top: 0;
  font-size: 13px;
  line-height: 1.3;
}
#part-edit-modal .fc-row input,
#part-edit-modal .fc-row select,
#part-edit-modal .fc-row textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  min-height: 38px;
  box-sizing: border-box;
}
#part-edit-modal .fc-row input:focus,
#part-edit-modal .fc-row select:focus,
#part-edit-modal .fc-row textarea:focus {
  border-color: var(--blue);
}
#part-edit-modal .fc-hint {
  margin-left: 150px;
}
#part-edit-modal .tabs {
  margin-bottom: 10px;
}
#part-edit-modal .form .btn-add {
  margin-top: 16px;
}
@media (max-width: 640px) {
  #part-edit-modal .fc-label {
    flex-basis: 100%;
    width: auto;
    padding-top: 0;
  }
  #part-edit-modal .fc-hint {
    margin-left: 0;
  }
}

/* ---------- Группировка каталога: категория -> марка/модель ---------- */
.car-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  margin: 14px 0 10px;
}

/* ---------- Спиннер загрузки ---------- */
.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Прогресс-бар импорта ---------- */
.progress-bar {
  height: 8px;
  background: #e9edf2;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 999px;
  transition: width .3s ease;
}

/* ---------- Компактные строки для малых групп ---------- */
.mini-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mini-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}
.mini-card-img {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #eaf1ff, #dbe7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: var(--blue);
  opacity: .8;
}
.mini-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mini-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mini-card-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.mini-card-name:hover {
  color: var(--blue);
}
.mini-card-side {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mini-card-price {
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
}

/* ---------- Сердечко «в избранное» на карточке ---------- */
.card {
  position: relative;
}
.fav-toggle {
  pointer-events: auto;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 50;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: #8b95a0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.fav-toggle svg {
  width: 18px;
  height: 18px;
}
.fav-toggle:hover {
  color: var(--danger);
}
.fav-toggle.active {
  color: var(--danger);
  background: #fff0f4;
}

/* ---------- Скрытые товары в админке ---------- */
tr.part-hidden td {
  opacity: .45;
  background: #fafbfc;
}

/* ---------- Мобильная версия таблицы товаров (карточки, без заголовков) ---------- */
@media (max-width: 860px) {
  .admin-parts-grid {
    display: block;
    border-collapse: separate;
  }
  .admin-parts-grid thead {
    display: none !important;
  }
  .admin-parts-grid tbody,
  .admin-parts-grid tr,
  .admin-parts-grid td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .admin-parts-grid tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    background: #fff;
    padding: 10px 12px;
    position: relative;
  }
  .admin-parts-grid td {
    border: 0;
    padding: 3px 0;
    font-size: 13px;
  }
  .admin-parts-grid td:first-child {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
    padding: 0;
  }
  .admin-parts-grid td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 11.5px;
  }
  .admin-parts-grid .cell-e {
    display: none !important;
  }
  .admin-parts-grid .cell-v {
    display: inline;
  }
  .admin-parts-grid .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    margin-top: 6px;
  }
}

/* ---------- Мобильные фильтры главной ---------- */
@media (max-width: 860px) {
  .view-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 64px;
    z-index: 50;
    background: var(--bg);
    margin-left: -4px;
    margin-right: -4px;
  }
  .view-filter-bar::-webkit-scrollbar {
    display: none;
  }
  .view-filter-bar .chip {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 11px 18px;
    font-size: 14px;
    min-height: 40px;
  }
}

/* ---------- Бейдж оптовой цены ---------- */
.wholesale-tag {
  display: inline-block;
  background: #0cb477;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 600;
}

/* ---------- Рейтинг: одна звезда + цифра ---------- */
.rating-one {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ff9f29;
  font-weight: 700;
  font-size: 14px;
}
.rating-one .star {
  font-size: 16px;
}

/* ---------- Анимация скрепки при загрузке файла ---------- */
#chat-attach.chat-attach-loading svg {
  animation: clip-wiggle 0.5s ease-in-out infinite;
}
@keyframes clip-wiggle {
  0%, 100% { transform: rotate(-12deg) scale(1.1); }
  50% { transform: rotate(12deg) scale(1.1); }
}

/* ---------- «Печатает…» (три точки) ---------- */
.chat-typing {
  padding: 12px 16px !important;
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
}
.typing-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b95a0;
  animation: typing-blink 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) {
  animation-delay: .2s;
}
.typing-dots i:nth-child(3) {
  animation-delay: .4s;
}
@keyframes typing-blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Чат: кнопка и панель (JivoSite-стиль) ---------- */
#chat-fab {
  pointer-events: auto;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066ff, #0052cc);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 82, 204, .4), 0 2px 8px rgba(0,0,0,.2);
  z-index: 9999;
  transition: transform .2s ease, box-shadow .2s ease;
}
#chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(0, 82, 204, .5), 0 4px 12px rgba(0,0,0,.25);
}
#chat-fab:active {
  transform: scale(.96);
}
#chat-fab svg {
  display: block;
  position: relative;
  z-index: 2;
}
.chat-fab-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 102, 255, .5);
  animation: chat-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
.chat-fab-ring.r2 {
  animation-delay: 1.2s;
}
@keyframes chat-pulse {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes chat-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
#chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.15);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
#chat-panel.chat-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.chat-head {
  background: linear-gradient(135deg, #0066ff, #0052cc);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-head-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  border: 2px solid rgba(255,255,255,.4);
}
.chat-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.chat-status {
  font-size: 11px;
  opacity: .9;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.chat-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  box-shadow: 0 0 6px #4ade80;
  animation: chat-blink 2s infinite;
}
@keyframes chat-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
#chat-messages {
  scroll-behavior: smooth;
}
.chat-bubble {
  animation: none;
}
@keyframes chat-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#chat-close {
  cursor: pointer;
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .2s;
  position: relative;
  z-index: 10001;
  pointer-events: auto;
}
#chat-close:hover {
  background: rgba(255,255,255,.2);
}
#chat-threads {
  max-height: 100px;
  overflow-y: auto;
  border-bottom: 1px solid #eef1f5;
  background: #fafbfc;
}
.chat-thread {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
  font-size: 13px;
  transition: background .15s;
}
.chat-thread:hover {
  background: #eef4ff;
}
.chat-badge {
  background: #ff4757;
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}
#chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: #f0f4f8;
}
.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  margin-bottom: 10px;
  clear: both;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.chat-bubble.user {
  background: #fff;
  float: left;
  border-bottom-left-radius: 4px;
}
.chat-bubble.admin {
  background: #d3e5ff;
  float: right;
  border-bottom-right-radius: 4px;
}
.chat-bubble img.chat-img,
.chat-bubble video {
  max-width: 100%;
  border-radius: 12px;
  display: block;
  margin-bottom: 6px;
}
.chat-author {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
}
.chat-bubble.user .chat-author {
  color: #0052cc;
}
.chat-bubble.admin .chat-author {
  color: #0cb477;
}
.chat-time {
  display: block;
  font-size: 10px;
  color: #8b95a0;
  text-align: right;
  margin-top: 3px;
}
#chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #eef1f5;
  background: #fff;
  align-items: center;
  flex: 0 0 auto;
  min-height: 64px;
}
#chat-form input[type="text"] {
  flex: 1;
  padding: 11px 16px;
  border: 1.5px solid #e3e8ee;
  border-radius: 999px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
#chat-form input[type="text"]:focus {
  border-color: #0066ff;
}
#chat-form button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #0066ff, #0052cc);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .15s;
  flex: 0 0 44px;
}
#chat-form button:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 82, 204, .35);
}
.chat-attach-btn,
#chat-attach {
  background: #eef4ff !important;
  color: #005bff !important;
  border: 1.5px solid #d0e0ff !important;
  border-radius: 12px !important;
  transition: all .15s ease;
}
.chat-attach-btn:hover,
#chat-attach:hover {
  background: #dbe7ff !important;
  border-color: #005bff !important;
  transform: scale(1.05);
}
@media (max-width: 480px) {
  #chat-fab {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  #chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 84px;
  }
}

/* ---------- Список товаров: мобильные карточки ---------- */
.admin-products-mobile {
  display: none;
}
@media (max-width: 768px) {
  .admin-products-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .admin-parts-desktop {
    display: none;
  }
  .admin-product-card {
    display: flex;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    align-items: flex-start;
  }
  .apc-thumb {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    color: var(--blue);
  }
  .apc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .apc-info {
    flex: 1;
    min-width: 0;
  }
  .apc-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
  }
  .apc-status.ok {
    background: #0cb477;
    color: #fff;
  }
  .apc-status.warn {
    background: #f59e0b;
    color: #fff;
  }
  .apc-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    display: block;
    color: inherit;
  }
  .apc-name:hover {
    color: var(--blue);
  }
  .apc-sku {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
  }
  .apc-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
  }
  .apc-price {
    font-size: 16px;
    font-weight: 800;
    background: #fff8e0;
    padding: 3px 10px;
    border-radius: 8px;
  }
  .apc-stock {
    font-size: 12px;
    color: var(--muted);
  }
  .apc-actions {
    flex: 0 0 auto;
  }
}

/* ---------- Профиль: метки незаполненных полей ---------- */
.profile-badge {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 700;
  vertical-align: middle;
}
.profile-hint {
  background: #fff8e0;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  margin: 10px 0;
}
.field-empty {
  border-color: #f59e0b !important;
  background: #fffdf5;
}

/* ---------- Админка сообщений ---------- */
.unread-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}
.tg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  margin-bottom: 10px;
  clear: both;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.tg-bubble.in {
  background: #fff;
  float: left;
  border-bottom-left-radius: 4px;
}
.tg-bubble.out {
  background: #d3e5ff;
  float: right;
  border-bottom-right-radius: 4px;
}
.tg-time {
  display: block;
  font-size: 10px;
  color: #8b95a0;
  text-align: right;
  margin-top: 3px;
}

/* ---------- Бейдж непрочитанных на кнопке чата ---------- */
.chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f91155;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  z-index: 2;
}
#chat-fab.chat-has-unread {
  animation: chat-shake .6s ease-in-out;
}

/* ---------- Кнопки в таблицах админки: белый текст ---------- */
.grid td .btn-add {
  color: #fff !important;
}
.grid td .btn-outline {
  color: var(--blue);
}
@media (max-width: 768px) {
  .panel[style*="max-width:900px"] {
    max-width: 100% !important;
    margin: 0 !important;
  }
}

/* ---------- Пульсация кнопки чата при новых сообщениях ---------- */
#chat-fab.chat-pulse-alert {
  animation: chat-attention 1.6s ease-in-out infinite;
}
@keyframes chat-attention {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 82, 204, .4), 0 0 0 0 rgba(249, 17, 85, .5); }
  50% { box-shadow: 0 8px 24px rgba(0, 82, 204, .4), 0 0 0 12px rgba(249, 17, 85, 0); }
}

/* ---------- Точка незаполненного профиля ---------- */
.profile-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 4px #f59e0b;
}
.footer {
  text-align: center;
  color: var(--muted);
  padding: 30px;
  font-size: 13px;
}
@media (max-width: 1024px) {
  .product-layout {
    grid-template-columns: 1fr;
  }
}

/* Видео — одна колонка на всю ширину */
@media (max-width: 860px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

/* Защита от вылезания за край */
@media (max-width: 860px) {
  body {
    overflow-x: hidden;
  }
  .header-inner {
    max-width: 100%;
  }
  .header-search input {
    min-width: 0;
  }
  .header-nav {
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
  }
  .header-nav::-webkit-scrollbar {
    display: none;
  }
  .header-nav .nav-item {
    flex: 0 0 auto;
  }
  .container {
    padding: 12px;
    max-width: 100%;
  }
  table.grid {
    overflow-x: auto;
  }
  .grid td,
  .grid th {
    word-break: break-word;
  }
  .track,
  .card-brand,
  .muted,
  .order-item-name {
    word-break: break-word;
  }
  .section-title {
    word-break: break-word;
  }
}

/* Форма предложения видео — на всю ширину */
@media (max-width: 860px) {
  .suggest-video form input[type="text"],
  .suggest-video form input[type="url"] {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
  .suggest-video form .btn-add {
    width: 100% !important;
  }
  .header-inner {
    flex-wrap: wrap;
  }
  .header-nav {
    gap: 10px;
  }
  .nav-item {
    min-width: 40px;
  }
  .header-search {
    order: 3;
    flex-basis: 100%;
  }
  .product-page {
    flex-direction: column;
  }
  .product-img {
    width: 100%;
    min-width: 0;
  }
}

/* Чипы категорий/марок — крупнее под пальцы (без «съезда» страницы) */
@media (max-width: 860px) {
  .chips {
    gap: 8px;
  }
  .chip {
    padding: 11px 18px;
    font-size: 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
}

/* Карточки товаров — по 2 в ряд */
@media (max-width: 860px) {
  .grid-products {
    gap: 8px;
  }
  .card-body {
    padding: 8px;
  }
  .card-title {
    font-size: 12.5px;
    height: 32px;
  }
  .card-price {
    font-size: 16px;
  }
  .btn-add {
    padding: 8px;
    font-size: 13px;
  }
}

/* Полноэкранный режим чата */
#chat-panel.chat-full {
  top: 12px;
  right: 12px;
  bottom: 12px;
  left: 12px;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  border-radius: 16px;
  z-index: 10000;
}
#chat-panel.chat-full #chat-messages {
  flex: 1;
  min-height: 0;
}
.chat-head-btns {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: 12px;
}
#chat-expand {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  opacity: .9;
  position: relative;
  z-index: 10000;
  user-select: none;
}
#chat-expand:hover {
  background: rgba(255,255,255,.15);
  opacity: 1;
}
@media (max-width: 640px) {
  #chat-panel.chat-full {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 0;
  }
}

/* Кнопка-меню разделов на мобильных */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #1f2a3d;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(15,34,67,.06);
  transition: background .15s, transform .12s;
}
.nav-toggle:hover {
  background: #f4f7fc;
}
.nav-toggle:active {
  transform: scale(.93);
}
@keyframes nav-pop-in {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes nav-item-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.nav-popup {
  display: block;
  position: absolute;
  top: calc(100% + 8px);
  right: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15,34,67,.18);
  z-index: 1001;
  min-width: 240px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(.96);
  transform-origin: top right;
  transition: opacity .18s ease, transform .18s cubic-bezier(.2,.9,.3,1.25), visibility 0s .18s;
}
.nav-popup.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity .18s ease, transform .18s cubic-bezier(.2,.9,.3,1.25), visibility 0s;
}
.nav-popup a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #1f2a3d;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(-8px);
}
.nav-popup.open a {
  animation: nav-item-in .22s ease forwards;
}
.nav-popup.open a:nth-child(1) {
  animation-delay: .02s;
}
.nav-popup.open a:nth-child(2) {
  animation-delay: .05s;
}
.nav-popup.open a:nth-child(3) {
  animation-delay: .08s;
}
.nav-popup.open a:nth-child(4) {
  animation-delay: .11s;
}
.nav-popup.open a:nth-child(5) {
  animation-delay: .14s;
}
.nav-popup.open a:nth-child(6) {
  animation-delay: .17s;
}
.nav-popup.open a:nth-child(7) {
  animation-delay: .20s;
}
.nav-popup.open a:nth-child(8) {
  animation-delay: .23s;
}
.nav-popup.open a:nth-child(9) {
  animation-delay: .26s;
}
.nav-popup a:hover {
  background: #eef3fb;
  color: var(--blue);
}
.nav-popup a svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--blue);
  opacity: .85;
}
.nav-popup .badge {
  position: static;
  margin-left: auto;
}
@media (max-width: 860px) {
  .header-nav {
    display: none;
  }
  .nav-toggle {
    display: flex;
    position: absolute;
    top: 8px;
    right: 12px;
  }
}

/* Мобильные таблицы админки — карточный вид */
@media (max-width: 860px) {
  table.grid {
    display: block;
    width: 100%;
  }
  table.grid tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    background: #fff;
    padding: 4px 6px;
  }
  table.grid tr:first-child {
    display: none;
  }
  table.grid td,
  table.grid th {
    display: block;
    border: none;
    padding: 6px 8px;
    text-align: left !important;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  table.grid img {
    width: 56px !important;
    height: 56px !important;
    object-fit: cover;
  }
  table.grid input[type=number] {
    width: 64px;
  }
  table.grid input,
  table.grid select {
    max-width: 100%;
  }
  table.grid form {
    flex-wrap: wrap;
  }
  table.grid .btn-outline,
  table.grid .btn-add,
  table.grid .btn-danger {
    padding: 8px 14px;
  }
}
.card-sold {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

/* Кнопка «В корзину» и степпер — одинаковой ширины (карточки и страница товара) */
.card .cart-widget {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 41px;
}
.card .cart-widget form {
  flex: 1;
}
.card .cart-widget .qty-stepper {
  width: 100%;
  display: flex;
}
.card .cart-widget .qty-stepper > * {
  flex: 1 1 0;
  min-width: 0;
}
.card .out {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 41px;
  width: 100%;
  text-align: center;
}
.product-page .cart-widget {
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.product-page .buy-row {
  width: 100%;
  box-sizing: border-box;
}
.product-page .buy-row .btn-add {
  flex: 1;
}
.product-page .qty-stepper {
  width: 100%;
  display: flex;
}
.product-page .qty-stepper > * {
  flex: 1 1 0;
  min-width: 0;
}
.product-page .qty-stepper .qty-input,
.product-page .qty-stepper .qty-value {
  flex: 0 0 56px;
}

/* Меню ⋯ в таблице товаров: раскрытие не двигает раскладку */
.dd {
  position: relative;
  display: inline-block;
}
.dd > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dd > summary::-webkit-details-marker {
  display: none;
}
.dd > summary::marker {
  content: "";
}
.dd > summary:focus {
  outline: none;
}
.dd > summary:focus-visible {
  outline: 2px solid var(--blue);
  border-radius: 8px;
}
.dd-menu {
  position: absolute;
  right: 0;
  top: 110%;
  display: none;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
  z-index: 200;
  padding: 6px;
}
.dd[open] .dd-menu {
  display: block;
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 14px;
  color: #1f2a3d;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  box-sizing: border-box;
}
.dd-item:hover {
  background: #eef3fb;
}
.dd-item.danger {
  color: #c0392b;
}
.dd-item.danger:hover {
  background: #fdecec;
}
.admin-parts-grid .dd > summary.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
}

/* === Сетка главной: 5 карточек в ряд, шире === */
.grid-products {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) {
  .grid-products {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}
@media (max-width: 860px) {
  .grid-products {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Фото товара: вмещение целиком, без обрезки === */
.card-img {
  background: #ffffff;
}
.product-img {
  background: #ffffff;
}
.card-img img:not(.card-badge),
.product-img img:not(.card-badge) {
  object-fit: contain !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-position: center !important;
  padding: 6px;
  box-sizing: border-box;
}

/* метка характеристики: маленькая, слева вверху */
.card-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 5;
  pointer-events: none;
}
img.card-badge {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: contain !important;
  background: rgba(255,255,255,.92);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15,34,67,.18);
  padding: 2px;
  box-sizing: border-box;
}
.gallery-main #main-photo {
  cursor: zoom-in;
}
.card:hover .card-admin {
  display: flex !important;
}
.card-admin-menu {
  position: fixed;
  display: none;
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  z-index: 9999;
  padding: 6px;
}
.card-admin-menu button,
.card-admin-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 14px;
  color: #1f2a3d;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  box-sizing: border-box;
  text-decoration: none;
}
.card-admin-menu button:hover,
.card-admin-menu a:hover {
  background: #eef3fb;
}
.card-admin-menu .danger {
  color: #c0392b;
}

/* === Корзина: товары 40% / оформление 60% === */
@media (min-width: 861px) {
  .cart-main {
    flex: 0 0 40%;
    min-width: 0;
  }
  .cart-summary {
    width: auto;
    flex: 1 1 0;
    max-width: none;
    position: sticky;
    top: 84px;
  }
}
.cart-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.cart-main {
  flex: 0 0 60%;
  min-width: 0;
}
.cart-summary {
  flex: 1 1 0;
  width: auto;
  max-width: none;
  position: sticky;
  top: 84px;
}
@media (max-width: 860px) {
  .cart-layout {
    flex-direction: column;
  }
  .cart-main {
    flex: 0 0 auto;
    width: 100%;
  }
  .cart-summary {
    width: 100%;
    position: static;
  }
}
.bk-btn {
  min-width: 108px;
  text-align: center;
  padding: 8px 14px !important;
  font-size: 13px !important;
  font-weight: 600;
  justify-content: center;
}
td.actions .bk-btn.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
td.actions .bk-btn.btn-add {
  background: var(--blue);
  color: #fff;
}
td.actions .bk-btn.btn-danger {
  background: #fff;
  color: #c0392b;
  border: 1.5px solid #e74c3c;
}
td.actions .bk-btn.btn-danger:hover {
  background: #fdecec;
}
td.actions .bk-btn.btn-outline:hover {
  background: #f0f5ff;
}
td.actions .bk-btn {
  height: 34px;
  line-height: 1;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}
.admin-parts-grid td.actions,
table.grid td.actions {
  vertical-align: middle !important;
  text-align: right !important;
  white-space: nowrap !important;
  width: 1%;
  padding: 8px 10px !important;
}
.admin-parts-grid td.actions > *,
table.grid td.actions > * {
  display: inline-flex !important;
  vertical-align: middle;
}
.admin-parts-grid td.actions {
  display: table-cell !important;
  width: 56px !important;
  padding: 8px 4px !important;
  text-align: center !important;
  vertical-align: middle !important;
}
.admin-parts-grid td.actions .dd {
  display: inline-block !important;
  margin: 0 !important;
}
.admin-parts-grid td.actions .dd > summary {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.icon-btn.bulk-act.on {
  background: #d6e4ff !important;
  color: var(--blue) !important;
  border-color: var(--blue) !important;
  box-shadow: inset 0 0 0 1px var(--blue);
}
.icon-btn.bulk-act.danger.on {
  background: #fbd5d5 !important;
  color: #c0392b !important;
  border-color: #c0392b !important;
  box-shadow: inset 0 0 0 1px #c0392b;
}
.edit-layout .tabs,
form.form .tabs {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  gap: 2px !important;
  padding-bottom: 2px !important;
  scrollbar-width: thin;
}
.edit-layout .tabs .tab-btn,
form.form .tabs .tab-btn {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  padding: 9px 8px !important;
  font-size: 12.5px !important;
}
#app-list {
  text-align: left !important;
}
#app-list .app-brand > label {
  justify-content: flex-start !important;
  width: 100%;
}
#app-list .app-brand-chk,
#app-list .app-model-chk {
  flex: 0 0 auto;
}
#app-list .app-models {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 10px 28px;
}
#app-list .app-models.open {
  display: flex;
}
#app-list .app-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
#app-list .app-chip:hover {
  border-color: var(--blue);
}
#app-list .app-chip input[type="checkbox"] {
  margin: 0;
  width: 15px;
  height: 15px;
}
#app-list .app-chip span {
  white-space: nowrap;
}
#app-list .app-brand {
  margin-bottom: 2px;
}
#app-list .app-brand > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0;
}
#app-list .app-brand-chk {
  width: 17px;
  height: 17px;
  margin: 0;
}
.tab-panel[hidden] {
  display: none !important;
}

/* ---------- Карточки товаров: каталог и главная ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.pc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 14px;
  align-items: stretch;
  margin: 0 0 6px;
}
.pc {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.pc:hover {
  box-shadow: 0 6px 22px rgba(20, 30, 50, .12);
  transform: translateY(-2px);
}
/* Фото: всегда квадрат, товар виден целиком; пустые поля заполняет размытая копия самого фото */
.pc-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f3f5f8;
}
.pc-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(16px) saturate(1.1);
  transform: scale(1.2);
  opacity: .6;
}
.pc-img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform .25s ease;
}
.pc:hover .pc-img {
  transform: scale(1.04);
}
.pc-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 800;
  color: #b9c6da;
}
.pc .card-badges {
  z-index: 3;
}
.pc-ribbon {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(26, 26, 26, .78);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.5;
}
.pc-ribbon.opt {
  background: #0cb477;
}
.pc-top {
  position: relative;
}
.pc-admin {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 40;
  display: none;
  gap: 4px;
}
.pc:hover .pc-admin {
  display: flex;
}
.pc-admin form {
  display: inline-flex;
  margin: 0;
}
.pc-admin .icon-btn {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, .94);
}
.pc-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px 12px;
}
.pc-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  color: var(--muted);
}
.pc-meta b {
  color: #3b4654;
  font-weight: 700;
}
.pc-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.35em * 2);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  color: #1a1a1a;
}
.pc-title:hover {
  color: var(--blue);
}
.pc-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  min-height: 18px;
  font-size: 12px;
  color: #6b7684;
}
.pc-rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  color: #1a1a1a;
}
.pc-rating .star {
  color: #ff9f29;
}
.pc-stock {
  color: #0a9a62;
  font-weight: 600;
}
.pc-stock.low {
  color: #c25a00;
}
.pc-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.pc-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-height: 26px;
}
.pc-price b {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}
.pc-price s {
  font-size: 13px;
  color: var(--muted);
}
.pc-ask {
  font-size: 14px;
  color: #6b7684;
}
.pc .cart-widget {
  display: flex;
  align-items: center;
  min-height: 40px;
}
.pc .cart-widget form {
  flex: 1;
  margin: 0;
}
.pc .cart-widget .btn-add {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 10px;
  font-size: 14px;
}
.pc .cart-widget .qty-stepper {
  display: flex;
  width: 100%;
}
.pc .cart-widget .qty-stepper > * {
  flex: 1 1 0;
  min-width: 0;
}
.pc-btn-off {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f4f6f9;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: not-allowed;
}

/* ---------- Фильтры каталога ---------- */
.cf {
  margin: 0 0 16px;
  padding: 14px 16px 12px;
  background: #fff;
  border-radius: 16px;
}
.cf-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
}
.cf-label {
  flex: 0 0 96px;
  padding-top: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.cf-chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.cf-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f2f5f9;
  color: #3b4654;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.cf-chip:hover {
  background: #e7f0ff;
  color: var(--blue);
}
.cf-chip.active {
  background: var(--blue);
  color: #fff;
}
.cf-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.cf-found {
  font-size: 13.5px;
  color: #6b7684;
}
.cf-found b {
  color: #1a1a1a;
}
.cf-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cf-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #3b4654;
  font-size: 13px;
  white-space: nowrap;
}
.cf-tool:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.cf-tool.on {
  border-color: var(--blue);
  background: #eef4ff;
  color: var(--blue);
}
.cf-check {
  position: relative;
  width: 16px;
  height: 16px;
  border: 1.5px solid #b9c6da;
  border-radius: 5px;
  background: #fff;
}
.cf-tool.on .cf-check {
  border-color: var(--blue);
  background: var(--blue);
}
.cf-tool.on .cf-check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.cf-sort select {
  height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7684' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  color: #3b4654;
  font: inherit;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.cf-reset {
  font-size: 13px;
  color: var(--danger);
}
.cf-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.cf-tabs .cf-chip {
  border-color: var(--border);
  background: #fff;
}
.cf-tabs .cf-chip:hover {
  background: #e7f0ff;
}
.cf-tabs .cf-chip.active {
  border-color: var(--blue);
  background: var(--blue);
}

/* ---------- Разделы и группы каталога ---------- */
.cat-section {
  margin: 0 0 24px;
}
.cat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 20px;
}
.cat-count,
.grp-n {
  padding: 2px 10px;
  border-radius: 999px;
  background: #e7f0ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}
.grp {
  margin: 0 0 12px;
}
.grp-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  list-style: none;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.grp-title::-webkit-details-marker {
  display: none;
}
.grp-arr {
  margin-left: auto;
  color: var(--muted);
  transition: transform .2s;
}
.grp:not([open]) .grp-arr {
  transform: rotate(-90deg);
}
/* Группы по моделям авто идут «потоком»: каждая группа занимает столько колонок, сколько в ней товаров,
   а следующие небольшие группы заполняют пустоту рядом (grid dense) — справа больше нет пустых мест */
.grp-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row dense;
  align-items: start;
  gap: 4px 14px;
}
.grp-flow .grp {
  grid-column: span var(--n5, 1);
  min-width: 0;
  margin: 0 0 10px;
}
.grp-flow .grp .pc-grid {
  grid-template-columns: repeat(var(--n5, 1), minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1199px) {
  .grp-flow {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .grp-flow .grp {
    grid-column: span var(--n4, 1);
  }
  .grp-flow .grp .pc-grid {
    grid-template-columns: repeat(var(--n4, 1), minmax(0, 1fr));
  }
}
@media (max-width: 899px) {
  .grp-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grp-flow .grp {
    grid-column: span var(--n3, 1);
  }
  .grp-flow .grp .pc-grid {
    grid-template-columns: repeat(var(--n3, 1), minmax(0, 1fr));
  }
}
.grp-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-empty {
  padding: 40px 20px;
  border-radius: 16px;
  background: #fff;
  text-align: center;
}
.cat-empty-ico {
  font-size: 40px;
  line-height: 1;
}
.cat-empty h2 {
  margin: 12px 0 6px;
  font-size: 18px;
}
.cat-empty p {
  max-width: 420px;
  margin: 0 auto 16px;
  color: var(--muted);
  line-height: 1.5;
}
.cat-empty .btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 42px;
  padding: 0 22px;
}

/* ---------- Главная: быстрые входы ---------- */
.home-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
.home-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: #fff;
  transition: box-shadow .18s, transform .18s;
}
.home-card:hover {
  box-shadow: 0 6px 22px rgba(20, 30, 50, .10);
  transform: translateY(-2px);
}
.home-ico {
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #eef4ff;
  color: var(--blue);
}
.home-ico svg {
  width: 26px;
  height: 26px;
}
.home-card b {
  display: block;
  font-size: 15px;
}
.home-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

/* ---------- Каталог и главная: телефон ---------- */
@media (max-width: 900px) {
  .home-quick {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .home-card {
    padding: 12px 14px;
  }
}
@media (max-width: 640px) {
  .pc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .pc:hover {
    transform: none;
  }
  .pc-img {
    padding: 6px;
  }
  .pc-body {
    gap: 4px;
    padding: 8px 10px 10px;
  }
  .pc-title {
    font-size: 13px;
  }
  .pc-price b {
    font-size: 17px;
  }
  .pc .cart-widget,
  .pc .cart-widget .btn-add,
  .pc-btn-off {
    height: 38px;
    min-height: 38px;
  }
  .pc .fav-toggle {
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
  }
  .cf {
    padding: 12px 14px 10px;
    border-radius: 14px;
  }
  .cf-row {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 4px 0;
  }
  .cf-label {
    flex: none;
    padding-top: 0;
    font-size: 11px;
  }
  .cf-chips,
  .cf-scroll {
    flex: none;
    width: auto;
    flex-wrap: nowrap;
    margin: 0 -14px;
    padding: 2px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cf-chips::-webkit-scrollbar,
  .cf-scroll::-webkit-scrollbar {
    display: none;
  }
  .cf-tabs {
    flex-wrap: nowrap;
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .cf-tabs::-webkit-scrollbar {
    display: none;
  }
  .cf-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .cf-tools {
    width: 100%;
  }
  .cf-sort {
    flex: 1 1 100%;
  }
  .cf-sort select {
    width: 100%;
    height: 40px;
    font-size: 14px;
  }
  .cf-tool {
    flex: 1 1 auto;
    justify-content: center;
    height: 40px;
  }
  .cat-title {
    font-size: 18px;
  }
  .grp-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
  }
  .grp-flow .grp {
    grid-column: span var(--n2, 1);
    margin-bottom: 8px;
  }
  .grp-flow .grp .pc-grid {
    grid-template-columns: repeat(var(--n2, 1), minmax(0, 1fr));
    gap: 8px;
  }
}

/* ---------- Заголовок страницы, подбор по авто ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 18px 0 14px;
}
.fit {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #fff;
  border-radius: 16px;
}
.fit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.fit-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.fit-label {
  padding-left: 30px;
  font-size: 13px;
  font-weight: 600;
  color: #3b4654;
}
.fit-label small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--muted);
}
.fit-step {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.fit-step.opt {
  background: #c9d3e2;
}
.fit-field select {
  width: 100%;
  height: 44px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7684' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.fit-field select:focus {
  border-color: var(--blue);
}
.fit-field select:disabled {
  background-color: #f4f6f9;
  color: var(--muted);
}
.fit .fit-go {
  width: auto;
  height: 44px;
  margin: 0;
  padding: 0 28px;
}
.fit-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 12px;
}
@media (max-width: 900px) {
  .fit-grid {
    grid-template-columns: 1fr 1fr;
  }
  .fit .fit-go {
    grid-column: 1 / -1;
    width: 100%;
  }
}
@media (max-width: 640px) {
  .fit {
    padding: 14px;
    border-radius: 14px;
  }
  .fit-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .fit-field select {
    font-size: 16px;
  }
}

/* ---------- Чекбокс в стиле сайта ---------- */
input.chk {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  border: 2px solid #b9c6da;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
input.chk:hover {
  border-color: var(--blue);
}
input.chk:focus-visible {
  outline: 2px solid rgba(0, 91, 255, .45);
  outline-offset: 2px;
}
input.chk:checked,
input.chk:indeterminate {
  border-color: var(--blue);
  background: var(--blue);
}
input.chk:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg);
}
input.chk:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 7px;
  height: 2px;
  border-radius: 1px;
  background: #fff;
}
input.chk:disabled {
  opacity: .5;
  cursor: not-allowed;
}
@media (pointer: coarse) {
  input.chk {
    width: 24px;
    height: 24px;
  }
  input.chk:checked::after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
  }
  input.chk:indeterminate::after {
    top: 9px;
  }
}

/* Заглушка «нет фото»: спокойная линейная иконка вместо эмодзи (эмодзи в разных ОС выглядят по-разному) */
.ph-none {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b9c6da !important;
  font-size: 0 !important;
  opacity: 1 !important;
}
.ph-none .ph-ico {
  display: block;
  flex: 0 0 auto;
}


/* ================================================================
   Живые градиенты (ненавязчивые). Все страницы: витрина (<body class="site">) и админка (<body class="is-admin">, там фон приглушён).
   Анимируются transform/opacity/background-position у небольших элементов — нагрузка на устройство минимальна.
   У тех, кто отключил анимацию в системе (prefers-reduced-motion), всё остаётся статичным.
   Выключить всё разом: удалить этот блок.
   ================================================================ */
:root { --g1: #2f80ed; --g2: #7c5cff; --g3: #14b8a6; }

/* 1. Фон: небольшой анимированный градиент под шапкой + мягкие пятна по краям.
      Движется очень медленно (transform), поэтому не отвлекает и почти не нагружает устройство. */
body:is(.site, .is-admin)::before {
  content: ""; position: fixed; inset: -18vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(36vmax 30vmax at 12% 8%,  rgba(47, 128, 237, .32), transparent 62%),
    radial-gradient(34vmax 28vmax at 88% 6%,  rgba(124, 92, 255, .27), transparent 62%),
    radial-gradient(38vmax 30vmax at 52% 0%,  rgba(20, 184, 166, .21), transparent 64%),
    radial-gradient(44vmax 40vmax at 78% 96%, rgba(47, 128, 237, .17), transparent 62%),
    radial-gradient(40vmax 36vmax at 6% 92%,  rgba(124, 92, 255, .15), transparent 62%);
}
/* вторая подложка: полоса-градиент у верхнего края страницы, плавно растворяется вниз */
body:is(.site, .is-admin)::after {
  content: ""; position: fixed; left: 0; right: 0; top: 0; height: 420px; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, rgba(47, 128, 237, .22), rgba(124, 92, 255, .19) 35%, rgba(20, 184, 166, .16) 65%, rgba(47, 128, 237, .22));
  background-size: 260% 100%;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%); mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
}

/* 1б. Шапка: очень светлый плавающий градиент вместо плоской белой заливки */
body:is(.site, .is-admin) .header { background: linear-gradient(100deg, #ffffff 0%, #f1f6ff 32%, #f6f1ff 62%, #ffffff 100%); background-size: 260% 100%; }

/* 2. Тонкая светящаяся линия под шапкой */
body:is(.site, .is-admin) .header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--g1), var(--g2), var(--g3), var(--g1)); background-size: 300% 100%; opacity: .85;
}

/* 3. Логотип: градиент в тексте */
body:is(.site, .is-admin) .logo {
  background: linear-gradient(90deg, #005bff, #7c5cff 45%, #005bff 90%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #005bff;
}

/* 4. Главные кнопки: мягкий градиент, при наведении — подъём, свечение и блик */
body:is(.site, .is-admin) .btn-add, body:is(.site, .is-admin) .header-search button {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(135deg, #2f80ed 0%, #005bff 55%, #4b3df5 100%); background-size: 180% 180%; background-position: 0% 50%;
  transition: background-position .5s ease, box-shadow .2s ease, transform .15s ease;
}
body:is(.site, .is-admin) .btn-add::after, body:is(.site, .is-admin) .header-search button::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; transform: translateX(-130%);
  background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, .38) 50%, transparent 68%);
}
body:is(.site, .is-admin) .btn-add:hover, body:is(.site, .is-admin) .header-search button:hover { background-position: 100% 50%; box-shadow: 0 6px 18px rgba(0, 91, 255, .28); }
body:is(.site, .is-admin) .btn-add:hover::after, body:is(.site, .is-admin) .header-search button:hover::after { transform: translateX(130%); transition: transform .7s ease; }
body:is(.site, .is-admin) .btn-add:active { transform: translateY(1px); box-shadow: none; }

/* 5. Контурные кнопки: заливка-градиент при наведении */
body:is(.site, .is-admin) .btn-outline { transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
body:is(.site, .is-admin) .btn-outline:hover { background: linear-gradient(135deg, #f1f6ff, #ece9ff); box-shadow: 0 3px 12px rgba(0, 91, 255, .12); }

/* 6. Карточки товаров: при наведении — тонкая цветная рамка-градиент */
body:is(.site, .is-admin) .card { position: relative; }
body:is(.site, .is-admin) .card::before {
  content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0; transition: opacity .25s ease;
  background: linear-gradient(135deg, rgba(47, 128, 237, .85), rgba(124, 92, 255, .75), rgba(20, 184, 166, .7), rgba(47, 128, 237, .85)); background-size: 300% 300%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
body:is(.site, .is-admin) .card:hover::before { opacity: 1; }

/* 7. Заголовки разделов: короткая цветная черта под названием (не двигает вёрстку). Только на витрине — в админке заголовки без черты */
body.site .section-title { position: relative; }
body.site .section-title::after {
  content: ""; position: absolute; left: 0; bottom: -7px; width: 44px; height: 3px; border-radius: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--g1), var(--g2), var(--g3)); background-size: 200% 100%;
}

/* 8. Подвал: тонкая градиентная линия сверху */
body:is(.site, .is-admin) .footer { position: relative; }
body:is(.site, .is-admin) .footer::before { content: ""; position: absolute; top: 0; left: 15%; right: 15%; height: 1px; background: linear-gradient(90deg, transparent, #b9ccff, #d6c9ff, #b9ccff, transparent); }

/* в админке — вдвое спокойнее */
body.is-admin::before, body.is-admin::after { opacity: .55; }

/* ---------- Анимация (только если пользователь её не отключил) ---------- */
@keyframes aurora-drift { 0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } 50% { transform: translate3d(3vmax, -2vmax, 0) rotate(6deg) scale(1.06); } 100% { transform: translate3d(-3vmax, 2vmax, 0) rotate(-5deg) scale(1.02); } }
@keyframes grad-flow { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
@keyframes grad-sheen { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes ring-spin { 0% { background-position: 0% 0%; } 100% { background-position: 300% 300%; } }
@media (prefers-reduced-motion: no-preference) {
  body:is(.site, .is-admin)::before { animation: aurora-drift 34s ease-in-out infinite alternate; will-change: transform; }
  body:is(.site, .is-admin)::after { animation: grad-flow 24s linear infinite; }
  body:is(.site, .is-admin) .header::after { animation: grad-flow 16s linear infinite; }
  body:is(.site, .is-admin) .logo { animation: grad-sheen 12s ease-in-out infinite; }
  body:is(.site, .is-admin) .header { animation: grad-sheen 22s ease-in-out infinite; }
  body.site .section-title::after { animation: grad-sheen 9s ease-in-out infinite; }
  body:is(.site, .is-admin) .card:hover::before { animation: ring-spin 5s linear infinite; }
}
@media (max-width: 640px) { body:is(.site, .is-admin)::before { animation-duration: 60s; } body:is(.site, .is-admin)::after { height: 240px; animation-duration: 40s; } }
@media print { body:is(.site, .is-admin)::before, body:is(.site, .is-admin)::after, body:is(.site, .is-admin) .header::after, body:is(.site, .is-admin) .section-title::after { display: none; } }

/* ---------- Каталог: шапка фильтров v2 — раздельные блоки «Категория / Марка / Модель», явные выбранные чипы ---------- */
.cf { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; box-shadow: 0 6px 24px rgba(30, 50, 90, .06); }
.cf-row { --k: var(--blue); --k-soft: #eaf1ff; --k-line: #cfe0ff; align-items: flex-start; gap: 14px; padding: 12px 14px; border: 1px solid var(--k-line); border-left: 4px solid var(--k); border-radius: 14px; background: linear-gradient(90deg, var(--k-soft), #fff 70%); }
.cf-row[data-kind="brand"] { --k: #6d4cf0; --k-soft: #f1edff; --k-line: #ddd3ff; }
.cf-row[data-kind="model"] { --k: #0f9b8e; --k-soft: #e6f7f5; --k-line: #bfe9e4; }
.cf-label { display: flex; align-items: center; gap: 7px; flex: 0 0 118px; padding-top: 9px; font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--k); }
.cf-lico { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 8px; background: var(--k); color: #fff; font-style: normal; flex: none; }
.cf-body { flex: 1; min-width: 0; }
.cf-row .cf-chips { gap: 8px; }
.cf-row .cf-chips.is-collapsed { max-height: 84px; overflow: hidden; }
.cf-row .cf-chip { height: 38px; padding: 0 15px; border: 1.5px solid #d5deec; border-radius: 12px; background: #fff; color: #1f2a3a; font-size: 13.5px; font-weight: 600; box-shadow: 0 1px 0 rgba(30, 50, 90, .04); transition: border-color .15s, background .15s, color .15s, box-shadow .15s, transform .1s; }
.cf-row .cf-chip:hover { border-color: var(--k); color: var(--k); background: #fff; box-shadow: 0 3px 10px rgba(30, 50, 90, .10); }
.cf-row .cf-chip:active { transform: scale(.97); }
.cf-row .cf-chip.cf-all { border-style: dashed; background: transparent; box-shadow: none; }
.cf-row .cf-chip.active { border-color: var(--k); background: var(--k); color: #fff; font-weight: 700; box-shadow: 0 4px 12px color-mix(in srgb, var(--k) 38%, transparent); }
.cf-row .cf-chip.active::before { content: "✓"; margin-right: 7px; font-weight: 800; }
.cf-row .cf-chip.cf-all.active { border-style: solid; }
.cf-ava { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0 8px 0 -6px; border-radius: 50%; background: var(--k-soft); color: var(--k); font-size: 11.5px; font-weight: 800; flex: none; }
.cf-chip.active .cf-ava { background: rgba(255, 255, 255, .22); color: #fff; }
.cf-row .cf-chip.active:has(.cf-ava)::before { content: none; }
.cf-more { margin-top: 8px; padding: 6px 14px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--k) 12%, #fff); color: var(--k); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.cf-more:hover { background: color-mix(in srgb, var(--k) 20%, #fff); }
.cf-bar { margin-top: 0; padding: 4px 2px 0; border-top: 0; }
.cf-found { font-size: 14px; }
.cf-tools { gap: 10px; }
.cf-switch { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 14px 0 8px; border: 1.5px solid #d5deec; border-radius: 12px; background: #fff; color: #1f2a3a; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.cf-switch .cf-knob { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #c5cfde; transition: background .15s; flex: none; }
.cf-switch .cf-knob::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.cf-switch.on { border-color: #19a25a; color: #0e7a43; background: #eefaf3; }
.cf-switch.on .cf-knob { background: #19a25a; } .cf-switch.on .cf-knob::after { left: 16px; }
.cf-seg { display: inline-flex; padding: 3px; border: 1.5px solid #d5deec; border-radius: 12px; background: #eef2f8; }
.cf-seg a { display: inline-flex; align-items: center; height: 30px; padding: 0 13px; border-radius: 9px; color: #4a5667; font-size: 13px; font-weight: 600; white-space: nowrap; }
.cf-seg a.on { background: #fff; color: var(--blue); box-shadow: 0 1px 4px rgba(30, 50, 90, .18); }
.cf-sort select { height: 38px; border: 1.5px solid #d5deec; border-radius: 12px; font-weight: 600; color: #1f2a3a; }
.cf-reset { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 12px; background: #fff0f4; font-weight: 700; }
@media (max-width: 640px) {
  .cf { padding: 10px; gap: 8px; }
  .cf-row { flex-direction: column; gap: 6px; padding: 10px 12px 8px; border-left-width: 4px; }
  .cf-label { flex: none; padding-top: 0; }
  .cf-body { width: 100%; }
  /* без горизонтальной прокрутки: чипы переносятся, длинный ряд — три строки и кнопка «Показать все» */
  .cf-row .cf-chips { flex: 1; width: auto; flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; gap: 7px; }
  .cf-row .cf-chips.is-collapsed { max-height: 136px; overflow: hidden; }
  .cf-row .cf-chip { height: 40px; padding: 0 13px; }
  .cf-more { width: 100%; margin-top: 10px; padding: 11px 14px; border-radius: 12px; font-size: 14px; }
  .cf-bar { flex-direction: column; align-items: stretch; }
  .cf-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cf-switch, .cf-seg { justify-content: center; min-width: 0; } .cf-switch { padding: 0 10px 0 8px; } .cf-seg a { flex: 1; justify-content: center; height: 34px; padding: 0 6px; font-size: 12.5px; }
  .cf-sort { grid-column: 1 / -1; } .cf-sort select { width: 100%; height: 42px; }
  .cf-reset { grid-column: 1 / -1; justify-content: center; height: 40px; }
}

/* ---------- Телефон: компактная шапка + нижняя панель вкладок + «Ещё» (v2) ---------- */
.nav-more { background: none; border: 0; font-family: inherit; cursor: pointer; }
.nav-sheet { display: none; }
@media (max-width: 860px) {
  /* шапка: логотип и поиск в одну строку */
  .header-inner { padding: 8px 12px; gap: 10px; flex-wrap: nowrap; }
  .logo { font-size: 21px; flex: none; }
  .header-search { min-width: 0; order: 0; flex: 1 1 0; }
  .header-search input { min-width: 0; height: 42px; padding: 0 12px; font-size: 16px; border-width: 1.5px; }
  .header-search button { width: 46px; height: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
  .header-search .hs-txt { display: none; }
  .header-search button .hs-ico { display: block; }
  .nav-toggle, .nav-popup { display: none !important; }

  /* нижняя панель */
  /* панель: сплошной фон (без backdrop-filter — он мерцает на iOS), своя графическая плоскость — не «прыгает» при сворачивании адресной строки */
  .header-nav { overflow: visible; display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 970; gap: 0; justify-content: space-around; align-items: stretch;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)); background: #fff; transform: translateZ(0); will-change: transform; contain: layout;
    border-top: 1px solid var(--border); box-shadow: 0 -6px 22px rgba(20, 40, 80, .10); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; view-transition-name: tabbar; }
  .header-nav .nav-item { position: relative; flex: 1 1 0; min-width: 0; padding: 8px 2px 6px; gap: 4px; border-radius: 12px; font-size: 11px; font-weight: 600; color: #6f7b8a; -webkit-tap-highlight-color: transparent; }
  .header-nav .nav-item svg { width: 25px; height: 25px; }
  .header-nav .nav-item span:not(.nav-icon-wrap):not(.cart-badge):not(.profile-dot) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-nav .nav-item { transition: color .15s, background-color .15s; touch-action: manipulation; }
  .header-nav .nav-item svg { transition: transform .12s ease; }
  .header-nav .nav-item:active, .header-nav .nav-item.tap { background: #eef3fb; } .header-nav .nav-item:active svg, .header-nav .nav-item.tap svg { transform: scale(.88); }
  .nav-more.open { color: var(--blue); } .nav-more.open svg { transform: rotate(90deg); }
  .header-nav .nav-item.active { color: var(--blue); }
  .header-nav .nav-item.active::before { content: ""; position: absolute; top: -5px; left: 28%; right: 28%; height: 3px; border-radius: 0 0 4px 4px; background: var(--blue); }
  .header-nav .nav-item.active svg { stroke-width: 2.1; }
  .header-nav a[href="/favorites"], .header-nav a[href="/logout"], .header-nav a[href="/profile"], .header-nav [data-snd-toggle] { display: none; }
  body.site, body.is-admin { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  body.kb-open .header-nav, body.chat-locked .header-nav { display: none; }
  body.kb-open.site, body.kb-open.is-admin { padding-bottom: 0; }

  /* плавающие кнопки — над панелью */
  /* плавающие «Корзина» и «Сообщения» на телефоне не нужны: они есть в нижней панели (чат поддержки — в «Ещё», новые ответы — точка на «Ещё») */
  #cart-fab, #chat-fab { display: none !important; }

  /* «Ещё» — выезжающая снизу панель */
  .nav-sheet { display: block; position: fixed; top: 0; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 960; pointer-events: none; overscroll-behavior: contain; }
  .nav-sheet .ns-bg { position: absolute; inset: 0; background: rgba(12, 22, 44, .45); opacity: 0; transition: opacity .2s; }
  .nav-sheet .ns-panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px 10px; border-radius: 22px 22px 0 0; background: #fff;
    box-shadow: 0 -10px 40px rgba(12, 22, 44, .22); transform: translateY(calc(100% + 90px)); visibility: hidden; transition: transform .26s cubic-bezier(.2, .85, .3, 1), visibility 0s .26s; max-height: 70vh; overflow-y: auto; }
  .nav-sheet.open { pointer-events: auto; }
  .nav-sheet.open .ns-bg { opacity: 1; }
  .nav-sheet.open .ns-panel { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2, .85, .3, 1), visibility 0s; }
  .nav-more .nm-dot { position: absolute; top: 6px; left: calc(50% + 6px); width: 9px; height: 9px; border-radius: 50%; background: #ff3b30; border: 2px solid #fff; }
  .ns-grip { width: 38px; height: 4px; margin: 2px auto 8px; border-radius: 4px; background: #d3dae6; }
  .ns-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 12px; border: 0; border-radius: 14px; background: none; color: #1f2a3d; font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; text-decoration: none; }
  .ns-row:active { background: #eef3fb; }
  .ns-row svg { width: 24px; height: 24px; flex: none; color: var(--blue); }
  .ns-row > span:not(.nav-icon-wrap):not(.cart-badge) { flex: 1; }
  .ns-row .nav-icon-wrap { flex: none; }
  .ns-row .ns-chev { margin-left: auto; font-style: normal; font-size: 24px; line-height: 1; color: #a6b1c2; }
  .ns-row[href="/logout"] { color: #c4103f; } .ns-row[href="/logout"] svg { color: #c4103f; }
  .ns-row .snd-ico-off { display: none; } .ns-row.snd-off .snd-ico-on { display: none; } .ns-row.snd-off .snd-ico-off { display: block; }
}
@media (min-width: 861px) { .nav-sheet { display: none !important; } .nav-more { display: none; } }
@media (max-width: 860px) and (max-height: 430px) and (orientation: landscape) {
  .header-nav .nav-item { flex-direction: row; gap: 6px; padding: 4px 2px; } .header-nav .nav-item svg { width: 20px; height: 20px; }
}
.header-search .hs-ico { display: none; }
@media (max-width: 860px) { .ns-row.has-unread::after { content: "новое"; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 800; } .ns-row.has-unread .ns-chev { margin-left: 8px; } .ns-row.has-unread > span:not(.nav-icon-wrap) { flex: 0 1 auto; } }

/* ---------- «Как приложение»: плавные переходы между страницами, панель и шапка остаются на месте ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .14s; }
::view-transition-group(tabbar), ::view-transition-group(topbar) { animation: none; }
::view-transition-old(tabbar), ::view-transition-old(topbar) { display: none; }
::view-transition-new(tabbar), ::view-transition-new(topbar) { animation: none; }
@media (max-width: 860px) {
  .header { view-transition-name: topbar; -webkit-tap-highlight-color: transparent; }
  a, button { -webkit-tap-highlight-color: rgba(0, 91, 255, .10); }
  html { -webkit-text-size-adjust: 100%; }
  .ns-tip { margin: 2px 8px 8px; padding: 12px 14px; border-radius: 12px; background: #eef4ff; color: #24436e; font-size: 14px; line-height: 1.45; }
  .ns-install svg { color: #14a14a; }
}
/* запущено с главного экрана (standalone): без адресной строки — учитываем «чёлку», убираем резиновую прокрутку и выделение интерфейса */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
  .header { padding-top: env(safe-area-inset-top, 0px); }
  .header-nav, .header, .nav-sheet { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .ns-install { display: none !important; }
}
@media (max-width: 860px) { .nav-sheet [hidden], .ns-row[hidden], .ns-tip[hidden] { display: none !important; } }

/* Карточка товара: артикул, название в 3 строки, «остаток — цена» в одной строке (ряды выровнены между карточками) */
.pc-meta { min-height: 1.4em; line-height: 1.4; }
.pc-meta span { overflow: hidden; text-overflow: ellipsis; }
.pc-title { -webkit-line-clamp: 3; min-height: calc(1.35em * 3); }
.pc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.pc-row .pc-stock { flex: 0 1 auto; min-width: 0; font-size: 12.5px; line-height: 1.25; }
.pc-row .pc-price { flex: 0 0 auto; margin-left: auto; flex-direction: column; flex-wrap: nowrap; align-items: flex-end; gap: 0; min-height: 0; text-align: right; }
.pc-row .pc-price b { white-space: nowrap; }
.pc-row .pc-price s { font-size: 12px; line-height: 1.1; }
.pc-row .pc-ask { font-size: 13px; }
@media (max-width: 640px) {
  .pc-row { min-height: 40px; gap: 6px; }
  .pc-row .pc-stock { font-size: 11.5px; }
  .pc-meta { font-size: 11px; }
}
.pc-row .pc-stock { white-space: nowrap; }
.pc-row .pc-ask { font-size: 12.5px; line-height: 1.2; max-width: 100%; }

/* Название на карточке: 4 строки, чуть уже по ширине */
.pc-title { -webkit-line-clamp: 4; min-height: calc(1.35em * 4); padding-right: 10%; }
@media (max-width: 640px) { .pc-title { padding-right: 6%; } }

/* ── Фото в карточке: пустые поля заполняются цветом краёв самого фото (цвет считает скрипт в base.html),
      размытая копия отключена — она давала тёмные полосы сверху и снизу ── */
.pc-bg { display: none !important; }
.pc-media { background: #fff; transition: background-color .2s ease; }

/* Ссылки-«таблетки» под списком и на странице товара (перелинковка): переносятся на новую строку и не расширяют страницу на телефоне */
.rl-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.rl-chip { display: inline-block; max-width: 100%; box-sizing: border-box; padding: 7px 14px; border-radius: 18px; background: #f2f5f9; color: #3b4654; font-size: 13px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; text-decoration: none; transition: background .15s, color .15s; }
.rl-chip:hover { background: #e7f0ff; color: var(--blue); }
.cat-seo, .crumbs { max-width: 100%; overflow-wrap: anywhere; }
.cat-h1 { overflow-wrap: anywhere; }

/* Текст категории под списком: свёрнут, но остаётся в коде страницы (его читают и поисковики, и покупатель по клику) */
.cat-about { margin: 0 0 6px; }
.cat-about > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: #8a94a3; font-size: 12.5px; list-style: none; user-select: none; }
.cat-about > summary::-webkit-details-marker { display: none; }
.cat-about > summary::before { content: "\203A"; display: inline-block; transition: transform .15s; }
.cat-about[open] > summary::before { transform: rotate(90deg); }
.cat-about > summary:hover { color: var(--blue); }

/* Хлебные крошки: не видны посетителю, остаются в коде для поисковых систем и скринридеров */
nav.crumbs{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important;display:block!important}

/* Чипы перелинковки: ровная сетка одинаковых колонок */
.rl-chips { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.rl-chip { display: flex !important; align-items: center; min-height: 38px; border-radius: 12px; }
@media (max-width: 520px) { .rl-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rl-chip { padding: 7px 10px; } }
.rl-chips { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.rl-chip { background: #fff; border: 1px solid #e3e8ef; color: #2b3542; }
.rl-chip:hover { border-color: #b9d0ff; }

/* Перелинковка: на всю ширину контейнера, плитки растягиваются и заполняют строку целиком */
.cat-seo { max-width: none !important; width: 100%; }
.rl-chips { display: flex !important; flex-wrap: wrap; gap: 10px; grid-template-columns: none; }
.rl-chip { flex: 1 1 200px; justify-content: center; text-align: center; padding: 10px 14px; }
@media (max-width: 520px) { .rl-chip { flex: 1 1 calc(50% - 10px); padding: 9px 8px; } }

/* Перелинковка: не видна посетителю, ссылки остаются в коде для поисковых систем */
.seo-only{position:absolute!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important}
