*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f4f2ef;
  -webkit-font-smoothing: antialiased;
}

:root {
  --accent: #6b7b6e;
  --accent-dark: #556358;
  --accent-soft: rgba(107, 123, 110, 0.12);
  --bg: #f4f2ef;
  --white: #ffffff;
  --text: #2c2a28;
  --muted: #8a8580;
  --border: #e5e1db;
  --sale: #b85c4a;
  --sidebar-w: 240px;
  --filters-w: 200px;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.header__burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.header__burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.header__logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.header__search {
  flex: 1;
  position: relative;
}

.header__search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.header__search input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  background: var(--bg);
}

.header__search input:focus {
  border-color: var(--accent);
  background: var(--white);
}

.header__cart {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.banner {
  position: relative;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--border);
}

.banner.is-hidden {
  display: none;
}

.banner__track {
  display: flex;
  transition: transform 0.4s ease;
}

.banner__slide {
  min-width: 100%;
  padding: 1.1rem 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.banner__slide--sand { background: linear-gradient(135deg, #ede6dc, #e8dfd3); }
.banner__slide--sage { background: linear-gradient(135deg, #dce5dc, #d0dbd0); }
.banner__slide--clay { background: linear-gradient(135deg, #e5d8cc, #ddd0c4); }

.banner__tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.55);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.banner__title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}

.banner__text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 90%;
}

.banner__cta {
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.banner__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.banner__nav--prev { left: 0.4rem; }
.banner__nav--next { right: 0.4rem; }

.banner__dots {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.35rem;
}

.banner__dots button {
  width: 6px;
  height: 6px;
  border: none;
  border-radius: 50%;
  background: rgba(44, 42, 40, 0.25);
  padding: 0;
  cursor: pointer;
}

.banner__dots button.is-active {
  background: var(--accent);
  width: 16px;
  border-radius: 4px;
}

.layout {
  flex: 1;
  display: flex;
  position: relative;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  z-index: 250;
  cursor: pointer;
}

.sidebar--catalog {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--white);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

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

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar__head h2 { font-size: 1rem; font-weight: 600; }

.sidebar__head button {
  border: none;
  background: var(--bg);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
}

.catalog-tree__all,
.catalog-tree__cat,
.catalog-tree__subs button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

.catalog-tree__all { font-weight: 600; }
.catalog-tree__group { border-bottom: 1px solid var(--border); }

.catalog-tree__cat {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}

.catalog-tree__cat.is-open .catalog-tree__arrow { transform: rotate(90deg); }
.catalog-tree__arrow { color: var(--muted); transition: transform 0.15s; }

.catalog-tree__subs { list-style: none; background: var(--bg); display: none; }
.catalog-tree__subs.is-open { display: block; }

.catalog-tree__subs button {
  padding-left: 1.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.catalog-tree__all.is-active,
.catalog-tree__cat.is-active,
.catalog-tree__subs button.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.sidebar--filters {
  position: fixed;
  top: 49px;
  left: 0;
  bottom: 0;
  width: min(260px, 80vw);
  z-index: 150;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(-100% + 36px));
  transition: transform 0.25s ease;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

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

.filters-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0.85rem 1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.sidebar--filters:not(.is-open) .filters-toggle {
  writing-mode: vertical-rl;
  justify-content: center;
  padding: 1rem 0.5rem;
  height: 100%;
  border-bottom: none;
  color: var(--accent-dark);
  font-size: 0.78rem;
}

.sidebar--filters:not(.is-open) .filters-toggle__arrow,
.sidebar--filters:not(.is-open) .filters-body { display: none; }

.filter-group { border-bottom: 1px solid var(--border); }

.filter-group__head {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.filter-group__head.is-open span:last-child { transform: rotate(90deg); }
.filter-group__body { padding: 0 0.75rem 0.75rem; display: none; }
.filter-group__body.is-open { display: block; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.filter-chips button {
  min-width: 36px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.filter-chips button.is-active,
.filter-colors button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.filter-colors { display: flex; flex-direction: column; gap: 0.25rem; }

.filter-colors button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.filter-colors__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filters-reset {
  display: block;
  width: calc(100% - 1.5rem);
  margin: 0.75rem auto;
  padding: 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: none;
  color: var(--accent-dark);
  font: inherit;
  cursor: pointer;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.5rem 2rem 2.5rem;
}

.content__top {
  display: flex;
  justify-content: space-between;
  padding: 0 0.25rem 0.65rem;
}

.content__title { font-size: 0.95rem; font-weight: 600; }
.content__count { font-size: 0.8rem; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}

.card.is-hidden { display: none; }

.card__image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #eee;
}

.card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card__badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  background: var(--sale);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.card__body { padding: 0.45rem 0.5rem 0.6rem; }

.card__price-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.card__price { font-size: 1rem; font-weight: 700; }
.card__price--lg { font-size: 1.35rem; }

.card__old-price {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: line-through;
}

.card__brand { font-size: 0.72rem; color: var(--muted); }

.card__title {
  font-size: 0.78rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__btn {
  display: block;
  width: 100%;
  padding: 0.55rem;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.card__btn--cart { background: var(--accent); color: #fff; }
.card__btn--order { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--accent); }
.card__btn--ask { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty.is-hidden { display: none; }

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.product-modal.is-open { display: flex; }

.product-modal__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

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

.product-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.product-modal__image {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 50vh;
  background: var(--bg);
}

.product-modal__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-modal__info {
  padding: 1rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.product-modal__brand {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
}

.product-modal__name { font-size: 1.15rem; font-weight: 600; }
.product-modal__desc { font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.product-modal__label { font-size: 0.85rem; font-weight: 600; }

.picker { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.picker button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font: inherit;
  cursor: pointer;
}

.picker button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.picker__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.product-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .header { padding: 0.65rem 1.25rem; }
  .header__logo { font-size: 1.5rem; }
  .banner__title { font-size: 1.25rem; }
  .banner__slide { padding: 1.25rem 3rem 1.6rem; }

  .sidebar--catalog {
    position: static;
    transform: none;
    width: var(--sidebar-w);
    display: none;
  }

  .sidebar--catalog.is-open { display: flex; }
  .overlay { display: none !important; }
  .sidebar__head button { display: none; }

  .sidebar--filters {
    position: static;
    transform: none;
    width: var(--filters-w);
  }

  .sidebar--filters:not(.is-open) .filters-toggle {
    writing-mode: horizontal-tb;
    height: auto;
    color: var(--text);
  }

  .sidebar--filters:not(.is-open) .filters-toggle__arrow,
  .sidebar--filters:not(.is-open) .filters-body { display: block; }

  .content { padding: 1rem; }
  .product-modal { align-items: center; padding: 1rem; }
  .product-modal__sheet { max-width: 480px; border-radius: 20px; }
}

@media (min-width: 1024px) {
  .grid { max-width: 720px; }
}
