:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --text: #252525;
  --muted: #69706b;
  --line: #d9ded8;
  --accent: #2f6f61;
  --accent-dark: #24564c;
  --chip: #eef3ee;
  --shadow: 0 18px 45px rgba(29, 37, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.logo-slot {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px dashed #9ca79f;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
}

.brand-subtitle,
.search span,
.filter-title,
.topbar p,
.meta {
  color: var(--muted);
  font-size: 13px;
}

.search {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fff;
}

.filter-group {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.filter-title {
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-option {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.25;
}

.filter-option input {
  margin-top: 1px;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.primary-button {
  width: fit-content;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 28px;
}

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

.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(20, 30, 24, 0.04);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #eef0eb;
}

.card-body {
  padding: 12px;
}

.card-title {
  min-height: 44px;
  margin-bottom: 9px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

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

.chip {
  border-radius: 999px;
  background: var(--chip);
  padding: 4px 8px;
  color: #435049;
  font-size: 12px;
}

.product-dialog {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-dialog::backdrop {
  background: rgba(20, 25, 22, 0.62);
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(360px, 58%) 1fr;
  max-height: calc(100vh - 36px);
}

.gallery {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 620px;
  background: #eff1ed;
}

.gallery img {
  max-width: 100%;
  max-height: calc(100vh - 90px);
  object-fit: contain;
}

.gallery-button,
.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  cursor: pointer;
}

.gallery-button {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 54px;
  border-radius: 6px;
  font-size: 34px;
  transform: translateY(-50%);
}

#prevImage {
  left: 14px;
}

#nextImage {
  right: 14px;
}

.image-counter {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 5px 10px;
  font-size: 13px;
}

.close-button {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  font-size: 26px;
  line-height: 1;
}

.product-details {
  overflow: auto;
  padding: 28px;
}

.product-details h2 {
  margin-right: 42px;
  font-size: 24px;
  line-height: 1.2;
}

.product-details section {
  margin-top: 24px;
}

.product-details p {
  white-space: pre-line;
  line-height: 1.55;
}

.characteristics {
  display: grid;
  grid-template-columns: minmax(120px, 42%) 1fr;
  gap: 10px 16px;
  margin: 0;
}

.characteristics dt {
  color: var(--muted);
}

.characteristics dd {
  margin: 0;
  font-weight: 600;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 18px;
  }

  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .gallery {
    min-height: 360px;
  }
}
