body.detail-open {
  overflow: hidden;
}

.product-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
}

.product-detail-backdrop[hidden] {
  display: none;
}

.product-detail-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(820px, 94vw);
  overflow-y: auto;
  background: #fff;
  box-shadow: -24px 0 70px rgba(15, 23, 42, 0.2);
  transform: translateX(24px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.product-detail-backdrop.open .product-detail-panel {
  transform: translateX(0);
  opacity: 1;
}

.product-detail-close {
  position: sticky;
  top: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 16px 16px -58px auto;
  border: 1px solid #d7dde7;
  border-radius: 999px;
  background: #fff;
  color: #172033;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.product-detail-content {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(330px, 1.1fr);
  min-height: 100%;
}

.detail-visual {
  min-height: 100%;
  padding: 72px 28px 32px;
  background: #f7f8fb;
}

.detail-main-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.detail-gallery button {
  padding: 0;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.detail-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.detail-copy {
  padding: 76px 38px 40px;
}

.detail-copy h2 {
  margin: 8px 0 12px;
  color: #172033;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.08;
}

.detail-copy h3 {
  margin: 0 0 14px;
  color: #263247;
  font-size: 1rem;
}

.detail-supplier {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: #667085;
  font-size: 0.86rem;
}

.detail-supplier span {
  display: grid;
}

.detail-supplier strong {
  color: #263247;
}

.detail-supplier-logo {
  width: 38px;
  height: 38px;
}

.detail-description {
  color: #596579;
  line-height: 1.65;
  white-space: pre-line;
}

.detail-source-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 9px 11px;
  border: 1px solid #cfd9cd;
  border-radius: 6px;
  background: #f7faf6;
  color: #2f5630;
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
}

.detail-source-link:hover,
.detail-source-link:focus-visible {
  border-color: #315b31;
  background: #eef5ec;
  outline: none;
}

.detail-source-link span {
  font-size: 1rem;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: #7a8496;
  font-size: 0.84rem;
}

.detail-price {
  margin-top: 18px;
  color: #172033;
  font-size: 1.8rem;
  font-weight: 800;
}

.detail-price small {
  color: #7a8496;
  font-size: 0.78rem;
  font-weight: 600;
}

.detail-availability {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 5px;
  background: #f2f4f7;
  color: #7a2938;
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-availability.available {
  background: #e8f8ef;
  color: #197447;
}

.detail-variants,
.detail-attributes {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #e7eaf0;
}

.detail-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-option {
  display: grid;
  gap: 7px;
  color: #526074;
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-option select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  background: #fff;
  color: #172033;
}

.detail-attributes dl {
  margin: 0;
}

.detail-attributes dl div {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(140px, 1.2fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #eef0f4;
}

.detail-attributes dt {
  color: #7a8496;
}

.detail-attributes dd {
  margin: 0;
  color: #263247;
  font-weight: 650;
  text-align: right;
}

.detail-add-row {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  margin: 30px -12px -12px;
  padding: 16px 12px 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.detail-add-row input {
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  text-align: center;
}

.detail-add-row button {
  min-height: 48px;
}

.detail-add-row button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.detail-loading {
  grid-column: 1 / -1;
  display: grid;
  place-content: center;
  min-height: 70vh;
  padding: 40px;
  color: #526074;
  text-align: center;
}

.detail-loading strong {
  color: #172033;
  font-size: 1.25rem;
}

.detail-card-hint {
  align-self: center;
  color: #7a8496;
  font-size: 0.75rem;
  line-height: 1.25;
}

.market-add-row .open-product-detail {
  min-width: 132px;
}

@media (max-width: 720px) {
  .product-detail-panel {
    width: 100%;
  }

  .product-detail-content {
    grid-template-columns: 1fr;
  }

  .detail-visual {
    min-height: auto;
    padding: 68px 20px 20px;
  }

  .detail-copy {
    padding: 28px 22px 34px;
  }

  .detail-option-grid {
    grid-template-columns: 1fr;
  }
}
