/* Final marketplace card frame fix. Keep this stylesheet last. */
:is(body[data-view="market"], body[data-view="catalog"]) .product-grid {
  align-items: stretch !important;
  grid-auto-flow: row !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid > .product-card {
  align-self: stretch !important;
  display: grid !important;
  grid-template-rows: auto 1fr !important;
  height: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-card-body {
  display: grid !important;
  grid-template-rows: 18px 44px 0 20px 20px auto !important;
  gap: 7px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-title {
  min-height: 0 !important;
  height: 44px !important;
  margin: 0 !important;
  overflow: hidden !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-title a {
  display: -webkit-box !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-category-line,
:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-seller-row,
:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-stats-row {
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-category-line span,
:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-seller-row button,
:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-stats-row span {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .tag-list {
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-card .price,
:is(body[data-view="market"], body[data-view="catalog"]) .product-grid .price {
  align-self: end !important;
  margin-top: auto !important;
}

.product-grid .market-card-frame {
  position: relative !important;
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  border-radius: 12px 12px 0 0 !important;
  overflow: hidden !important;
}

.product-grid .market-card-frame > .market-card-cover {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  aspect-ratio: auto !important;
  border-radius: inherit !important;
  background-color: #151827 !important;
  background-position: center !important;
  background-size: cover !important;
  overflow: hidden !important;
}

.product-grid .market-card-frame > .market-card-cover.fallback-0 {
  background-image:
    radial-gradient(circle at 78% 18%, #ff4d8d 0 9%, transparent 22%),
    linear-gradient(135deg, #25145c, #6f32ff) !important;
}

.product-grid .market-card-frame > .market-card-cover.fallback-1 {
  background-image:
    radial-gradient(circle at 78% 18%, #56e2ff 0 9%, transparent 22%),
    linear-gradient(135deg, #102c54, #168bff) !important;
}

.product-grid .market-card-frame > .market-card-cover.fallback-2 {
  background-image:
    radial-gradient(circle at 78% 18%, #f83b31 0 9%, transparent 22%),
    linear-gradient(135deg, #1f2333, #101010) !important;
}

.product-grid .market-card-frame > .market-card-cover.fallback-3 {
  background-image:
    radial-gradient(circle at 78% 18%, #7bdcff 0 9%, transparent 22%),
    linear-gradient(135deg, #18233d, #1d9bf0) !important;
}

.product-grid .market-card-frame > .market-card-cover.fallback-4 {
  background-image:
    radial-gradient(circle at 78% 18%, #f43f5e 0 9%, transparent 22%),
    linear-gradient(135deg, #201a52, #22d3ee) !important;
}

.product-grid .market-card-frame > .market-card-cover::before {
  display: none !important;
  content: none !important;
}

.product-grid .market-card-frame > .market-card-cover::after {
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none !important;
}

.product-grid .market-card-frame .market-card-cover-image {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
}

.product-grid .market-card-frame .market-card-cover-link {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2 !important;
  display: block !important;
}

.product-grid .market-card-frame .product-favorite {
  position: absolute !important;
  z-index: 3 !important;
  top: 10px !important;
  right: 10px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 0 !important;
  line-height: 1 !important;
  transform: none !important;
}

.product-grid .product-favorite span {
  display: block !important;
  font-size: 24px !important;
  line-height: 1 !important;
  transform: translateY(-1px) !important;
}

body[data-view="favorites"] .favorites-grid {
  align-items: start !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  justify-content: stretch !important;
  width: 100% !important;
}

body[data-view="favorites"] .favorites-grid > .product-card {
  align-self: start !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-rows: auto 1fr !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
}

body[data-view="favorites"] .favorites-grid .market-card-frame {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
}

body[data-view="favorites"] .favorites-grid .market-card-frame > .market-card-cover {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  aspect-ratio: auto !important;
  overflow: hidden !important;
}

body[data-view="favorites"] .favorites-grid .market-card-frame > .market-card-cover::before {
  display: none !important;
  content: none !important;
}

body[data-view="favorites"] .favorites-grid .market-card-cover-image {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
}

body[data-view="favorites"] .favorites-grid .product-card-body {
  display: grid !important;
  grid-template-rows: 18px 48px 0 20px 20px auto !important;
  gap: 7px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body[data-view="favorites"] .favorites-grid .product-title {
  height: 48px !important;
  min-height: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

body[data-view="favorites"] .favorites-grid .product-title a {
  display: -webkit-box !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

body[data-view="favorites"] .favorites-grid .tag-list {
  display: none !important;
}

body[data-view="market"] .market-listings-sentinel,
body[data-view="market"] .market-listings-loading {
  grid-column: 1 / -1 !important;
}

body[data-view="market"] .market-listings-sentinel {
  display: inline-flex !important;
  gap: 12px !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 92px !important;
  padding: 18px 0 22px !important;
  color: #4f35f2 !important;
  font-size: 17px !important;
  font-weight: 800 !important;
}

.lootava-loader {
  display: inline-block !important;
  width: 34px !important;
  height: 34px !important;
  border: 4px solid rgba(79, 53, 242, 0.16) !important;
  border-top-color: #4f35f2 !important;
  border-radius: 50% !important;
  animation: lootava-loader-spin 0.78s linear infinite !important;
}

@keyframes lootava-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  :is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-card-body {
    grid-template-rows: 16px 40px 0 18px 18px auto !important;
    gap: 6px !important;
    min-height: 0 !important;
  }

  :is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-title {
    height: 40px !important;
  }

  :is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-seller-row,
  :is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-stats-row,
  body[data-view="favorites"] .favorites-grid .product-seller-row,
  body[data-view="favorites"] .favorites-grid .product-stats-row,
  .product-grid .product-seller-row,
  .product-grid .product-stats-row {
    display: flex !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  :is(body[data-view="market"], body[data-view="catalog"]) .product-grid .product-card .price,
  body[data-view="favorites"] .favorites-grid .product-card .price,
  .product-grid .product-card .price {
    align-self: start !important;
    margin-top: 0 !important;
  }

  .product-grid .product-favorite {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
  }

  .product-grid .product-favorite span {
    font-size: 22px !important;
  }

  body[data-view="favorites"] .favorites-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    justify-content: stretch !important;
  }

  body[data-view="favorites"] .favorites-grid > .product-card {
    width: 100% !important;
    max-width: none !important;
  }

  body[data-view="favorites"] .favorites-grid .product-card-body {
    grid-template-rows: 16px 40px 0 18px 18px auto !important;
    min-height: 0 !important;
  }
}

/* Metric rows can wrap without clipping the next line or its tooltip. */
body[data-view] .product-card.product-card .product-card-body {
  display: flex !important;
  flex-direction: column !important;
  grid-template-rows: none !important;
  grid-auto-rows: auto !important;
  align-content: start !important;
  row-gap: 4px !important;
}
body[data-view] .product-card.product-card .product-stats-row {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  flex-wrap: wrap !important;
}
body[data-view] .product-card.product-card .card-stat {
  min-height: 20px;
  padding: 0;
  line-height: 20px;
}
body[data-view] .product-card.product-card .price {
  margin-top: auto !important;
  align-self: flex-start !important;
  text-align: left !important;
  padding-top: 2px;
}
body[data-view] .product-card.product-card .product-stats-row .card-stat span {
  overflow: visible !important;
  text-overflow: clip !important;
}
body[data-view] .product-card.product-card .product-stats-row .card-stat .card-stat-tooltip {
  white-space: normal !important;
}

/* Identical offer grids on the homepage and catalog filter pages. */
@media (min-width: 769px) {
  :is(body[data-view="market"], body[data-view="catalog"]) .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
  }
  body[data-view="catalog"] .catalog-page:has(.catalog-public-layout-section-filter) { max-width: none; padding-left: 0; padding-right: 0; }
}
@media (max-width: 768px) {
  body[data-view="catalog"] .catalog-public-offers.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

body[data-view="catalog"] .catalog-public-offers .tag-list { display: none !important; }
@media (max-width: 768px) {
  body[data-view="catalog"] .page:has(.catalog-public-layout-section-filter) { width: 100%; padding-left: 16px; padding-right: 16px; }
  body[data-view="catalog"] .catalog-page:has(.catalog-public-layout-section-filter) .catalog-public-mobile-flow { padding-left: 0; padding-right: 0; }
}

.catalog-public-section-head.catalog-filter-sort-only { justify-content: flex-end; }

body[data-view="catalog"] .catalog-page:has(.catalog-section-page){max-width:none;padding-left:0;padding-right:0}
.catalog-section-page .catalog-section-heading{display:flex;align-items:center;gap:24px;margin:24px 0 32px}
.catalog-section-heading>img{width:104px;height:104px;object-fit:cover;border-radius:22px;flex-shrink:0;background:#f5f4fa}
.catalog-section-heading h1{font-size:clamp(26px,3vw,40px);line-height:1.2;margin:0;overflow-wrap:anywhere}
.catalog-section-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:20px;color:#7c8295}
.catalog-section-toolbar .catalog-public-sort{max-width:320px}
@media(max-width:768px){body[data-view="catalog"] .page:has(.catalog-section-page){width:100%;padding-left:16px;padding-right:16px}.catalog-section-page .catalog-section-heading{gap:16px;margin:20px 0 24px}.catalog-section-heading>img{width:72px;height:72px;border-radius:16px}.catalog-section-heading h1{font-size:24px}.catalog-section-toolbar{flex-wrap:wrap}.catalog-section-toolbar .catalog-public-sort{max-width:100%;min-width:0}.catalog-section-page .catalog-public-crumbs{flex-wrap:wrap}}

.catalog-section-buttons{display:flex;flex-wrap:wrap;gap:10px;margin:0 0 24px}
.catalog-section-buttons .catalog-section-button{display:inline-flex;align-items:center;min-height:42px;padding:10px 18px;border:1px solid #e4e3ed;border-radius:12px;background:#fff;color:#343648;text-decoration:none;font-size:14px;font-weight:600;line-height:1.3;transition:background .15s,border-color .15s}
.catalog-section-buttons .catalog-section-button:hover{background:#f5f2ff;border-color:#cec3ff}
.catalog-section-buttons .catalog-section-button.active{background:#eee9ff;color:#5735ee;border-color:#cfc2ff}
.catalog-section-buttons-nested{padding-top:16px;border-top:1px solid #eeedf4}
@media(max-width:768px){.catalog-section-buttons{gap:8px;margin-bottom:20px}.catalog-section-buttons .catalog-section-button{padding:9px 13px;min-height:40px;font-size:13px}}

/* Cover-first popular services, a single swipeable row on every screen. */
.popular-services-carousel { position:relative; min-width:0; }
body[data-view="market"] #marketPopularServices.service-grid {
 display:flex!important; flex-wrap:nowrap!important; gap:22px!important;
 overflow-x:auto!important; overflow-y:hidden!important; max-width:100%; min-width:0;
 padding:4px 0 12px!important; margin:0!important; scrollbar-width:none;
 scroll-snap-type:x proximity; -webkit-overflow-scrolling:touch;
}
#marketPopularServices::-webkit-scrollbar { display:none; }
body[data-view="market"] #marketPopularServices a.service-card {
 display:flex!important; flex-direction:column; align-items:center; gap:10px!important;
 flex:0 0 86px!important; width:86px!important; min-width:86px!important; min-height:0!important;
 padding:0!important; border:0!important; border-radius:0!important; background:transparent!important;
 box-shadow:none!important; color:inherit; text-decoration:none!important; transform:none!important;
 scroll-snap-align:start;
}
body[data-view="market"] #marketPopularServices .service-icon.image,
body[data-view="market"] #marketPopularServices .service-icon.image img {
 width:86px!important; height:86px!important; max-width:none!important;
 border-radius:18px!important; padding:0!important; object-fit:cover;
}
body[data-view="market"] #marketPopularServices .service-card strong {
 display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
 font-size:14px!important; font-weight:500!important; line-height:1.4; text-align:center;
 text-decoration:none!important;
}
#marketPopularServices a.service-card:focus-visible { outline:2px solid #5836ff; outline-offset:2px; }
.popular-services-arrow {
 position:absolute; top:25px; z-index:2; display:grid; place-items:center;
 width:44px; height:44px; padding:0; border:0; border-radius:50%;
 background:#fff; color:#191923; box-shadow:0 3px 16px #18132b24; cursor:pointer;
}
.popular-services-arrow-previous { left:-12px; }
.popular-services-arrow-next { right:-12px; }
.popular-services-arrow[hidden] { display:none; }
.popular-services-arrow:hover { background:#f4f1ff; }
@media(max-width:768px) {
 .popular-services-arrow { display:none!important; }
 body[data-view="market"] #marketPopularServices.service-grid { gap:16px!important; }
 body[data-view="market"] #marketPopularServices a.service-card { flex-basis:74px!important; width:74px!important; min-width:74px!important; gap:8px!important; }
 body[data-view="market"] #marketPopularServices .service-icon.image,
 body[data-view="market"] #marketPopularServices .service-icon.image img { width:74px!important; height:74px!important; border-radius:17px!important; }
}

/* Compact desktop covers; the mobile rail keeps its existing size. */
@media(min-width:769px) {
 body[data-view="market"] #marketPopularServices.service-grid { gap:19.8px!important; }
 body[data-view="market"] #marketPopularServices a.service-card { flex-basis:77.4px!important; width:77.4px!important; min-width:77.4px!important; gap:9px!important; }
 body[data-view="market"] #marketPopularServices .service-icon.image,
 body[data-view="market"] #marketPopularServices .service-icon.image img { width:77.4px!important; height:77.4px!important; border-radius:16.2px!important; }
 body[data-view="market"] #marketPopularServices .service-card strong { font-size:12.6px!important; }
 .popular-services-arrow { top:21px; }
}
@media(max-width:768px) {
 body[data-view="market"] .popular-services h2,
 body[data-view="market"] .market-section .section-head :is(h1, h2) { font-size:24px!important; line-height:1.2!important; }
}
