.market-search {
  display: block;
  padding: 24px 0;
  border-bottom: 1px solid #d4dccd;
  background: #f2f3e9;
  text-align: initial;
}

.market-search-heading {
  padding-top: 48px;
  /* Avoid doubling the root's responsive sticky-header scroll padding. */
  scroll-margin-top: 0;
}

.marketplace-headline-copy {
  max-width: 570px;
  margin: 14px 0 0;
  color: #68796f;
  font-size: 15px;
  line-height: 1.65;
}

.market-search .search-form {
  max-width: none;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(220px, 1fr) minmax(150px, .55fr) auto;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.market-search label {
  display: grid;
  gap: 7px;
  color: #123f33;
  font-size: 12px;
  font-weight: 850;
}

.market-search input,
.market-search select {
  min-width: 0;
  height: 52px;
  padding: 0 15px;
  border: 1px solid #cbd5c7;
  border-radius: 14px;
  background: #fff;
  color: #123f33;
  font-size: 16px;
}

.market-search button {
  align-self: end;
  display: block;
  height: 52px;
  min-width: 0;
  padding: 0 25px;
  border: 0;
  border-radius: 14px;
  background: #9ccb61;
  color: #123f33;
  font-weight: 900;
}

.market-search .search-reset {
  border: 1px solid #cbd5c7;
  background: #fff;
}

.market-search .search-actions {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 8px;
}

.market-search .search-location-toggle {
  display: none;
}

.market-search .search-location-field,
.market-search .search-radius-field {
  display: grid;
}

.market-search .search-location-field[hidden],
.market-search .search-radius-field[hidden] {
  display: none;
}

/* Search and result filters form one shared, docked marketplace control. */
.market-filter-dock {
  padding-top: 0;
}

.market-filter-shell {
  margin-top: 0;
  border-top: 0;
  border-radius: 0 0 22px 22px;
}

.market-filter-shell > .market-filter-disclosure {
  display: none;
  margin: 0;
}

/* Both marketplace entries share one layout and sizing contract for listing filters. */
.market-filter-shell .marketplace-filter-controls,
.market-filter-shell .filter-controls {
  display: grid;
  align-items: end;
  gap: 12px;
}

.market-listing-filter {
  grid-template-columns: max-content minmax(220px, 320px) minmax(240px, 1fr);
}

.market-price-filter-group {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 96px);
  gap: 8px;
}

.market-price-filter {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  justify-self: start;
}

.market-price-filter > input {
  width: 100%;
  box-sizing: border-box;
  padding-inline: 14px !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.market-price-filter > input::-webkit-inner-spin-button,
.market-price-filter > input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.market-listing-filter > label:not(.market-price-filter),
.market-listing-filter > label:not(.market-price-filter) > select {
  width: 100%;
  min-width: 0;
}

/*
 * Filter controls use one shared visual contract across the embedded and the
 * standalone marketplace. Search controls deliberately keep their softer
 * corners so search and result refinement remain visually distinct.
 */
.market-filter-shell .marketplace-result-toolbar select,
.market-filter-shell .result-toolbar select,
.market-filter-shell .market-listing-filter input,
.market-filter-shell .market-listing-filter select {
  height: 52px;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 20px;
  border: 1px solid #cbd5c7;
  border-radius: 999px;
  background: #fff;
  color: #123f33;
  font: inherit;
}

.market-filter-shell .marketplace-result-toolbar select,
.market-filter-shell .result-toolbar select,
.market-filter-shell .market-listing-filter select {
  padding-right: 42px;
  -webkit-appearance: none;
  appearance: none;
}

.market-filter-shell .marketplace-result-toolbar label,
.market-filter-shell .result-toolbar label,
.market-filter-shell .market-listing-filter > label:not(.market-price-filter) {
  position: relative;
}

.market-filter-shell .marketplace-result-toolbar label::after,
.market-filter-shell .result-toolbar label::after,
.market-filter-shell .market-listing-filter > label:not(.market-price-filter)::after {
  content: "";
  position: absolute;
  right: var(--pill-chevron-inset, 19px);
  bottom: 22px;
  width: var(--pill-chevron-size, 8px);
  height: var(--pill-chevron-size, 8px);
  border-right: var(--pill-chevron-stroke, 2px) solid #123f33;
  border-bottom: var(--pill-chevron-stroke, 2px) solid #123f33;
  pointer-events: none;
  transform: translateY(50%) rotate(45deg);
}

@media (min-width: 1051px) {
  .market-filter-shell .marketplace-filter-controls,
  .market-filter-shell .filter-controls {
    grid-template-columns: minmax(220px, .9fr) minmax(0, 3.6fr);
  }

  .marketplace-result-toolbar select,
  .filters--horizontal .result-toolbar select,
  .market-filter-shell .market-listing-filter .market-price-filter > input,
  .market-filter-shell .market-listing-filter select {
    font-size: 14px !important;
  }
}

@media (max-width: 1050px) {
  .market-filter-shell .marketplace-filter-controls,
  .market-filter-shell .filter-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 16px;
  }

  .market-listing-filter {
    grid-template-columns: 1fr;
  }

  .market-price-filter-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .market-price-filter {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .market-filter-shell > .market-filter-disclosure {
    min-height: 24px;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .market-filter-shell > .market-filter-disclosure > span {
    font-size: 16px;
    font-weight: 850;
  }

  .market-filter-shell:not([open]) > .market-filter-disclosure {
    margin-bottom: 0;
  }
}

@media (max-width: 560px) {
  .marketplace-listing-card,
  .listing-card {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .marketplace-listing-image,
  .listing-image {
    width: 100%;
    aspect-ratio: 4 / 3;
  }

  .marketplace-listing-copy,
  .listing-copy {
    padding: 2px 0 6px;
  }
}

@media (max-width: 1050px) {
  .market-search .search-form {
    grid-template-columns: minmax(0, 1fr) max-content;
  }

  .market-search .search-form > label:first-of-type {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .market-search .search-form > label:first-of-type > input {
    width: 100%;
  }

  .market-search .search-location-toggle {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    height: 52px;
    padding: 0 15px;
    border: 1px solid #cbd5c7;
    border-radius: 14px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #123f33;
    font-size: 12px;
    font-weight: 850;
    gap: 12px;
    white-space: nowrap;
    cursor: pointer;
  }

  .market-search .search-location-toggle::after {
    content: "+";
    margin-left: auto;
    font-size: 20px;
    font-weight: 500;
  }

  .market-search .search-location-toggle[aria-expanded="true"]::after {
    content: "−";
  }

  .market-search .search-location-field {
    grid-column: 1;
    grid-row: 2;
  }

  .market-search .search-radius-field {
    grid-column: 2;
    grid-row: 2;
  }

  .market-search .search-location-field > span,
  .market-search .search-radius-field > span {
    display: none;
  }

  .market-search .search-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .market-search .search-form:not(.location-expanded) > label:first-of-type > span {
    display: none;
  }

  .market-search .search-form:not(.location-expanded) .search-actions {
    grid-row: 2;
  }
}
