/* Subtitle peripheral paint only. Native ownership/activation: PixelSoundTheme.
   No rule enters #tr-stage-panel, the media/transport/timeline or resize handles.
   Keep historical geometry, editor/metric fonts and Auto QC animations. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-subtitle-active],
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-subtitle-active] > body {
  background: var(--ps-bg) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-subtitle-active] :is(#section-project-detail, #projectToolsCard),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle="workspace"] {
  background: var(--ps-bg);
  border-color: var(--ps-line);
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-subtitle-active] #detailProjectTitle {
  color: var(--ps-ink);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle="workspace"] [data-ps-subtitle-ui], [data-ps-subtitle-portal]) {
  --ps-subtitle-copy: var(--ps-text);
  --ps-subtitle-danger: #fca5a5;
  --ps-subtitle-danger-bg: #451f24;
  --ps-subtitle-success: #a7e2ba;
  --ps-subtitle-success-bg: #123b2d;
  color: var(--ps-text);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle="workspace"] [data-ps-subtitle-ui="header"] {
  background: var(--ps-shell-header-bg);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle="workspace"] :is([data-ps-subtitle-ui="script"], [data-ps-subtitle-ui="export"]) {
  background: var(--ps-surface-solid);
  border-color: var(--ps-line);
  box-shadow: 0 8px 24px #0003;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui] :is(.admin-tab-panel-title, .admin-subcard-heading h3) {
  color: var(--ps-ink);
  font-family: var(--ps-font-ui);
}

/* Fixed-size icons accept the Studio typeface without reflowing protected UI. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui] :is(.admin-tab-panel-icon, .admin-subcard-icon) {
  background: var(--ps-bg-soft);
  color: var(--ps-gold-light);
  font-family: var(--ps-font-ui);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) .muted {
  color: var(--ps-muted) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) :is(button, input, select, textarea) {
  background: var(--ps-bg-soft) !important;
  color: var(--ps-text) !important;
  border-color: var(--ps-line) !important;
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) button:hover:not(:disabled) {
  background: var(--ps-surface-solid) !important;
  border-color: var(--ps-gold) !important;
  box-shadow: 0 0 0 2px #c9a97722;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) .btn-primary {
  background: var(--ps-button-bg) !important;
  color: var(--ps-button-text) !important;
  border-color: var(--ps-button-border) !important;
  box-shadow: var(--ps-button-shadow);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) .btn-primary:hover:not(:disabled) {
  background: var(--ps-button-hover) !important;
  color: var(--ps-button-text) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) button:disabled {
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) :is(button, input, select, textarea):focus-visible,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) :is(input, select, textarea):focus {
  outline: 2px solid var(--ps-focus);
  outline-offset: 2px;
  border-color: var(--ps-focus) !important;
  box-shadow: none;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) :is(input, textarea)::placeholder {
  color: var(--ps-muted);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="script"] :is(#tr-script-table-wrap, th, #tr-auto-qc-summary) {
  background: var(--ps-bg-soft) !important;
  color: var(--ps-muted) !important;
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="script"] :is(td, #tr-script-table-wrap > div, #tr-auto-qc-summary strong) {
  color: var(--ps-subtitle-copy) !important;
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="script"] [data-ps-subtitle-selected="true"] {
  background: linear-gradient(90deg, #c9a97738, #c9a97714) !important;
  box-shadow: inset 8px 0 0 var(--ps-gold) !important;
  outline-color: var(--ps-line-strong) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="script"] [data-ps-subtitle-qc="error"],
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal] :is(#tr-qc-delete-all-btn, #tr-delete-all-confirm-btn) {
  background: var(--ps-subtitle-danger-bg) !important;
  color: var(--ps-subtitle-danger) !important;
  border-color: var(--ps-subtitle-danger) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="script"] [data-ps-subtitle-qc="ok"] {
  background: var(--ps-subtitle-success-bg) !important;
  color: var(--ps-subtitle-success) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="export"] .projects-quota-track {
  background: var(--ps-bg);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="export"] :is(.projects-quota-bar, #tr-export-progress-bar) {
  background: var(--ps-button-bg);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="export"] a,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-subtitle-active] #section-project-detail .admin-form-actions > button {
  color: var(--ps-gold-light) !important;
  background: var(--ps-bg-soft);
  border-color: var(--ps-line);
}

/* Body portals have positive instance ownership, including the two Auto QC renderers. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal]:not([data-ps-subtitle-portal^="marker-"]):not([data-ps-subtitle-portal="columns"]) {
  background: #0009 !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal]:not([data-ps-subtitle-portal^="marker-"]) :is(div, label, span, h3, strong) {
  color: var(--ps-subtitle-copy) !important;
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-portal="columns"], [data-ps-subtitle-ui="header"] #tr-save-menu),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal]:not([data-ps-subtitle-portal^="marker-"]):not([data-ps-subtitle-portal="columns"]) > div {
  background: var(--ps-surface-solid) !important;
  border-color: var(--ps-line) !important;
  box-shadow: 0 24px 70px #0007 !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal]:not([data-ps-subtitle-portal^="marker-"]) > div > div:first-child,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="columns"] > div:first-child,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="header"] #tr-save-menu > div:first-child {
  --ps-subtitle-copy: var(--ps-ink);
  color: var(--ps-ink) !important;
  background: var(--ps-shell-header-bg) !important;
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal]:not([data-ps-subtitle-portal^="marker-"]) > div > div:last-child,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal]:not([data-ps-subtitle-portal^="marker-"]) > div > div:nth-child(2) > div,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="templates"] [data-template-row],
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="templates"] [data-template-list] > div,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="shortcuts"] > div > div:nth-child(2) > div {
  background: var(--ps-bg-soft) !important;
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-ui="header"] #tr-save-menu :is(div, span) {
  color: var(--ps-subtitle-copy) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="shortcuts"] span {
  background: var(--ps-surface-solid) !important;
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="delete-all"] > div > div:first-child,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="delete-all"] > div > div:nth-child(2) > div:first-child {
  --ps-subtitle-copy: var(--ps-subtitle-danger) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal="templates"] [data-template-delete] {
  color: var(--ps-subtitle-danger) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) [data-ps-subtitle-tone="danger"] {
  --ps-subtitle-copy: var(--ps-subtitle-danger);
  color: var(--ps-subtitle-danger) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is([data-ps-subtitle-ui], [data-ps-subtitle-portal]) [data-ps-subtitle-tone="success"] {
  --ps-subtitle-copy: var(--ps-subtitle-success);
  color: var(--ps-subtitle-success) !important;
}

/* Shared Markers: windows only, no timeline selector. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal^="marker-"] {
  background: var(--ps-surface-solid);
  color: var(--ps-text);
  border-color: var(--ps-line-strong);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal^="marker-"] .ps-project-marker-window-header {
  background: var(--ps-shell-header-bg);
  color: var(--ps-ink);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal^="marker-"] :is(.ps-project-marker-field, .ps-project-marker-empty) {
  color: var(--ps-muted);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal^="marker-"] :is(.ps-project-marker-item-time, input[readonly]) {
  color: var(--ps-gold-light) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-subtitle-portal^="marker-"] .ps-project-marker-status {
  color: var(--ps-subtitle-danger);
}
