/* 3D StudioMarket — v25.3 focused UX and responsive repair */

/* Navigation drawer remains operable at every responsive breakpoint. */
html body #topbarLeftBtn {
  pointer-events: auto !important;
  touch-action: manipulation;
  cursor: pointer;
}

html body[data-page-type="menu"].sidebar-open #sidebarMount .sidebar,
html body[data-page-type="menu"] #sidebarMount .sidebar.open {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) !important;
  pointer-events: auto !important;
  z-index: 1400 !important;
}

html body.sidebar-open #sidebarOverlay,
html body #sidebarOverlay.open,
html body #sidebarOverlay.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 1390 !important;
}

html body[data-view="file-management"] .management-back-v251,
html body[data-view="product-management"] .management-back-v251,
html body .legal-library { display: none !important; }

/* Every popup close control is red and completely unframed. */
html body button.modal-close,
html body button.legal-close,
html body .icon-btn[aria-label="Close"],
html body button[aria-label="Close"][data-unframed-close-v253="true"],
html body button.modal-close:hover,
html body button.legal-close:hover,
html body .icon-btn[aria-label="Close"]:hover,
html body button.modal-close:focus-visible,
html body button.legal-close:focus-visible,
html body .icon-btn[aria-label="Close"]:focus-visible,
html body button.modal-close:active,
html body button.legal-close:active,
html body .icon-btn[aria-label="Close"]:active {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
  color: #ff5b62 !important;
  font-size: 27px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-shadow: none !important;
  transform: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

html body button.modal-close::before,
html body button.modal-close::after,
html body button.legal-close::before,
html body button.legal-close::after,
html body .icon-btn[aria-label="Close"]::before,
html body .icon-btn[aria-label="Close"]::after { background: transparent !important; box-shadow: none !important; }

/* Legacy legal-set bullets no longer sit underneath the text. */
html body .legal-reader .legal-set-content ul {
  display: grid !important;
  gap: 4px !important;
  margin: 14px 0 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

html body .legal-reader .legal-set-content li {
  position: relative !important;
  min-width: 0 !important;
  padding: 7px 0 7px 24px !important;
  color: #dce2e7 !important;
  font-family: inherit !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  letter-spacing: 0 !important;
  overflow-wrap: anywhere;
}

html body .legal-reader .legal-set-content li::before {
  content: "" !important;
  position: absolute !important;
  left: 3px !important;
  top: 1.05em !important;
  width: 7px !important;
  height: 7px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #ffae31 !important;
  box-shadow: none !important;
  transform: translateY(-50%) !important;
}

/* Product listing: centered, predictable sections with no intersecting grids. */
html body[data-view="product-listing-settings"] .page-inner {
  width: min(100%, 1240px) !important;
  margin-inline: auto !important;
}

html body .product-listing-header-v253 {
  width: min(100%, 1160px);
  margin: 0 auto 18px !important;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

html body .product-listing-header-v253 > div { min-width: 0; }
html body .product-listing-header-v253 .page-desc { max-width: 760px; margin-top: 6px !important; }
html body .listing-save-state-v253 { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; color: #c9d0d6; font-size: 13px; }
html body .listing-save-state-v253 i { width: 8px; height: 8px; border-radius: 50%; background: #ffb32f; }

html body .product-listing-shell-v253 {
  width: min(100%, 1160px);
  margin-inline: auto;
  border-top: 1px solid rgba(255,255,255,.18);
  border-bottom: 1px solid rgba(255,255,255,.18);
}

html body .listing-section-v253 {
  min-width: 0;
  padding: clamp(22px, 3vw, 34px) 0;
  border: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
html body .product-listing-shell-v253 > .listing-section-v253:last-child { border-bottom: 0 !important; }

html body .listing-section-head-v253 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
html body .listing-section-head-v253 > div { min-width: 0; }
html body .listing-section-head-v253 span,
html body .listing-section-head-v253 > small { color: #ffb238; font-size: 12px; font-weight: 750; letter-spacing: .04em; }
html body .listing-section-head-v253 h2 { margin: 5px 0 0; color: #f5f7f9; font-size: clamp(20px, 2.4vw, 27px); line-height: 1.22; }
html body .listing-section-head-v253 > small { max-width: 310px; color: #9ca8b2; font-weight: 600; letter-spacing: 0; text-align: right; line-height: 1.5; }

html body .product-image-grid-v253 {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
  margin-bottom: 22px;
}
html body .product-image-add-v253,
html body .product-image-preview-v253 {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 150px;
  margin: 0 !important;
  border: 1px dashed rgba(255,255,255,.22) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.025) !important;
}
html body .product-image-add-v253 { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; cursor: pointer; color: #e9edf0; }
html body .product-image-add-v253 > span { color: #ffb238; font-size: 27px; line-height: 1; }
html body .product-image-add-v253 small { color: #8f9ba5; font-size: 12px; }
html body .product-image-preview-v253 { display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
html body .product-image-preview-v253 button { position: absolute; right: 10px; bottom: 10px; padding: 7px 10px; border: 0; border-radius: 6px; background: #2b333b; color: #fff; }

html body .listing-form-grid-v253 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, .6fr);
  gap: 16px;
}
html body .listing-description-v253 { grid-column: 1 / -1; }
html body .listing-form-grid-v253 .form-input,
html body .listing-form-grid-v253 .form-textarea { width: 100% !important; box-sizing: border-box; }
html body .listing-form-grid-v253 .form-textarea { min-height: 120px; resize: vertical; }

html body .product-sku-list-v253 { display: grid; gap: 0; border-top: 1px solid rgba(255,255,255,.14); }
html body .product-sku-row-v253.product-sku-card-v249 {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(190px, .34fr) auto !important;
  align-items: center !important;
  gap: 22px !important;
  min-width: 0 !important;
  padding: 18px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 0 !important;
  background: transparent !important;
}
html body .product-sku-row-v253:last-child { border-bottom: 0 !important; }
html body .product-sku-copy-v249 { min-width: 0; }
html body .product-sku-copy-v249 strong,
html body .product-sku-copy-v249 span { display: block; overflow-wrap: anywhere; }
html body .product-sku-copy-v249 strong { color: #f2f4f6; font-size: 16px; }
html body .product-sku-copy-v249 span { margin-top: 5px; color: #929ea8; font-size: 13px; }
html body .product-sku-price-v253 { min-width: 0; }
html body .product-sku-price-v253 > span { display: block; margin-bottom: 6px; color: #97a2ac; font-size: 12px; }
html body .product-sku-price-v253 > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; }
html body .product-sku-price-v253 .form-input { box-sizing: border-box; width: 100% !important; min-width: 0; }
html body .product-sku-price-v253 small { color: #ffb238; font-size: 12px; }
html body .product-sku-row-v253 .product-sku-delete-v249 { white-space: nowrap; }

html body .product-listing-split-v253 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid rgba(255,255,255,.14);
}
html body .product-listing-split-v253 > section { padding-inline: clamp(20px, 3vw, 34px) !important; }
html body .product-listing-split-v253 > section:first-child { padding-left: 0 !important; border-right: 1px solid rgba(255,255,255,.14) !important; }
html body .product-listing-split-v253 > section:last-child { padding-right: 0 !important; border-bottom: 0 !important; }
html body .listing-help-v253 { margin: -8px 0 17px; color: #9ba6af; font-size: 14px; line-height: 1.55; }
html body .option-group-list-v253 { display: grid; gap: 10px; }
html body .option-group-list-v253 .option-group-card {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: minmax(120px, .42fr) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 14px !important;
  min-width: 0 !important;
  padding: 13px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 0 !important;
  background: transparent !important;
}
html body .option-group-list-v253 .option-group-card > span { min-width: 0; }
html body .option-group-list-v253 .option-group-card strong,
html body .option-group-list-v253 .option-group-card small { display: block; }
html body .option-group-list-v253 .option-group-card small { margin-top: 4px; color: #8f9aa4; }
html body .option-group-list-v253 .form-input { box-sizing: border-box; width: 100% !important; min-width: 0; }

html body .listing-license-v253 .field-help { color: #929da7; font-size: 13px; line-height: 1.55; }
html body .listing-license-v253 .licensed-production-panel { min-width: 0; }
html body .listing-license-v253 .legal-license-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html body .listing-license-v253 .legal-license-fields > * { min-width: 0; }
html body .listing-license-v253 .form-input,
html body .listing-license-v253 .filter-select { box-sizing: border-box; width: 100% !important; min-width: 0; }
html body .licensed-production-acceptance { padding-top: 16px; border-top: 1px solid rgba(255,255,255,.13); }

html body .listing-compliance-v253 {
  display: grid;
  grid-template-columns: minmax(210px, .72fr) minmax(0, 1.28fr) auto;
  align-items: center;
  gap: 24px;
}
html body .listing-compliance-v253 .product-compliance-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
html body .listing-compliance-v253 .product-compliance-copy h2 { margin: 3px 0; font-size: 20px; }
html body .listing-compliance-v253 .product-compliance-copy p { margin: 0; color: #929ea8; font-size: 13px; }
html body .listing-compliance-v253 .product-compliance-check { box-sizing: border-box; min-width: 0; margin: 0 !important; padding: 15px !important; }
html body .listing-compliance-v253 .legal-inline-link { white-space: nowrap; }

html body .product-listing-actions-v253 {
  box-sizing: border-box;
  width: min(100%, 1160px);
  margin: 18px auto 0 !important;
}

/* v25.5 — operational Product Listing controls. */
html body[data-view="product-listing-settings"] .main-content,
html body[data-view="product-listing-settings"] .page-inner,
html body[data-view="product-listing-settings"] .product-listing-shell-v253,
html body[data-view="product-listing-settings"] input,
html body[data-view="product-listing-settings"] textarea,
html body[data-view="product-listing-settings"] select,
html body[data-view="product-listing-settings"] button,
html body[data-view="product-listing-settings"] label {
  pointer-events: auto !important;
}

html body[data-view="product-listing-settings"]:not(.sidebar-open) .sidebar-overlay {
  display: none !important;
  pointer-events: none !important;
}

html body .product-image-add-v253:focus-visible,
html body[data-view="product-listing-settings"] input:focus-visible,
html body[data-view="product-listing-settings"] textarea:focus-visible,
html body[data-view="product-listing-settings"] select:focus-visible,
html body[data-view="product-listing-settings"] button:focus-visible {
  outline: 2px solid #10b981 !important;
  outline-offset: 3px !important;
}

html body .product-image-preview-v253 img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}

html body .product-image-file-v255 {
  box-sizing: border-box;
  width: 100%;
  min-height: 150px;
  padding: 18px;
  display: grid;
  place-items: center;
  color: #dce3e8;
  text-align: center;
  overflow-wrap: anywhere;
}

html body .product-image-status-v255 {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(4,8,11,.8);
  color: #dbe3e8;
  font-size: 11px;
  font-weight: 750;
  backdrop-filter: blur(8px);
}

html body .product-image-status-v255.uploading,
html body .product-image-status-v255.pending { color: #ffbd52; }
html body .product-image-status-v255.failed { color: #ff8589; }
html body .product-image-status-v255.ready,
html body .product-image-status-v255.active { color: #57dcae; }

html body .product-image-empty-v255 {
  box-sizing: border-box;
  min-height: 150px;
  margin: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 10px;
  color: #8996a0;
  text-align: center;
}

html body .listing-field-message-v255 {
  min-height: 18px;
  margin: -13px 0 17px;
  color: #8f9ba5;
  font-size: 12px;
  line-height: 1.5;
}

html body .listing-character-count-v255 {
  display: block;
  margin-top: 6px;
  color: #84919b;
  text-align: right;
}

html body .option-group-list-v253 .option-group-custom-v255 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
}

html body .option-group-custom-v255 > label { min-width: 0; }
html body .option-group-custom-v255 > label > span { display: block; margin-bottom: 6px; }
html body .option-group-custom-v255 > label > span strong,
html body .option-group-custom-v255 > label > span small { display: block; }
html body .option-group-custom-v255 > label > span small { margin-top: 3px; color: #8f9aa4; }
html body .option-group-name-v255 { font-weight: 750; }
html body .option-group-remove-v255 { align-self: end; white-space: nowrap; }

html body .product-listing-error-v255 {
  box-sizing: border-box;
  width: min(100%, 1160px);
  min-height: 22px;
  margin: 12px auto -7px;
  color: #9ba6af;
  font-size: 13px;
  line-height: 1.55;
}
html body .product-listing-error-v255.is-error { color: #ff8589; }

html body .product-listing-action-group-v255 {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

html body .listing-save-state-v253.is-saving i { background: #ffb32f; animation: productListingPulseV255 .9s ease-in-out infinite; }
html body .listing-save-state-v253.is-saved i { background: #10b981; }
html body .listing-save-state-v253.is-dirty i { background: #ffb32f; }
html body .listing-save-state-v253.is-error i { background: #ff6469; }

html body[data-view="product-listing-settings"] button:disabled,
html body[data-view="product-listing-settings"] button[aria-disabled="true"] {
  cursor: not-allowed !important;
  opacity: .5 !important;
}

@keyframes productListingPulseV255 {
  0%, 100% { opacity: .45; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1); }
}

/* Tracking-number lookup is always visible above order progress. */
html body .tracking-page-head-v253 {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(420px, 1.2fr);
  align-items: end;
  gap: 32px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
html body .tracking-code-form-v253 { min-width: 0; }
html body .tracking-code-form-v253 > label { display: block; margin-bottom: 7px; color: #c8d0d6; font-size: 13px; font-weight: 700; }
html body .tracking-code-form-v253 > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
html body .tracking-code-form-v253 .form-input { box-sizing: border-box; width: 100% !important; min-width: 0; text-transform: uppercase; }
html body .tracking-code-form-v253 p { min-height: 20px; margin: 7px 0 0; color: #9aa5af; font-size: 12px; }
html body .tracking-code-form-v253 p.success { color: #ffbd4a; }
html body .tracking-code-form-v253 p.error { color: #ff7b80; }

/* Actual KYC/KYB system file picker with allowed-file guidance. */
html body .kyc-file-picker-v253 { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 16px !important; }
html body .kyc-file-picker-v253 > div { min-width: 0; }
html body .kyc-file-picker-v253 span,
html body .kyc-file-picker-v253 small { display: block; overflow-wrap: anywhere; }
html body .kyc-file-picker-v253 small { margin-top: 4px; color: #8f9aa4; font-size: 12px; }
html body .kyc-file-picker-v253 .btn { flex: 0 0 auto; }

/* Order detail keeps a consistent safe area from all four edges. */
html body .order-modal-v176,
html body .order-modal-v251 {
  box-sizing: border-box !important;
  padding: clamp(26px, 3.4vw, 38px) !important;
}
html body .order-modal-v176 > .modal-title,
html body .order-modal-v251 > .modal-title { padding-right: 50px !important; margin-bottom: 8px !important; }
html body .order-modal-v176 > .modal-desc,
html body .order-modal-v251 > .modal-desc { margin: 0 0 18px !important; line-height: 1.6 !important; }
html body .order-modal-v176 .order-detail-grid-v176,
html body .order-modal-v251 .order-detail-grid-v176 { margin: 18px 0 !important; }
html body .order-modal-v176 .order-detail-grid-v176 > div,
html body .order-modal-v251 .order-detail-grid-v176 > div { box-sizing: border-box !important; padding: 14px 15px !important; }
html body .order-modal-v176 > .form-group,
html body .order-modal-v251 > .form-group { margin: 18px 0 !important; }
html body .order-modal-v176 > .modal-actions,
html body .order-modal-v251 > .modal-actions { margin-top: 20px !important; padding-top: 18px !important; border-top: 1px solid rgba(255,255,255,.13); }

@media (max-width: 980px) {
  html body .product-listing-split-v253 { grid-template-columns: 1fr; }
  html body .product-listing-split-v253 > section { padding-inline: 0 !important; }
  html body .product-listing-split-v253 > section:first-child { border-right: 0 !important; border-bottom: 1px solid rgba(255,255,255,.14) !important; }
  html body .listing-compliance-v253 { grid-template-columns: 1fr; align-items: stretch; gap: 16px; }
  html body .listing-compliance-v253 .legal-inline-link { white-space: normal; }
  html body .tracking-page-head-v253 { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 820px) {
  html body[data-page-type="menu"] #sidebarMount .sidebar {
    position: fixed !important;
    top: var(--topbar-h, 68px) !important;
    bottom: 0 !important;
    left: 0 !important;
    width: min(320px, 88vw) !important;
    max-width: 88vw !important;
  }
  html body .product-listing-header-v253 { align-items: flex-start; flex-direction: column; gap: 10px; }
  html body .listing-form-grid-v253 { grid-template-columns: 1fr; }
  html body .listing-description-v253 { grid-column: auto; }
  html body .product-sku-row-v253.product-sku-card-v249 { grid-template-columns: minmax(0, 1fr) minmax(170px, .5fr) !important; gap: 14px !important; }
  html body .product-sku-row-v253 .product-sku-delete-v249 { grid-column: 1 / -1; width: 100% !important; }
  html body .product-image-grid-v253 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  html body .product-image-add-v253 { grid-column: 1 / -1; min-height: 112px; }
}

@media (max-width: 620px) {
  html body .listing-section-v253 { padding: 22px 0; }
  html body .listing-section-head-v253 { flex-direction: column; gap: 7px; }
  html body .listing-section-head-v253 > small { max-width: none; text-align: left; }
  html body .product-image-grid-v253 { grid-template-columns: 1fr !important; }
  html body .product-image-add-v253 { grid-column: auto; }
  html body .product-sku-row-v253.product-sku-card-v249 { grid-template-columns: 1fr !important; }
  html body .product-sku-row-v253 .product-sku-delete-v249 { grid-column: auto; }
  html body .option-group-list-v253 .option-group-card { grid-template-columns: 1fr !important; }
  html body .option-group-list-v253 .option-group-custom-v255 { grid-template-columns: 1fr !important; }
  html body .option-group-remove-v255 { width: 100% !important; }
  html body .listing-license-v253 .legal-license-fields { grid-template-columns: 1fr; }
  html body .product-listing-actions-v253 { align-items: stretch; flex-direction: column; }
  html body .product-listing-action-group-v255 { display: grid; grid-template-columns: 1fr 1fr; }
  html body .product-listing-actions-v253 > .danger-btn { width: 100% !important; }
  html body .tracking-code-form-v253 > div { grid-template-columns: 1fr; }
  html body .tracking-code-form-v253 .btn { width: 100%; }
  html body .kyc-file-picker-v253 { align-items: stretch !important; flex-direction: column; }
  html body .kyc-file-picker-v253 .btn { width: 100%; }
  html body .order-modal-v176,
  html body .order-modal-v251 { padding: 23px 18px 20px !important; }
  html body .order-modal-v176 .order-detail-grid-v176,
  html body .order-modal-v251 .order-detail-grid-v176 { grid-template-columns: 1fr !important; }
}
/* Production account state is rendered from /api/auth/session. */
.topbar-account-production {
  min-width: 72px;
  min-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

html:not([data-ready]) #tokenBalanceDisplay {
  visibility: hidden;
}

.market-grid > .empty-state,
.management-card-grid > .empty-state,
  #planGrid > .empty-state {
  grid-column: 1 / -1;
  width: 100%;
}

@media (max-width: 420px) {
  html body .product-listing-action-group-v255 { grid-template-columns: 1fr; }
  html body .product-listing-action-group-v255 .btn { width: 100% !important; }
}
