.mgf-search {
  position: relative;
  max-width: 720px;
  margin: .75rem auto;
}

.mgf-search form,
.mgf-query-row {
  display: flex;
}

.mgf-search input,
.mgf-query-row input {
  flex: 1;
  min-width: 0;
  padding: .75rem;
  border: 1px solid #b9c3cc;
  border-radius: 5px 0 0 5px;
  font-size: 1rem;
}

.mgf-search button,
.mgf-query-row button {
  border: 0;
  border-radius: 0 5px 5px 0;
  padding: .75rem 1.1rem;
  background: #167d8d;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.mgf-suggest {
  position: absolute;
  z-index: 1000;
  left: 0;
  right: 0;
  max-height: 440px;
  overflow: auto;
  background: #fff;
  border: 1px solid #d9e0e6;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
  -webkit-overflow-scrolling: touch;
}

.mgf-suggest[hidden] { display: none; }
.mgf-suggest a { display: flex; gap: .75rem; padding: .7rem; color: #1f2933; border-bottom: 1px solid #eef1f4; text-decoration: none; }
.mgf-suggest a:hover,
.mgf-suggest a:focus { background: #f3fafb; }
.mgf-suggest img,
.mgf-suggest-no-image { flex: 0 0 56px; width: 56px; height: 56px; object-fit: contain; background: #f4f6f8; }
.mgf-suggest span,
.mgf-suggest small { display: block; }
.mgf-suggest small { margin-top: .25rem; color: #657382; }

.mgf-page,
.mgf-page * {
  box-sizing: border-box;
}

.mgf-page {
  width: 100%;
  max-width: 100%;
}

.mgf-page-form {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.25rem;
}

.mgf-filters {
  max-width: 100%;
  margin-top: .8rem;
  overflow: hidden;
  border: 1px solid #dfe5ea;
  border-radius: 8px;
  background: #fff;
}

.mgf-filters summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 48px;
  padding: .8rem 1rem;
  color: #167d8d;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mgf-filters summary::-webkit-details-marker { display: none; }
.mgf-filters summary::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #edf7f8;
  color: #167d8d;
  font-size: 1.25rem;
  line-height: 1;
}

.mgf-filters[open] summary::after { content: "−"; }
.mgf-filters[open] summary { border-bottom: 1px solid #e8edf1; }
.mgf-filters summary:focus-visible { outline: 3px solid rgba(22, 125, 141, .28); outline-offset: -3px; }

.mgf-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: .8rem;
  padding: 1rem;
}

.mgf-filter-grid label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: .4rem;
  margin: 0;
  color: #27333d;
  font-weight: 600;
}

.mgf-filter-grid label > span {
  line-height: 1.35;
}

.mgf-filter-grid select {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: .6rem .7rem;
  border: 1px solid #aeb9c2;
  border-radius: 6px;
  background-color: #fff;
  color: #202a33;
  font: inherit;
  line-height: 1.25;
}

.mgf-filter-grid select:focus {
  border-color: #167d8d;
  box-shadow: 0 0 0 3px rgba(22, 125, 141, .18);
  outline: 0;
}

.mgf-filter-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1rem 1rem;
}

.mgf-filter-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  white-space: normal;
  text-align: center;
}

.mgf-count { margin: .75rem 0; color: #536170; overflow-wrap: anywhere; }
.mgf-approximate { margin-bottom: 1rem; }
.mgf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.mgf-card { display: flex; flex-direction: column; min-height: 430px; padding: 1rem; border: 1px solid #e1e6ea; border-radius: 8px; background: #fff; box-shadow: 0 2px 7px rgba(0, 0, 0, .035); }
.mgf-image-link { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; overflow: hidden; background: #f7f9fa; border-radius: 6px; }
.mgf-card img { width: 100%; height: 100%; object-fit: contain; }
.mgf-no-image { color: #7a8793; font-size: .85rem; }
.mgf-card h2 { margin: .75rem 0 .4rem; font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.mgf-card h2 a { color: #202a33; text-decoration: none; }
.mgf-card h2 a:hover { text-decoration: underline; }
.mgf-shop { margin: .15rem 0; color: #167d8d; font-weight: 700; }
.mgf-manufacturer,
.mgf-ref,
.mgf-stock { margin: .15rem 0; color: #657382; font-size: .88rem; overflow-wrap: anywhere; }
.mgf-price { margin: .6rem 0; font-size: 1.2rem; font-weight: 700; }
.mgf-origin { width: 100%; min-height: 44px; margin-top: auto; white-space: normal; }
.mgf-empty { grid-column: 1 / -1; padding: 1.25rem; border-radius: 7px; background: #f7f9fa; }
.mgf-show-more { margin: 1.5rem 0; text-align: center; }
.mgf-show-more .btn { border: 1px solid #167d8d; background: #fff; color: #167d8d; }
.mgf-show-more .btn:hover { background: #167d8d; color: #fff; }
.mgf-pages { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem; margin: 1.5rem 0 .5rem; }
.mgf-pages a,
.mgf-page-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 38px; padding: .4rem .65rem; border: 1px solid #cbd3da; border-radius: 4px; text-decoration: none; }
.mgf-pages a.active { border-color: #167d8d; background: #167d8d; color: #fff; }
.mgf-page-nav { min-width: auto !important; }
.mgf-page-summary { color: #657382; text-align: center; }
.mgf-global-trigger { margin-left: 8px; padding: 8px 10px; border: 0; border-radius: 4px; background: #167d8d; color: #fff; font-size: 12px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .mgf-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .mgf-page {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .mgf-query-row,
  .mgf-search form {
    flex-direction: column;
    gap: .65rem;
  }

  .mgf-search input,
  .mgf-query-row input {
    width: 100%;
    min-height: 50px;
    border-radius: 8px;
    font-size: 16px;
  }

  .mgf-search button,
  .mgf-query-row button {
    width: 100%;
    min-height: 50px;
    margin: 0;
    border-radius: 8px;
    font-size: 1rem;
  }

  .mgf-filters {
    margin-top: .75rem;
    border-radius: 10px;
  }

  .mgf-filters summary {
    min-height: 54px;
    padding: .85rem .9rem;
    font-size: 1rem;
  }

  .mgf-filter-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: .85rem;
    padding: .9rem;
  }

  .mgf-filter-grid label > span {
    font-size: .94rem;
  }

  .mgf-filter-grid select {
    min-height: 50px;
    padding: .7rem .75rem;
    font-size: 16px;
  }

  .mgf-filter-actions {
    position: sticky;
    z-index: 2;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    padding: .85rem .9rem;
    border-top: 1px solid #e8edf1;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -8px 18px rgba(31, 41, 51, .06);
  }

  .mgf-filter-actions .btn,
  .mgf-show-more .btn,
  .mgf-origin {
    width: 100%;
    min-height: 48px;
  }

  .mgf-filter-actions .btn-link {
    border: 1px solid #cbd3da;
    border-radius: 6px;
    text-decoration: none;
  }

  .mgf-card { min-height: 0; }
  .mgf-global-trigger { width: 100%; min-height: 44px; margin: 6px 0 0; }
  .mgf-pages a,
  .mgf-page-gap { min-width: 44px; min-height: 44px; }
}

@media (max-width: 420px) {
  .mgf-page-form { margin-bottom: 1rem; }
  .mgf-filter-grid { padding: .8rem; }
  .mgf-filter-actions { padding-left: .8rem; padding-right: .8rem; }
  .mgf-grid { grid-template-columns: minmax(0, 1fr); }
}

@supports (padding: max(0px)) {
  @media (max-width: 767px) {
    .mgf-filter-actions { padding-bottom: max(.85rem, env(safe-area-inset-bottom)); }
  }
}
