/* 3D StudioMarket v1.3.0 functional and responsive upgrade */
:root {
  --token-gold-v130: #d4af37;
  --token-gold-light-v130: #f2cf63;
}

.token-price,
.topbar-token-value,
.mgmt-card-price,
.latest-token-price,
.token-pack-price,
.ref-card-price > span,
.detail-price,
.liquid-token-price,
.readable-token-price,
.product-sku-price-v253 small,
[class*="token"][class*="price"] {
  color: var(--token-gold-v130) !important;
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
}

.v130-status {
  min-height: 1.35rem;
  color: var(--text-secondary, #aab6c2);
  font-size: .82rem;
}
.v130-status.error { color: #ff7b7b; }
.v130-status.ok { color: #69d59a; }
.v130-test-badge {
  display: inline-flex;
  padding: .2rem .5rem;
  border: 1px solid var(--token-gold-v130);
  border-radius: 999px;
  color: var(--token-gold-v130);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.v130-upload-progress { opacity: .72; pointer-events: none; }
.v130-option-row {
  display: grid;
  grid-template-columns: minmax(9rem, .7fr) minmax(14rem, 1.5fr) auto;
  gap: .75rem;
  align-items: end;
  padding: .8rem;
  border: 1px solid var(--border-soft, #27313c);
  border-radius: .8rem;
}
.v130-option-list { display: grid; gap: .7rem; }
.v130-geo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}
.v130-geo-grid input:disabled { opacity: .5; cursor: not-allowed; }
.v130-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.v130-image-preview button {
  position: absolute;
  right: .35rem;
  bottom: .35rem;
}

.admin-log-b-v130 {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.25rem;
  color: #eaf0f6;
  background: #070b10;
  min-height: 100vh;
}
.admin-log-b-v130 * { box-sizing: border-box; }
.admin-summary-v130 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.admin-summary-v130 article,
.admin-panel-v130 {
  padding: 1rem;
  border: 1px solid #27313c;
  border-radius: .85rem;
  background: #10161d;
}
.admin-summary-v130 span { color: #97a6b5; font-size: .8rem; }
.admin-summary-v130 strong { display: block; margin-top: .3rem; font-size: 1.15rem; }
.admin-entry-grid-v130 {
  display: grid;
  grid-template-columns: 1.2fr .9fr .9fr 2fr 1fr;
  gap: .65rem;
}
.admin-entry-grid-v130 input,
.admin-entry-grid-v130 select,
.admin-entry-grid-v130 textarea,
.admin-entry-grid-v130 button {
  width: 100%;
  min-height: 2.65rem;
  padding: .65rem;
  color: #eef4fa;
  border: 1px solid #344250;
  border-radius: .55rem;
  background: #0a1016;
}
.admin-entry-grid-v130 button { background: #b99526; color: #080a0d; font-weight: 800; }
.admin-table-wrap-v130 { overflow: auto; }
.admin-table-v130 { width: 100%; border-collapse: collapse; font-size: .77rem; }
.admin-table-v130 th,
.admin-table-v130 td { padding: .65rem; border-bottom: 1px solid #25303a; text-align: right; white-space: nowrap; }
.admin-table-v130 th:first-child,
.admin-table-v130 td:first-child,
.admin-table-v130 th:nth-child(2),
.admin-table-v130 td:nth-child(2) { text-align: left; }
.admin-locked-v130 { color: #82909e; }
.admin-reverse-v130 { border: 1px solid #e0a63c; color: #f2c96f; background: transparent; border-radius: .4rem; padding: .35rem .55rem; }
.card-metadata-empty {
  margin: 10px 0 0;
  color: var(--text-muted, #929eaa);
  font-size: 12px;
  line-height: 1.4;
}

/*
 * Management is an operational list, not a marketplace gallery. The live
 * renderer uses these compact rows so real images and long metadata never
 * inherit the large adaptive marketplace-card dimensions.
 */
html body[data-view="file-management"] #fmFileGrid.management-card-grid,
html body[data-view="product-management"] #pmProductGrid.management-card-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-auto-rows: max-content !important;
  gap: 0 !important;
}

html body[data-view="file-management"] #fmFileGrid > .production-management-row-v257,
html body[data-view="product-management"] #pmProductGrid > .production-management-row-v257 {
  display: grid !important;
  grid-template-columns: 96px minmax(170px, 1fr) minmax(240px, 1.25fr) minmax(190px, auto) 36px !important;
  align-items: stretch !important;
  min-height: 104px !important;
  height: auto !important;
  padding: 0 !important;
  overflow: hidden !important;
}

html body .production-management-row-v257 > .management-row-preview-v222 {
  grid-column: 1 !important;
  width: 96px !important;
  height: 100% !important;
  min-height: 104px !important;
}

html body .production-management-row-v257 > .management-row-preview-v222 > img,
html body .production-management-row-v257 > .management-row-preview-v222 > .ref-preview-placeholder {
  width: 100% !important;
  height: 100% !important;
  min-height: 104px !important;
  object-fit: cover !important;
}

html body .production-management-row-v257 > .management-row-primary-v222 {
  min-width: 0 !important;
  justify-content: center !important;
}

html body .production-management-row-v257 > .management-row-primary-v222 strong {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

html body .production-management-row-v257 > .management-row-tags-v222 {
  display: flex !important;
  align-content: center !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  padding: 12px 14px 12px 0 !important;
}

html body .production-management-row-v257 > .management-row-tags-v222 i {
  max-width: 100% !important;
  height: auto !important;
  min-height: 22px !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
}

html body .production-management-row-v257 > .management-row-stats-v222 {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  padding: 12px 4px !important;
  white-space: normal !important;
}

html body .production-management-row-v257 > .management-row-stats-v222 b {
  color: var(--token-gold-v130) !important;
}

html body .production-management-row-v257 > .management-row-action-v222 {
  display: grid !important;
  place-items: center !important;
}

@media (max-width: 760px) {
  /*
   * The older responsive layers use ID-qualified, !important two-column
   * rules. Keep these selectors equally specific so phones always receive
   * one readable card per row.
   */
  html body[data-view="market-products"] #mpGrid.behavior-market-grid,
  html body[data-view="market-file"] #mfGrid.behavior-market-grid,
  html body[data-view="favorites"] #favGrid.behavior-market-grid,
  html body[data-view="seller-profile"] #sellerGrid.seller-card-grid-v165,
  html body[data-view="file-management"] #fmFileGrid.management-card-grid,
  html body[data-view="product-management"] #pmProductGrid.management-card-grid,
  html body .market-grid,
  html body .market-card-grid,
  html body .product-grid,
  html body .file-grid,
  html body .favorites-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  html body[data-view="file-management"] #fmFileGrid.management-card-grid,
  html body[data-view="product-management"] #pmProductGrid.management-card-grid {
    grid-auto-rows: max-content !important;
    align-items: start !important;
    gap: 0 !important;
    overflow: hidden !important;
    border: 1px solid var(--border-soft, #27313c) !important;
    background: var(--surface, #0b1219) !important;
  }

  html body[data-view="file-management"] #fmFileGrid > .production-management-row-v257,
  html body[data-view="product-management"] #pmProductGrid > .production-management-row-v257 {
    grid-template-columns: 88px minmax(0, 1fr) 28px !important;
    grid-template-rows: auto auto auto !important;
    min-height: 132px !important;
    height: auto !important;
    align-items: stretch !important;
  }

  html body .production-management-row-v257 > .management-row-preview-v222 {
    grid-column: 1 !important;
    grid-row: 1 / 4 !important;
    width: 88px !important;
    height: 100% !important;
    min-height: 132px !important;
  }

  html body .production-management-row-v257 > .management-row-preview-v222 > img,
  html body .production-management-row-v257 > .management-row-preview-v222 > .ref-preview-placeholder {
    min-height: 132px !important;
  }

  html body .production-management-row-v257 > .management-row-primary-v222 {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-content: flex-start !important;
    padding: 12px 10px 4px !important;
  }

  html body .production-management-row-v257 > .management-row-tags-v222 {
    grid-column: 2 !important;
    grid-row: 2 !important;
    display: flex !important;
    padding: 4px 10px !important;
  }

  html body .production-management-row-v257 > .management-row-stats-v222 {
    grid-column: 2 !important;
    grid-row: 3 !important;
    display: flex !important;
    justify-content: flex-start !important;
    gap: 5px 12px !important;
    padding: 4px 10px 12px !important;
    font-size: 10px !important;
  }

  html body .production-management-row-v257 > .management-row-action-v222 {
    grid-column: 3 !important;
    grid-row: 1 / 4 !important;
  }

  html body[data-view="file-management"] #fmFileGrid > .management-market-card,
  html body[data-view="product-management"] #pmProductGrid > .management-market-card {
    display: flex !important;
    flex-direction: column !important;
    align-self: start !important;
    contain: none !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  html body[data-view="file-management"] #fmFileGrid > .management-market-card > .ref-card-preview,
  html body[data-view="product-management"] #pmProductGrid > .management-market-card > .ref-card-preview {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 16 / 9 !important;
  }

  html body[data-view="file-management"] #fmFileGrid > .management-market-card > .ref-card-body,
  html body[data-view="product-management"] #pmProductGrid > .management-market-card > .ref-card-body {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    grid-template-rows: none !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html body[data-view="file-management"] #fmFileGrid .management-market-card .ref-card-title,
  html body[data-view="product-management"] #pmProductGrid .management-market-card .ref-card-title {
    display: block !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  html body[data-view="file-management"] #fmFileGrid .management-market-card .card-bottom-line,
  html body[data-view="product-management"] #pmProductGrid .management-market-card .card-bottom-line {
    position: static !important;
    flex: 0 0 auto !important;
    margin-top: 12px !important;
    padding-top: 12px !important;
  }

  html body .market-card,
  html body .ref-card,
  html body .management-market-card {
    min-height: 0 !important;
    height: auto !important;
  }

  html body .market-card-preview,
  html body .ref-card-preview {
    aspect-ratio: 16 / 9;
    min-height: 0 !important;
    height: auto !important;
  }

  html body .market-grid .market-card-body,
  html body .market-grid .ref-card-body,
  html body .management-card-grid .market-card-body,
  html body .management-card-grid .ref-card-body {
    min-height: 0 !important;
    height: auto !important;
    padding: 14px !important;
  }

  /* Show every real API tag instead of clipping the row or hiding tag 3+. */
  html body .market-grid .ref-chip-row,
  html body .management-card-grid .ref-chip-row,
  html body[data-view="seller-profile"] #sellerGrid .ref-chip-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 6px !important;
    max-height: none !important;
    margin-bottom: 12px !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  html body .ref-chip-row > span,
  html body .ref-chip-row span:nth-child(n+3) {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 25px !important;
    height: auto !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  html body .ref-card-seller,
  html body .ref-sales-meta,
  html body .card-bottom-line .ref-card-price small {
    display: block !important;
    max-width: 100% !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  html body .ref-card-seller {
    margin: -4px 0 10px !important;
    color: var(--text-secondary, #aab6c2) !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  html body .card-bottom-line {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 8px 14px !important;
  }

  html body .ref-card-price {
    display: inline-flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
  }

  /* Summary and commerce layouts use a single readable column on phones. */
  html body[data-view="file-management"] .management-primary-metrics-v251,
  html body[data-view="product-management"] .management-primary-metrics-v251,
  html body[data-view="file-management"] .management-secondary-strip-v251,
  html body[data-view="product-management"] .management-secondary-strip-v251,
  html body[data-view="product-management"] .management-capacity-strip-v251,
  html body[data-view="plan"] #planSummaryStrip.plan-summary-primary-v2412,
  html body[data-view="plan"] #planGrid.latest-plan-grid,
  html body[data-view="product-detail"] .behavior-detail-shell,
  html body[data-view="file-detail"] .behavior-detail-shell,
  html body[data-view="product-detail"] .behavior-option-grid,
  html body[data-view="file-detail"] .behavior-option-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html body[data-view="file-management"] .management-primary-metric-v251,
  html body[data-view="product-management"] .management-primary-metric-v251,
  html body[data-view="file-management"] .management-secondary-strip-v251 > div,
  html body[data-view="product-management"] .management-secondary-strip-v251 > div,
  html body[data-view="plan"] #planSummaryStrip > div {
    min-width: 0 !important;
    border-left: 0 !important;
  }

  html body[data-view="file-management"] .management-secondary-strip-v251 strong,
  html body[data-view="product-management"] .management-secondary-strip-v251 strong,
  html body[data-view="plan"] #planSummaryStrip strong {
    max-width: 100% !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  .v130-option-row,
  .v130-geo-grid,
  .admin-summary-v130,
  .admin-entry-grid-v130 {
    grid-template-columns: minmax(0, 1fr);
  }
  .product-sku-row-v253 { min-height: 0 !important; height: auto !important; }
}
