:root {
  color-scheme: light;
  --bg: #ffffff;
  --soft: #f7f7f7;
  --line: #d7d7d7;
  --line-strong: #c4c4c4;
  --text: #4d4d4d;
  --muted: #888888;
  --brand: #7b4a99;
  --brand-dark: #62347c;
  --accent: #0b7a75;
  --warn: #a15c00;
  --bad: #a01834;
  --good: #207227;
  --order: #e40046;
  --shadow: 0 14px 36px rgba(48, 38, 54, 0.12);
  --shadow-soft: 0 8px 20px rgba(48, 38, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fbf9fc 0, #ffffff 220px), var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.utilitybar {
  display: flex;
  justify-content: space-between;
  min-height: 28px;
  padding: 4px 28px;
  background: #fbf9fc;
  color: var(--brand);
  border-bottom: 1px solid #ececec;
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid #eeeeee;
  box-shadow: 0 2px 12px rgba(40, 32, 45, 0.06);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 34px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 78px;
  height: 36px;
  padding: 0 12px;
  color: var(--brand);
  border: 2px solid var(--brand);
  box-shadow: inset 5px 0 0 var(--order);
  font-size: 18px;
  font-weight: 800;
}

.mainnav {
  display: flex;
  align-items: center;
  gap: 40px;
  color: #555;
  font-size: 18px;
}

.mainnav span:not(:last-child)::after {
  content: "›";
  margin-left: 40px;
  color: var(--brand);
  font-size: 30px;
  line-height: 0;
}

.nav-search {
  display: grid;
  grid-template-columns: minmax(250px, 340px) 50px;
}

h1,
h2,
p {
  margin: 0;
}

main {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.catalog-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 112px;
  display: grid;
  gap: 22px;
  margin-top: 48px;
  padding: 20px 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #eee7f2;
  box-shadow: var(--shadow-soft);
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-head strong {
  font-size: 18px;
}

input,
select,
button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 7px 10px;
}

button {
  cursor: pointer;
}

.nav-search input {
  height: 46px;
  background: #fbfbfb;
  font-size: 16px;
}

.icon-button {
  width: 50px;
  min-width: 50px;
  height: 46px;
  border-left: 0;
  color: var(--brand);
  font-size: 22px;
  font-weight: 800;
}

.icon-button:hover,
#clearFilters:hover {
  background: #f4eef7;
}

#clearFilters {
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.facet {
  display: grid;
  gap: 10px;
}

.facet + .facet {
  padding-top: 18px;
  border-top: 1px solid #eee7f2;
}

.facet-title {
  justify-content: flex-start;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #555;
  font-size: 18px;
  font-weight: 800;
}

.facet-title::after {
  content: "⌄";
  margin-left: 6px;
  color: var(--brand);
}

.facet-list {
  display: grid;
  gap: 13px;
}

.facet-check,
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #4f4f4f;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.facet-check:hover {
  color: var(--brand-dark);
}

.facet-check input,
.check input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  margin-top: 1px;
}

.results-panel {
  min-width: 0;
}

.category-head {
  padding: 58px 0 28px;
}

.category-head h1 {
  color: var(--brand);
  font-size: 54px;
  font-weight: 300;
  letter-spacing: 0;
}

.category-head h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-top: 12px;
  background: var(--order);
}

.category-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 8px;
  color: #555;
}

.summary strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.summary span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.sort-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #555;
  font-size: 16px;
  font-weight: 600;
}

.sort-label select {
  width: 190px;
  background: #fff;
}

.catalog-list {
  display: grid;
  gap: 18px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.product-card:hover {
  border-color: #c9b5d8;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.product-main {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr) 230px;
  gap: 32px;
  width: 100%;
  min-height: 270px;
  padding: 34px 28px 26px;
  border: 0;
  background: #fff;
  text-align: left;
}

.product-main:hover h2 {
  text-decoration: underline;
}

.image-box {
  position: relative;
  display: grid;
  place-items: center;
  width: 370px;
  height: 278px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
  border: 1px solid #eee;
  box-shadow: inset 0 -18px 28px rgba(0, 0, 0, 0.035);
}

.image-box img {
  max-width: 342px;
  max-height: 252px;
  object-fit: contain;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.12));
}

.image-box span {
  color: var(--muted);
  font-size: 12px;
}

.image-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 24px;
  padding: 4px 8px;
  background: rgba(98, 52, 124, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.product-copy {
  min-width: 0;
}

.product-line,
.availability-row,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.product-line {
  margin-bottom: 8px;
}

.aid {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge,
.stock-pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 9px;
  background: #f0e8f5;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.badge.old {
  background: #fff3df;
  color: var(--warn);
}

h2 {
  display: -webkit-box;
  max-width: 700px;
  min-height: 30px;
  overflow: hidden;
  color: var(--brand);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.facts {
  display: grid;
  gap: 5px;
  margin: 14px 0 20px 20px;
  padding: 0;
  color: #4e4e4e;
  font-size: 16px;
  line-height: 1.35;
}

.facts li::marker {
  color: var(--brand);
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eee;
  color: #9a9a9a;
  font-size: 13px;
}

.product-meta strong {
  color: #666;
}

.buy-box {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 10px;
  padding-top: 12px;
}

.price {
  color: var(--brand);
  font-size: 38px;
  font-weight: 300;
  line-height: 1.1;
  text-align: right;
}

.detail-link {
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
  padding: 13px 24px;
  background: var(--order);
  color: #fff;
  box-shadow: 0 8px 18px rgba(228, 0, 70, 0.2);
  font-size: 18px;
  font-weight: 800;
  transition: filter 120ms ease, transform 120ms ease;
}

.product-main:hover .detail-link,
.detail-link:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.availability-row {
  justify-content: flex-end;
}

.addons {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.addons strong {
  color: var(--text);
  font-size: 12px;
}

.addons span {
  display: inline-flex;
  min-height: 22px;
  padding: 3px 7px;
  background: #f4eef7;
  color: var(--brand-dark);
  font-weight: 700;
}

.stock-pill {
  justify-content: center;
}

.stock-pill.good {
  background: #e8f5e9;
  color: var(--good);
}

.stock-pill.warn {
  background: #fff4df;
  color: var(--warn);
}

.stock-pill.bad {
  background: #fde8ed;
  color: var(--bad);
}

.local-editor {
  display: grid;
  grid-template-columns: minmax(110px, 150px) minmax(110px, 150px) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 28px 18px 446px;
  border-top: 1px solid var(--line);
  background: #fbfafc;
}

.local-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.local-editor input {
  min-height: 34px;
}

.save-stock {
  min-height: 34px;
  padding: 0 14px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 800;
}

.save-stock:hover {
  filter: brightness(1.05);
}

dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px rgba(20, 14, 24, 0.28);
}

dialog::backdrop {
  background: rgba(23, 32, 42, 0.54);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  min-width: 38px;
  font-size: 24px;
}

.detail {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 36px;
  padding: 30px;
}

.gallery {
  display: grid;
  align-content: start;
  gap: 10px;
}

.detail-image {
  display: grid;
  place-items: center;
  min-height: 430px;
  background: linear-gradient(180deg, #fff 0%, #f8f8f8 100%);
  border: 1px solid var(--line);
}

.detail-image img {
  max-width: 100%;
  max-height: 430px;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.14));
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}

.gallery-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 54px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #fff;
  transition: border-color 120ms ease, transform 120ms ease;
}

.gallery-thumb.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px var(--brand);
}

.gallery-thumb:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.gallery-thumb img {
  max-width: 100%;
  max-height: 46px;
  object-fit: contain;
}

.detail h2 {
  display: block;
  min-height: 0;
  margin: 8px 44px 14px 0;
  overflow: visible;
  color: var(--brand);
  font-size: 28px;
}

.detail-price-panel {
  display: grid;
  gap: 10px;
  margin: 18px 0 6px;
  padding: 16px;
  background: #fbfafc;
  border: 1px solid #eee7f2;
}

.detail-price-panel > strong {
  color: var(--brand);
  font-size: 34px;
  font-weight: 300;
}

.detail-price-panel div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.detail-price-panel div > span:first-child {
  color: var(--text);
  font-weight: 800;
}

.detail-price-panel div > span:not(:first-child) {
  padding: 4px 8px;
  background: #f4eef7;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.detail-table th,
.detail-table td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.detail-table th {
  width: 190px;
  color: var(--muted);
  font-size: 13px;
}

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

  .filters {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 24px;
  }

  .filter-head,
  .check {
    grid-column: 1 / -1;
  }

  .mainnav {
    display: none;
  }
}

@media (max-width: 820px) {
  .utilitybar,
  .topbar,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar,
  .summary {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-search {
    grid-template-columns: 1fr 50px;
  }

  .filters,
  .product-main,
  .detail {
    grid-template-columns: 1fr;
  }

  .category-head {
    padding-top: 28px;
  }

  .category-head h1 {
    font-size: 42px;
  }

  .image-box {
    width: 100%;
    height: 190px;
  }

  .image-box img {
    max-width: 90%;
    max-height: 168px;
  }

  .buy-box {
    justify-items: start;
  }

  .price,
  .availability-row {
    text-align: left;
    justify-content: flex-start;
  }

  .addons {
    justify-items: start;
  }

  .local-editor {
    grid-template-columns: 1fr 1fr;
    padding-left: 18px;
  }

  .save-stock {
    grid-column: 1 / -1;
  }

  .product-meta {
    display: grid;
  }
}
