/* First Step presentation only. PixelSoundTheme owns native sheet activation.
   Preserve geometry, track-state paint and hover transforms. The processing
   meter shares its height with Original. No foreign project or importer. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active],
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] > body {
  background: var(--ps-bg) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail {
  color: var(--ps-text);
  background: var(--ps-bg);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail :is(.projects-panel, .admin-tab-panel) {
  background: var(--ps-bg-soft);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail :is(.projects-panel-header, .admin-tab-panel-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-first-step-active] #section-project-detail .admin-subcard {
  background: var(--ps-surface-solid);
  border-color: var(--ps-line);
  box-shadow: 0 8px 24px #0003, var(--ps-shell-reflection);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail .admin-subcard:hover {
  box-shadow: 0 16px 40px #0005, var(--ps-shell-reflection);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail :is(h2, h3, .admin-subcard-title, .projects-panel-title, .admin-tab-panel-title) {
  color: var(--ps-ink);
}

/* The fixed icon boxes accept IBM Plex Sans; keep the historical flow fonts
   and button metrics so the full project shell does not reflow on theme change. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail :is(.projects-panel-icon, .admin-tab-panel-icon, .admin-subcard-icon) {
  font-family: var(--ps-font-ui);
  background: var(--ps-bg-soft);
  color: var(--ps-gold);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail :is(.muted, .fs-empty) {
  color: var(--ps-muted);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #projectStatsZone > div,
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .fs-table-scroll {
  background: var(--ps-bg-soft) !important; /* historical inline surface */
  border-color: var(--ps-line) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .routing-legend-item {
  background: var(--ps-bg-soft);
  color: var(--ps-text);
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .fs-table-scroll {
  scrollbar-color: var(--ps-line-strong) var(--ps-bg-soft);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .fs-table :is(thead, th) {
  background: var(--ps-bg-soft);
  color: var(--ps-ink);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .fs-table :is(th, td) {
  border-color: var(--ps-line);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .fs-table td {
  color: var(--ps-text);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] .fs-table tbody tr:hover {
  background: #c9a97712;
}

/* Same 8px meter as Original; only its paint follows Studio. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] #fs-work-progress {
  background: var(--ps-surface-soft);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] #fs-work-progress-bar {
  background: var(--ps-button-bg);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] #fs-work-progress[data-state="done"] #fs-work-progress-bar {
  background: #a7e3bd;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] #fs-work-progress[data-state="error"] #fs-work-progress-bar {
  background: #ffb4b4;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) [data-ps-first-step="workspace"] #fs-work-progress[data-state="cancelled"] #fs-work-progress-bar {
  background: #f5cd91;
}

/* No background rule targets .fs-track-btn, including hover/focus/disabled.
   Its inline #555555 / #00bfff / #00c851 and 22px hitbox remain authoritative. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail button:not(.fs-track-btn):not(.btn-primary) {
  background: var(--ps-bg-soft);
  color: var(--ps-text);
  border-color: var(--ps-line-strong);
  box-shadow: var(--ps-shell-reflection);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail button:not(.fs-track-btn):not(.btn-primary):hover:not(:disabled) {
  background: var(--ps-surface-soft);
  border-color: var(--ps-gold);
  box-shadow: 0 8px 22px #0003, 0 0 0 3px #c9a97722;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail .btn-primary {
  background: var(--ps-button-bg);
  color: var(--ps-button-text);
  border-color: var(--ps-button-border);
  box-shadow: var(--ps-button-shadow);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail .btn-primary:hover:not(:disabled) {
  background: var(--ps-button-hover);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail a {
  color: var(--ps-gold-light);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail :is(button, a):focus-visible {
  outline: 2px solid var(--ps-focus);
  outline-offset: 3px;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail .ps-project-status[data-ps-status="NOT_STARTED"] {
  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-first-step-active] #section-project-detail .ps-project-status[data-ps-status="IN_PROGRESS"] {
  background: #352b1b !important;
  color: #f5cd91 !important;
  border-color: #a48a5566 !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail .ps-project-status[data-ps-status="DONE"] {
  background: #123b2d !important;
  color: #a7e3bd !important;
  border-color: #4c8b6466 !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #section-project-detail .ps-project-status[data-ps-status="ERROR"] {
  background: #451f24 !important;
  color: #ffb4b4 !important;
  border-color: #ad666666 !important;
}

/* The complete project shell includes the existing shared status menu. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #projectStatusPill {
  --ps-project-status-shadow: 0 8px 18px #0002;
  --ps-project-status-dot-shadow: 0 0 0 3px #0002;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #projectStatusPill .ps-project-status-trigger:focus-visible {
  --ps-project-focus-outline: 2px solid var(--ps-focus);
  --ps-project-focus-offset: 3px;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #projectStatusMenu[data-ps-first-step-portal="project-status"] {
  --ps-project-menu-bg: var(--ps-surface-solid);
  --ps-project-menu-border: var(--ps-line-strong);
  --ps-project-menu-shadow: var(--ps-shell-reflection), 0 18px 50px #0005;
  --ps-project-menu-option-bg: transparent;
  --ps-project-menu-option-text: var(--ps-text);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #projectStatusMenu[data-ps-first-step-portal="project-status"] button[data-ps-current="true"],
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #projectStatusMenu[data-ps-first-step-portal="project-status"] button:hover {
  --ps-project-menu-option-bg: var(--ps-bg-soft);
  --ps-project-menu-option-text: var(--ps-gold-light);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #projectStatusMenu[data-ps-first-step-portal="project-status"] button:focus-visible {
  outline: 2px solid var(--ps-focus);
  outline-offset: 3px;
}

/* Shared importer: paint only the frozen First Step instance and project panel.
   Reuse its presentation variables; never override progress width/animation. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal],
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #externalImportProjectPanel {
  --ps-wf-import-active: var(--ps-gold);
  --ps-wf-import-success: #a7e3bd;
  --ps-wf-import-error: #ffb4b4;
  --ps-wf-import-warning: #f5cd91;
  color: var(--ps-text);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] {
  background: #0009 !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is([role="dialog"], [data-nextcloud-lock-message]) {
  background: var(--ps-surface-solid) !important;
  color: var(--ps-text) !important;
  border-color: var(--ps-line) !important;
  box-shadow: 0 28px 80px #0007 !important;
}

/* These inline backgrounds are decorative surfaces in the shared importer.
   The functional transfer fill is deliberately excluded. No media is inside. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :where([style*="background:"], [data-import-transfer-id]):not([data-import-field="progress"], [role="dialog"], [data-nextcloud-lock-message], button, input, select, textarea),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #externalImportProjectPanel :where([style*="background:"], [data-import-transfer-id]):not([data-import-field="progress"]) {
  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"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is(button, input, select, textarea) {
  background: var(--ps-surface-soft) !important;
  color: var(--ps-text) !important;
  border-color: var(--ps-line-strong) !important;
  accent-color: var(--ps-gold);
  box-shadow: var(--ps-shell-reflection);
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] button:hover:not(:disabled) {
  background: var(--ps-surface-solid) !important;
  border-color: var(--ps-gold) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-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(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] .btn-primary:hover:not(:disabled) {
  background: var(--ps-button-hover) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--ps-focus) !important;
  outline-offset: 3px;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) #mediaImportModal[data-ps-first-step-portal="media-import"] [data-nextcloud-selection-index][style*="rgb(239, 246, 255)"] {
  background: var(--ps-surface-solid) !important;
  border-color: var(--ps-gold) !important;
}

/* Neutral text, including DOM-normalized inline values patched after progress. */
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is([style*="color:#0f172a"], [style*="color:#334155"], [style*="color:#475569"], [style*="color:#1e293b"], [data-import-field="filename"]),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #externalImportProjectPanel [data-import-field="filename"] {
  color: var(--ps-text) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is(.muted, [style*="color:#64748b"], [style*="color:#94a3b8"], [style*="color: rgb(100, 116, 139)"], [data-import-field="detail"]),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #externalImportProjectPanel :is([data-import-field="detail"], [data-import-counts]) {
  color: var(--ps-muted) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is(#mediaImportModalTitle, [style*="color:#2563eb"], [style*="color:#0284c7"], [style*="color:#1e3a8a"]) {
  color: var(--ps-ink) !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is([style*="color:#dc2626"], [style*="color:#b91c1c"], [style*="color: rgb(220, 38, 38)"], [style*="color: rgb(185, 28, 28)"]),
:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"])[data-ps-first-step-active] #externalImportProjectPanel [data-import-field="detail"][style*="rgb(220, 38, 38)"] {
  color: #ffb4b4 !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is([style*="color:#16a34a"], [style*="color: rgb(22, 163, 74)"]) {
  color: #a7e3bd !important;
}

:where(html[data-ps-theme="studio"][data-ps-window="hub"][data-ps-screen="app"]) :is(#mediaImportModal, #nextcloudBatchInteractionLock)[data-ps-first-step-portal] :is([style*="color:#b45309"], [style*="color:#d97706"], [style*="color: rgb(180, 83, 9)"], [style*="color: rgb(217, 119, 6)"]) {
  color: #f5cd91 !important;
}
