/* AMPER v18: flat catalog, content stability and administration polish */

.home-commerce-hero--without-categories {
  grid-template-columns: minmax(0, 1fr) 286px;
}

.home-category-mode {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.home-category-admin__row {
  min-width: 0;
}

.home-category-admin__row > div,
.home-category-admin__row b,
.home-category-admin__row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-section--subgroups {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.catalog-subgroup-option > span {
  overflow-wrap: anywhere;
}

.filter-section--subgroups .filter-options {
  margin-top: 12px;
}

.mega-root-entry {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  background: #f6f7f8;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.mega-root-entry > i {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--brand);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  font-size: 22px;
}

.mega-root-entry > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mega-root-entry b {
  font-size: 16px;
}

.mega-root-entry span {
  color: var(--muted);
  line-height: 1.4;
}

.mega-root-entry > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  color: #fff;
  background: var(--brand);
  border-radius: 9px;
  font-weight: 850;
  text-decoration: none;
}

.mega-subcategory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.catalog-mega { max-height: min(78vh, 720px); }
.catalog-mega__rail,
.catalog-mega__content { overflow-y: auto; }

.mega-subcategory {
  min-width: 0;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.mega-subcategory__title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
}

.mega-subcategory__title span { min-width: 0; overflow-wrap: anywhere; }
.mega-subcategory__title i { margin-top: 3px; color: var(--brand); font-size: 10px; }
.mega-subcategory__title:hover { color: var(--brand); }

.mega-subcategory__children {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.mega-subcategory__children a {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.mega-subcategory__children a:hover { color: var(--brand); }

@media (max-width: 980px) {
  .mega-subcategory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .catalog-mega { max-height: none; }
}

@media (max-width: 620px) {
  .catalog-mega {
    grid-template-rows: minmax(0, 40vh) minmax(0, 1fr);
    max-height: none;
    overflow: hidden;
  }
  .catalog-mega__rail { max-height: none; }
  .catalog-mega__content { display: block; padding: 16px; }
  .mega-panel__head h3 { font-size: 21px; }
  .mega-root-entry { display: none; }
  .mega-subcategory-grid { grid-template-columns: 1fr; margin-top: 0; }
}

body.article-page {
  display: block;
  min-width: 0;
}

body.article-page main.wrap {
  display: block;
  width: min(100% - 24px, 1180px);
  min-width: 0;
  margin-inline: auto;
}

.blog-head,
.featured-article,
.featured-article > *,
.news-grid,
.news-card,
.news-card__body,
.blog-article,
.blog-article > *,
.article-body {
  min-width: 0;
}

.featured-article {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
}

.featured-article h2,
.featured-article p,
.news-card h2,
.news-card h3,
.news-card p,
.blog-article h1,
.blog-body {
  overflow-wrap: anywhere;
  word-break: normal;
}

.news-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.news-card__body {
  flex: 1;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.news-card__body p {
  margin: 0;
}

.blog-cover,
.article-body img,
.article-body video,
.article-body iframe {
  display: block;
  max-width: 100%;
}

.article-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.article-body pre,
.article-body code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.article-body a {
  overflow-wrap: anywhere;
}

.admin-page .admin-two-col,
.admin-page .admin-two-col > *,
.admin-page .admin-form-card,
.admin-page .admin-table-card,
.admin-page .table-wrap {
  min-width: 0;
}

.admin-page .admin-form-card input,
.admin-page .admin-form-card select,
.admin-page .admin-form-card textarea {
  max-width: 100%;
}

.admin-page .admin-product-cell {
  min-width: 0;
}

.admin-page .admin-product-cell > div {
  min-width: 0;
}

.admin-page .admin-product-cell b,
.admin-page .admin-product-cell small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.characteristics-parser,
.characteristics-parser-report {
  margin-top: 18px;
}

.characteristics-facet-settings {
  margin-bottom: 18px;
}

.characteristics-facet-table th:last-child,
.characteristics-facet-table td:last-child {
  min-width: 220px;
}

.characteristics-filter-toggle .switch {
  width: max-content;
  max-width: 100%;
  cursor: pointer;
}

.characteristics-preview-table td:first-child {
  width: 40%;
  min-width: 270px;
}

.characteristics-preview-table td:first-child > small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.characteristics-preview-values {
  display: flex;
  min-width: 330px;
  flex-wrap: wrap;
  gap: 7px;
}

.characteristics-preview-values > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 6px 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.characteristics-preview-values > span > small {
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
}

.account-documents-page .document-row--extended {
  grid-template-columns: 52px minmax(180px, 1fr) minmax(110px, max-content);
}

.account-documents-page .document-row__main {
  gap: 4px;
}

.account-documents-page .document-edo-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  margin-top: 3px;
  padding: 5px 8px;
  color: #12653a;
  background: #eaf8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.account-documents-page .document-row__actions {
  display: flex;
  grid-column: 2 / -1;
  justify-self: end;
  min-width: 0;
  flex-flow: row wrap;
  justify-content: flex-end;
  gap: 7px;
}

@media (max-width: 1120px) {
  .home-commerce-hero--without-categories {
    grid-template-columns: minmax(0, 1fr) 250px;
  }

  .home-category-mode {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .home-commerce-hero--without-categories,
  .featured-article {
    grid-template-columns: 1fr;
  }

  .blog-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  body.article-page main.wrap {
    width: min(100% - 18px, 1180px);
  }

  .blog-article > header {
    text-align: left;
  }

  .blog-article > header h1 {
    font-size: clamp(30px, 11vw, 44px);
    line-height: 1.08;
  }

  .article-meta {
    align-items: flex-start;
  }

  .article-footer {
    padding: 21px;
  }

  .characteristics-preview-table td:first-child {
    width: auto;
    min-width: 220px;
  }

  .characteristics-preview-values {
    min-width: 260px;
  }

  .account-documents-page .document-row--extended {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .account-documents-page .document-row__actions {
    grid-column: 2;
    justify-self: stretch;
    justify-content: flex-start;
  }

  .account-documents-page .document-row__actions .smallbtn {
    width: auto;
    min-width: min(100%, 145px);
    flex: 1 1 145px;
  }
}
