:root {
  --rr-black: #0f0f10;
  --rr-black-soft: #1a1b1f;
  --rr-white: #f4f5f7;
  --rr-white-strong: #ffffff;
  --rr-red: #c1121f;
  --rr-red-soft: #8d0d16;
  --rr-line: #2a2c31;
  --rr-muted: #e3e6ea;
  --rr-radius: 18px;
  --rr-shadow: 0 22px 44px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--rr-black);
  color: var(--rr-white);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

.site-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--rr-line);
  background: linear-gradient(180deg, #101114 0%, #18191d 100%);
  padding: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar__eyebrow,
.catalog-header__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--rr-red);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

.sidebar h1,
.catalog-header h2,
.modal h3 {
  margin: 0;
  font-weight: 700;
  color: var(--rr-white-strong);
}

.sidebar__copy,
.catalog-header h2,
.toolbar__meta,
.active-filter,
.modal__breadcrumb,
.modal__description,
.feedback {
  color: var(--rr-muted);
}

.search-field span,
.category-node__count,
.product-card__path {
  color: var(--rr-muted);
}

.sidebar__close,
.menu-toggle,
.toolbar__clear,
.modal__close {
  border: 0;
  background: transparent;
  color: var(--rr-white);
  cursor: pointer;
}

.sidebar__close {
  display: none;
  font-size: 1.7rem;
  line-height: 1;
}

.menu-toggle {
  display: none;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: var(--rr-red);
  font-weight: 700;
}

.category-tree {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.35rem;
}

.category-node {
  display: grid;
  gap: 0.25rem;
}

.category-node__button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--rr-white);
  text-align: left;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.category-node__button:hover,
.category-node__button.is-active {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.category-node__children {
  margin-left: 0.8rem;
  padding-left: 0.6rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 0.2rem;
}

.category-node__count {
  color: var(--rr-muted);
  font-size: 0.82rem;
}

.catalog-page {
  padding: 1.5rem 1.5rem 2rem;
}

.catalog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.search-field {
  display: grid;
  gap: 0.45rem;
  min-width: min(100%, 520px);
}

.search-field span {
  font-size: 0.9rem;
  color: var(--rr-muted);
}

.search-field input {
  width: 100%;
  border: 1px solid var(--rr-line);
  border-radius: 999px;
  background: var(--rr-black-soft);
  color: var(--rr-white);
  padding: 0.95rem 1rem;
}

.toolbar__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toolbar__clear {
  padding: 0.8rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rr-line);
}

.active-filter {
  min-height: 1.5rem;
  margin-bottom: 0.75rem;
}

.feedback {
  margin-bottom: 1rem;
}

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

.product-card {
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
  background: linear-gradient(180deg, #15161a 0%, #101114 100%);
  padding: 1rem;
  box-shadow: var(--rr-shadow);
  cursor: pointer;
  display: grid;
  gap: 0.9rem;
  color: var(--rr-white-strong);
}

.product-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.product-card__image,
.modal__media {
  background: #18191d;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.product-card__image {
  aspect-ratio: 1 / 1;
}

.product-card__image img,
.modal__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.product-card__placeholder,
.modal__placeholder {
  color: var(--rr-muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.product-card__code,
.modal__code {
  color: var(--rr-red);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-card__name {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--rr-white-strong);
}

.product-card__path {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.modal__panel {
  position: relative;
  width: min(960px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
  overflow: auto;
  border-radius: 24px;
  background: #111216;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.modal__media {
  min-height: 320px;
  margin: 1rem;
}

.modal__content {
  padding: 1.25rem 1.25rem 1.5rem 0;
  display: grid;
  gap: 0.9rem;
}

.modal__close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.3rem;
}

.modal__description p {
  margin: 0 0 0.8rem;
  line-height: 1.6;
  color: var(--rr-white-strong);
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.button--primary {
  background: var(--rr-red);
  color: var(--rr-white);
}

.button--secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--rr-white);
}

@media (max-width: 980px) {
  .site-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(320px, 100vw);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar__close,
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .modal__panel {
    grid-template-columns: 1fr;
  }

  .modal__media {
    min-height: 220px;
    margin-bottom: 0;
  }

  .modal__content {
    padding: 1rem 1rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .catalog-page {
    padding: 1rem 1rem 2rem;
  }

  .catalog-header,
  .toolbar,
  .toolbar__meta {
    display: grid;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }
}
