.market-main {
  padding-top: 19px;
  min-height: min(65vh, 560px);
}
.market-sell {
  background: var(--sell-gold);
  border-color: #e3a626;
  color: #2b2110;
}
.market-sell:hover { background: #ffda77; }
.market-sell-short { display: none; }
.crumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.crumbs a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

.catalog-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 17px 0;
}
.catalog-heading h1, .listing-heading h1 {
  color: var(--ink);
  font-size: clamp(32px, 4vw, 61px);
  line-height: 1;
  letter-spacing: -.06em;
}
.catalog-heading p, .listing-heading p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
}
.catalog-search { display: flex; align-items: stretch; gap: 6px; width: min(100%, 350px); }
.catalog-search input {
  min-width: 0;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  font-size: 14px;
}
.catalog-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 8px;
  margin-top: 13px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}
.catalog-filters label { display: grid; gap: 3px; min-width: 0; }
.catalog-filters label span { color: var(--muted); font-size: 12px; font-weight: 720; }
.catalog-filters select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f6f2ec;
  font-size: 14px;
  font-weight: 630;
}
.catalog-filters select:disabled { color: var(--muted); }
.filter-message { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.filter-retry { border: 0; padding: 0; background: transparent; text-decoration: underline; }
.catalog-toolbar, .catalog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
}
.catalog-toolbar { min-height: 56px; }
.catalog-actions { margin-left: auto; }
.condition-tabs { display: flex; align-items: center; gap: 14px; }
.condition-tabs a { font-weight: 700; font-size: 13px; padding-block: 10px; white-space: nowrap; }
.condition-tabs a[aria-current="page"] { color: var(--brand); box-shadow: inset 0 -2px var(--brand); }
.catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.market-notice {
  margin: 8px 0 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  color: var(--muted);
}
.market-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 23px; }
.market-pagination > * {
  display: grid;
  place-items: center;
  min-width: 39px;
  min-height: 39px;
  padding-inline: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  font-size: 13px;
  font-weight: 700;
}
.market-pagination [aria-current="page"] { border-color: var(--dark); background: var(--dark); color: var(--white); }
.market-pagination a:hover { border-color: var(--brand); color: var(--brand); }

.listing-heading { padding: 6px 0 17px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 19px; align-items: start; }
.detail-main { display: grid; min-width: 0; gap: 16px; }
.detail-aside { position: sticky; top: 16px; }
.detail-gallery, .detail-panel { border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.detail-gallery { overflow: hidden; }
.gallery-stage { position: relative; display: grid; place-items: center; min-height: 230px; aspect-ratio: 4 / 3; overflow: hidden; background: #eee9e0; color: var(--muted); touch-action: pan-y pinch-zoom; }
.gallery-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gallery-stage > button {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  border: 1px solid #fff7;
  border-radius: 50%;
  background: #191715c9;
  color: #fff;
  font-size: 26px;
  line-height: 1;
}
.gallery-stage > button:hover { background: #191715; }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
#gallery-counter { position: absolute; right: 10px; bottom: 10px; padding: 4px 8px; border-radius: 3px; background: #191715df; color: #fff; font-size: 12px; }
.gallery-thumbs { position: relative; display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.gallery-thumbs:empty { display: none; }
.gallery-thumbs button { flex: 0 0 82px; height: 53px; padding: 0; border: 2px solid transparent; border-radius: 4px; background: #e7e1d7; overflow: hidden; }
.gallery-thumbs button[aria-pressed="true"] { border-color: var(--brand); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.detail-panel { padding: 17px; }
.detail-panel h2, .related-section h2 { font-size: clamp(22px, 2.4vw, 31px); }
#listing-description { margin-top: 12px; white-space: pre-line; line-height: 1.65; overflow-wrap: anywhere; }
.detail-price { font-size: clamp(30px, 3.1vw, 47px); font-weight: 900; letter-spacing: -.065em; }
.detail-location { margin: 6px 0 11px; color: var(--muted); font-size: 14px; }
.detail-facts, .listing-specs { display: grid; margin: 0; padding: 0; }
.detail-facts { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; margin-bottom: 13px; }
.detail-facts > div { padding: 8px; border-radius: 4px; background: #efe9df; }
.detail-facts dt, .listing-specs dt { color: var(--muted); font-size: 12px; }
.detail-facts dd, .listing-specs dd { margin: 3px 0 0; font-size: 14px; font-weight: 740; overflow-wrap: anywhere; }
.listing-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 19px; margin-top: 12px; }
.listing-specs > div { min-width: 0; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.seller-card { padding: 12px; border: 1px solid #e0d4c5; border-radius: 6px; background: #f8f2e9; }
.seller-card-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding-bottom: 9px; border-bottom: 1px solid #e4d9ca; }
.seller-card-head h2 { font-size: clamp(17px, 2vw, 24px); }
.seller-card-head img { width: min(41%, 131px); height: auto; border-radius: 2px; }
.seller-info { display: grid; gap: 3px; padding-block: 9px; }
.seller-info span { color: var(--muted); font-size: 12px; }
.detail-contact { display: flex; gap: 7px; margin: 5px 0 10px; }
.detail-contact > a { flex: 1; min-width: 0; min-height: 44px; padding-inline: 6px; font-size: 14px; }
.detail-contact svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.phone-link { border-color: var(--ink); background: var(--ink); color: #fff8f0; }
.phone-link:hover { background: #42342a; }
.whatsapp-link { border-color: #1e6247; background: #216b4e; color: #fff; }
.whatsapp-link:hover { background: #174e38; }
.related-section { display: grid; gap: 12px; margin-top: 24px; }
.related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.related-grid .photo img { position: static; width: 100%; height: 100%; object-fit: contain; transform: none; }

@media (max-width: 950px) {
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); }
}
@media (max-width: 650px) {
  .market-main { padding-top: 12px; }
  .header-row:has(.market-sell) { gap: 7px; }
  .header-row:has(.market-sell) .logo img { width: min(42vw, 170px); }
  .header-row:has(.market-sell) .account { gap: 7px; }
  .market-sell { min-height: 35px; padding-inline: 6px; gap: 3px; font-size: 12px; }
  .market-sell-wide { display: none; }
  .market-sell-short { display: inline; }
  .crumbs { margin-bottom: 10px; font-size: 11px; }
  .catalog-heading { display: grid; align-items: start; gap: 10px; padding: 6px 0; }
  .catalog-heading h1, .listing-heading h1 { font-size: 30px; }
  .catalog-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; padding: 7px; }
  .catalog-filters select { min-height: 42px; padding-inline: 5px; font-size: 13px; }
  .catalog-filters .button { min-height: 42px; padding-inline: 5px; font-size: 13px; }
  .catalog-toolbar { flex-wrap: wrap; gap: 4px; padding-block: 6px; }
  .catalog-actions { gap: 7px; }
  .condition-tabs { gap: 8px; }
  .condition-tabs a { font-size: 12px; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listing-heading { padding: 5px 0 12px; }
  .detail-layout, .detail-main { display: contents; }
  #listing-view { display: flex; flex-direction: column; gap: 11px; }
  .detail-gallery { order: 1; }
  .detail-aside { position: static; order: 2; }
  #listing-spec-section { order: 3; }
  #listing-description-section { order: 4; }
  .related-section { order: 5; margin-top: 7px; }
  .gallery-stage { min-height: 170px; }
  .detail-panel { padding: 12px; }
  .listing-specs { column-gap: 8px; }
  .related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .related-grid .photo { aspect-ratio: 1.15; }
  .related-grid .card-copy { padding: 4px; }
  .related-grid .card-price { gap: 0; margin-bottom: 3px; }
  .related-grid .price { font-size: clamp(9px, 2.65vw, 13px); line-height: 1.15; overflow-wrap: anywhere; }
  .related-grid .card-arrow, .related-grid .card-bottom { display: none; }
  .related-grid h3 { display: -webkit-box; min-height: 2.5em; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; overflow-wrap: anywhere; font-size: clamp(9px, 2.65vw, 13px); line-height: 1.25; }
}
