.marketplace-main {
  width: min(1360px, calc(100% - 32px));
}

.marketplace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.marketplace-content,
.marketplace-cart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.marketplace-header,
.cart-header,
.cart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.marketplace-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.75fr) minmax(150px, 0.75fr) minmax(120px, 0.55fr);
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.marketplace-content > [data-message] {
  margin: 18px 20px 0;
}

.marketplace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  padding: 20px;
}

.product-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.product-image,
.product-image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: var(--surface-muted);
}

.product-image {
  display: block;
  object-fit: cover;
}

.product-image-placeholder {
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.product-card h3 {
  margin: 0;
  font-size: 17px;
}

.product-meta,
.product-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.product-price strong {
  color: var(--text);
  font-size: 16px;
}

.product-variant {
  display: grid;
  gap: 6px;
}

.product-variant span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-variant small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quantity-control {
  display: grid;
  grid-template-columns: 38px minmax(54px, 1fr) 38px;
  gap: 6px;
  align-items: center;
}

.quantity-control .input {
  min-height: 38px;
  padding: 6px;
  text-align: center;
}

.marketplace-cart {
  position: sticky;
  top: 20px;
}

.cart-header h2 {
  margin: 0;
  font-size: 20px;
}

.cart-header span {
  color: var(--muted);
}

.cart-items {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  padding: 14px;
}

.cart-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.cart-item-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-main strong,
.cart-line-values span,
.cart-line-values small {
  display: block;
}

.cart-line-values {
  color: var(--muted);
  font-size: 14px;
}

.cart-item-actions {
  display: grid;
  grid-template-columns: 36px minmax(42px, 1fr) 36px 36px;
  gap: 6px;
  align-items: center;
}

.cart-item-actions span {
  text-align: center;
  font-weight: 700;
}

.cart-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  flex-direction: column;
  align-items: stretch;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-total span {
  color: var(--muted);
}

@media (max-width: 960px) {
  .marketplace-shell {
    grid-template-columns: 1fr;
  }

  .marketplace-cart {
    position: static;
  }

  .cart-items {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .marketplace-filters {
    grid-template-columns: 1fr;
  }

  .marketplace-header,
  .cart-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
