/* Lot 5: the visible My Studio section only. No admin Billing, other screens,
   native dialogs, invoice documents or project/media renderers are selected. */
html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]:has(#appContainer > main > #section-studio:not(.hidden)),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) body:has(#appContainer > main > #section-studio:not(.hidden)) {
  background: var(--ps-bg);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) {
  min-width: 0;
  max-width: 100%;
  container-type: inline-size;
  background: var(--ps-bg);
  border-color: var(--ps-line);
  border-radius: 9px;
  box-shadow: var(--ps-shell-reflection), 0 8px 24px #0003;
  color: var(--ps-text);
  font-family: var(--ps-font-ui);
  overflow-wrap: anywhere;
  overflow-anchor: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(h2, .studio-panel-title, .admin-subcard-heading h3, .studio-info-value, .studio-credits-title, .studio-credits-main, .studio-credits-card strong) {
  color: var(--ps-ink);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) > h2 {
  font-weight: 600;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(.studio-panel, .admin-subcard) {
  min-width: 0;
  max-width: 100%;
  border-color: var(--ps-line);
  border-radius: 9px;
  background: var(--ps-surface-soft);
  box-shadow: var(--ps-shell-reflection);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) .studio-panel-header {
  background: var(--ps-surface-solid);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(.studio-panel-icon, .admin-subcard-icon) {
  background: var(--ps-bg-soft);
  color: var(--ps-gold-light);
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) .admin-subcard:hover {
  transform: none;
  box-shadow: var(--ps-shell-reflection), 0 4px 12px #0002;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(.studio-info-item, .studio-credits-card) {
  background: var(--ps-bg-soft);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(.muted, .admin-subcard-title, .studio-info-label, .studio-credits-card em, label) {
  color: var(--ps-muted);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(input, select, textarea) {
  min-width: 0;
  max-width: 100%;
  border-color: var(--ps-line-strong);
  background: var(--ps-bg-soft);
  color: var(--ps-text);
  font-family: var(--ps-font-ui);
  color-scheme: dark;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(input, textarea)::placeholder {
  color: var(--ps-muted);
  opacity: .75;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) button {
  max-width: 100%;
  border-color: var(--ps-line-strong);
  border-radius: 6px;
  background: var(--ps-surface-soft);
  color: var(--ps-text);
  font-family: var(--ps-font-ui);
  box-shadow: var(--ps-shell-reflection);
  overflow-wrap: anywhere;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) input[type="file"]::file-selector-button {
  border: 1px solid var(--ps-line-strong);
  background: var(--ps-surface-soft);
  color: var(--ps-text);
  font-family: var(--ps-font-ui);
  border-radius: 6px;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) button:hover:not(:disabled) {
  border-color: var(--ps-gold);
  background: var(--ps-bg-soft);
  color: var(--ps-ink);
  box-shadow: var(--ps-shell-reflection);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #btnSaveStudio {
  border-color: var(--ps-button-border);
  background: var(--ps-button-bg);
  color: var(--ps-button-text);
  box-shadow: var(--ps-button-shadow);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #btnSaveStudio:hover:not(:disabled) {
  background: var(--ps-button-hover);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--ps-focus);
  outline-offset: 2px;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(input, select, textarea):focus {
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(button, input, select, textarea):disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(#studioLogoPreview, #myStudioCreditsSummary) {
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(#studioMembersContainer, #studioUsageContainer, .admin-subcard:has(> #invoiceTable)) {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ps-line-strong) var(--ps-surface-soft);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) table {
  background: var(--ps-bg-soft);
  color: var(--ps-text);
  font-family: var(--ps-font-ui);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) th {
  background: var(--ps-surface-solid);
  color: var(--ps-muted);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) td {
  color: var(--ps-text);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(#studioMembersContainer, #invoiceTable) tbody tr:hover {
  background: var(--ps-surface-solid);
}

/* The historical hierarchy consumes these variables on rows AND their cells.
   Keep its family border hues; change only this instance's surface palette. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioUsageContainer [data-billing-family] {
  --billing-family-parent-bg: var(--ps-surface-solid);
  --billing-family-event-bg: var(--ps-bg-soft);
  --billing-family-child-bg: var(--ps-surface-soft);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioUsageContainer [data-billing-family] > td {
  border-bottom-color: var(--billing-family-border);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioUsageContainer :is(.billing-event-detail-row > td, .billing-child-row > td:first-child) {
  border-left-color: var(--billing-family-border);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioMembersContainer > [data-ps-studio-state="error"] {
  color: #fda4af;
}

@container (max-width: 1000px) {
  :where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioUsageContainer > div > table {
    min-width: 980px;
  }
  :where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioMembersContainer > table {
    min-width: 620px;
  }
}

@container (max-width: 640px) {
  :where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(.studio-info-grid, .studio-form-grid) {
    grid-template-columns: minmax(0, 1fr);
  }
  :where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #invoiceTable {
    min-width: 480px;
  }
  :where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) #studioUsageContainer > div > div:first-child {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #section-studio:not(.hidden) :is(button, input, select, textarea, .admin-subcard) {
    transition: none;
  }
}
