:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #dadce0;
  --text: #202124;
  --text-sub: #5f6368;
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --hover-bg: #f8f9fa;
  --tag-bg: #f1f3f4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

header {
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Google Sans', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}
.badge {
  background: #e8f0fe;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.search-box {
  width: 480px;
  max-width: 50vw;
}
.search-box input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: box-shadow .2s;
}
.search-box input:focus {
  box-shadow: 0 1px 6px rgba(32,33,36,.28);
  border-color: transparent;
}

.layout-container {
  width: 100%;
  padding: 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  align-items: start;
}

aside.sidebar {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  position: sticky;
  top: 80px;
}

aside.sidebar h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

.cat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text);
  transition: background .15s;
}
.cat-item:hover { background: var(--hover-bg); }
.cat-item.active {
  background: #e8f0fe;
  color: var(--primary);
  font-weight: 500;
}
.cat-item .cat-cnt {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--tag-bg);
  padding: 2px 6px;
  border-radius: 10px;
}
.cat-item.active .cat-cnt {
  background: #d2e3fc;
  color: var(--primary);
}

main { min-width: 0; }

.stats {
  color: var(--text-sub);
  font-size: 13px;
  margin-bottom: 20px;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow .2s, border-color .2s;
  background: var(--surface);
}
.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border-color: #bdc1c6;
}

.img-wrap {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  overflow: hidden;
  position: relative;
}
.img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Лейбл скидки поверх картинки */
.card-disc-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #d93025;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 1;
}
.no-img {
  color: #9aa0a6;
  font-size: 12px;
}

.prod-brand {
  color: var(--text-sub);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 4px;
}

.prod-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1a0dab;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prod-price {
  margin-top: 8px;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.card-cur-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
/* Зачёркнутая цена и % — только в модалке, в карточке не нужны */
.card-old-price { display: none; }

.rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 6px;
}
.star { color: #fbbc04; }

/* Модалка товара */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32,33,36,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 8px;
  max-width: 1100px;
  width: 96%;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  gap: 16px;
}
.modal-header h2 {
  font-family: 'Google Sans', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}
.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-sub);
  line-height: 1;
}

.modal-body {
  padding: 24px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.main-photo {
  width: 100%;
  height: 280px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.main-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.details dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  margin-bottom: 16px;
}
.details dt {
  color: var(--text-sub);
  font-size: 13px;
}
.details dd {
  font-size: 13px;
}

.section-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.text-block {
  font-size: 13px;
  white-space: pre-wrap;
  color: #3c4043;
  margin-bottom: 12px;
}

.html-content {
  font-size: 13px;
  color: #3c4043;
  line-height: 1.6;
  margin-bottom: 16px;
}
.html-content h2, .html-content h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  color: var(--text);
}
.html-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.html-content li {
  margin-bottom: 0;
}
.ProductAttributesList dl,
#mSpecs dl:has(dt) {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 4px 16px;
  align-items: baseline;
}
.html-content dl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.html-content dt {
  font-weight: 400;
  color: var(--text-sub);
  font-size: 13px;
}
.html-content dd {
  margin-left: 0;
  margin-bottom: 0;
  color: var(--text);
  font-size: 13px;
}
.html-content dd p {
  margin: 0;
}
.html-content a {
  color: #1a73e8;
  text-decoration: none;
}
.html-content a:hover {
  text-decoration: underline;
}

/* Блок организации / претензий с иконками */
.claim-list dd {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #3c4043;
}
.claim-list svg.claim-icon {
  flex-shrink: 0;
  stroke: #5f6368;
}

/* Сворачиваемые длинные секции инструкции */
.collapsible-section {
  position: relative;
  margin-bottom: 12px;
}
.collapsible-section.collapsed {
  max-height: 120px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
}
.collapsible-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0 10px 0;
  margin-top: 2px;
  font-family: inherit;
}
.collapsible-toggle:hover {
  text-decoration: underline;
}

.json-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
}
.json-link:hover { text-decoration: underline; }

@media (max-width: 860px) {
  header {
    padding: 10px 16px;
    gap: 12px;
  }
  .layout-container {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  aside.sidebar { position: static; }
  .modal-body { grid-template-columns: 1fr; }
  .search-box {
    width: auto;
    flex: 1;
    max-width: none;
  }
  .search-box input {
    padding: 8px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .brand {
    font-size: 16px;
  }
  .badge {
    font-size: 11px;
    padding: 2px 6px;
  }
  .search-box {
    width: 100%;
    order: 3;
  }
}

/* Кнопка "?" для разрешительного документа */
.permit-tooltip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #bdc1c6;
  background: transparent;
  color: #5f6368;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.permit-tooltip-btn:hover {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}
