:root {
  --color-bg: #FAF6EE;
  --color-surface: #FFFFFF;
  --color-text: #21301F;
  /* Было #6B7A64 — на сайте PageSpeed указал недостаточный контраст этого
     оттенка на фоне --color-bg (WCAG AA). Тот же фикс здесь — палитра общая
     с сайтом (см. site/src/app/globals.css). */
  --color-text-muted: #5B6855;
  --color-primary: #2F5B3C;
  --color-primary-hover: #24462E;
  --color-accent: #B5713F;
  /* Тот же безопасный по контрасту оттенок, что и на сайте (см.
     site/src/app/globals.css) — для статуса "Под заказ". */
  --color-accent-strong: #8A5429;
  --color-border: #E5DFCC;
  --color-danger: #A8442F;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(33, 48, 31, 0.08);
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.topbar__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-button {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 18px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
}

.cart-button {
  position: relative;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.cart-button__count {
  background: var(--color-accent);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  padding: 0 5px;
}

.catalog { padding: 14px; }

.catalog__searchRow {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.catalog__search {
  display: block;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 14px;
  background: var(--color-surface);
}
.catalog__search:focus { outline: none; border-color: var(--color-primary); }

.filter-toggle {
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-toggle[aria-expanded="true"] {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.filter-toggle__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.filter-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.filter-panel__group {
  margin-bottom: 14px;
}
.filter-panel__group:last-child { margin-bottom: 0; }

.filter-panel__title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
}

.filter-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.filter-chip--active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.filter-panel__range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-panel__range input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 13px;
  background: var(--color-bg);
  color: var(--color-text);
}
.filter-panel__range span { color: var(--color-text-muted); font-size: 12px; }

.filter-panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.filter-checkbox input { accent-color: var(--color-primary); width: 18px; height: 18px; }

.filter-reset {
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
}

.catalog__breadcrumb {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.catalog__breadcrumb a {
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
}
.catalog__breadcrumb a:hover { text-decoration: underline; }
.catalog__breadcrumb a:last-child {
  color: var(--color-text);
  font-weight: 600;
  pointer-events: none;
  text-decoration: none;
}

.category-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.category-tile {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.category-tile__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-border);
}

.category-tile__body { padding: 10px 12px; }

.category-tile__name {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.3;
}

.category-tile__count {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

.catalog__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

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

.product-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-border);
}

.product-card__body {
  padding: 10px 12px 12px;
}

.product-card__name {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__price {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
}

.product-card__stock {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 600;
  margin: 2px 0 0;
}
.product-card__stock--preorder {
  color: var(--color-accent-strong);
}
.product-card__stock--none {
  color: var(--color-text-muted);
  font-weight: 400;
}

.primary-button {
  width: 100%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  border-radius: var(--radius);
  cursor: pointer;
}

.primary-button:disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.primary-button:not(:disabled):active {
  background: var(--color-primary-hover);
}

.back-button {
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
}

.cart-view, .checkout-view, .consent-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.consent-row input {
  margin-top: 2px;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.consent-row a {
  color: var(--color-text);
  text-decoration: underline;
}

.success-view {
  padding: 14px;
}

.cart-view__header {
  margin-bottom: 12px;
}

.cart-view__header h2 {
  margin: 6px 0 0;
  font-size: 20px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}

.cart-item__image {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--color-border);
  flex-shrink: 0;
}

.cart-item__info {
  flex: 1;
  min-width: 0;
}

.cart-item__name {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item__price {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0;
}

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-item__remove {
  border: none;
  background: none;
  color: var(--color-danger);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
}

.qty-button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 16px;
  cursor: pointer;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.field small {
  font-weight: 400;
  font-size: 12px;
}

.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 400;
}

.checkout-note {
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.4;
}

.success-view {
  text-align: center;
  padding-top: 60px;
}

.success-view__icon { font-size: 48px; margin-bottom: 10px; }
.success-view h2 { margin: 0 0 8px; }
.success-view p { color: var(--color-text-muted); margin-bottom: 24px; white-space: pre-line; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 48, 31, 0.45);
}

.modal__sheet {
  position: relative;
  width: 100%;
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(33, 48, 31, 0.08);
  font-size: 16px;
  cursor: pointer;
  z-index: 2;
}

.modal__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-border);
}

.modal__body { padding: 16px; }
.modal__body h3 { margin: 0 0 8px; font-size: 18px; }
.modal__price { font-size: 20px; font-weight: 700; color: var(--color-primary); margin: 0 0 4px; }
.modal__stock { font-size: 13px; color: var(--color-text-muted); margin: 0 0 16px; }

.modal__qty {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.modal__qty span { font-size: 18px; font-weight: 700; min-width: 24px; text-align: center; }

.modal__stock-notify { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.modal__stock-notify-text { font-size: 13px; color: var(--color-text-muted); margin: 0; }
.modal__stock-notify input {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--color-bg);
}
.modal__stock-notify-status { font-size: 13px; color: var(--color-text-muted); margin: 0; }

/* Журнал изменений в админ-экране */
.admin-audit__title { margin: 24px 0 8px; font-size: 16px; }
.admin-audit { font-size: 13px; line-height: 1.4; }
.admin-audit__item { padding: 8px 0; border-bottom: 1px solid rgba(128, 128, 128, 0.25); word-break: break-word; }

/* --- Оптовики --- */
.wholesale-badge { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: rgba(46, 125, 50, 0.12); color: var(--color-primary); }
.wholesale-message { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px;
  background: rgba(46, 125, 50, 0.12); }
.wholesale-message--error { background: rgba(198, 40, 40, 0.12); }
.price-old { font-size: 12px; font-weight: 400; opacity: 0.6; margin-left: 4px; }
.ws-search { display: flex; gap: 8px; margin-bottom: 8px; }
.ws-row { padding: 8px 0; border-bottom: 1px solid rgba(128, 128, 128, 0.25); word-break: break-word; }
.ws-row__name { font-weight: 600; }
.ws-row__meta { font-size: 13px; opacity: 0.75; margin: 2px 0 6px; }
.secondary-button { border: 1px solid var(--color-primary); background: transparent; color: var(--color-primary);
  font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: var(--radius); cursor: pointer; margin: 4px 8px 4px 0; }

.orders-view { padding: 16px; }
.orders-list { list-style: none; padding: 0; margin: 12px 0; }
.orders-list li { padding: 10px 0; border-bottom: 1px solid rgba(128, 128, 128, 0.25); }
.orders-view .secondary-button { margin-top: 8px; }

/* Метка конца списка (автоподгрузка карточек) */
.catalog__sentinel {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 16px 0 0;
}

/* Кнопка «Наверх»: над модалкой не нужна (z-index ниже), справа внизу */
.scroll-top {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(33, 48, 31, 0.3);
  cursor: pointer;
}
.scroll-top:hover { background: var(--color-primary-hover); }

.orders-list__item { width: 100%; text-align: left; padding: 10px 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.order-card { margin: 12px 0; }
.order-card textarea { width: 100%; margin: 8px 0; box-sizing: border-box; }

.cdek-block { margin: 4px 0 8px; }
.cdek-list { list-style: none; padding: 0; margin: -4px 0 8px; border: 1px solid rgba(128, 128, 128, 0.35); border-radius: var(--radius); max-height: 200px; overflow-y: auto; }
.cdek-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
/* Пункты выдачи СДЭК: карточки с полным адресом и временем работы (вместо узкого списка с обрезанным текстом) */
.pickup-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pickup-item {
  display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
  padding: 12px; border-radius: 12px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: inherit; font: inherit; cursor: pointer;
}
.pickup-item--on { border: 2px solid var(--color-primary); padding: 11px; background: rgba(47, 91, 60, 0.05); }
.pickup-item__name { font-weight: 700; font-size: 15px; }
.pickup-item__addr { font-size: 14px; }
.pickup-item__hours { font-size: 13px; color: var(--color-text-muted); }
.pickup-more {
  width: 100%; margin-bottom: 8px; padding: 12px; border-radius: 12px; font: inherit; font-weight: 600;
  border: 1px solid var(--color-border); background: var(--color-surface); color: inherit; cursor: pointer;
}
.checkout-note--error { color: #c0392b; }
.submit-hint ul { margin: 4px 0 0; padding-left: 20px; }
.submit-hint li { margin: 2px 0; }

/* Значки на фото (зимостойкость, высота) и характеристики в окне товара */
.product-card__media, .modal__media { position: relative; }
.photo-badges {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none;
}
.photo-badge {
  background: rgba(255, 255, 255, 0.95); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: 8px;
  padding: 3px 7px; font-size: 12px; font-weight: 700; line-height: 1.2;
}
.modal__specs { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; line-height: 1.5; }
.modal__specs:empty { display: none; }
.modal__spec-label { color: var(--color-text-muted, #6b6b5f); }

.admin-select { width: 100%; max-width: 100%; margin: 4px 0 10px; padding: 10px; font: inherit; border-radius: 10px;
  border: 1px solid rgba(128, 128, 128, 0.4); background: transparent; color: inherit; }

/* Партнёры: список разделов для сбора */
.pt-cats { max-height: 220px; overflow: auto; margin: 4px 0 10px; padding: 6px 10px; border: 1px solid rgba(128, 128, 128, 0.35); border-radius: 10px; }
.pt-cats label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.pt-cats input { margin-top: 3px; }

