/* Utility navigation has one home, separate from each application's tools. */
.workspace-trigger,
.workspace-panel {
  --ws-bg: #191b1e;
  --ws-soft: #23262a;
  --ws-text: #f0f1ef;
  --ws-muted: #b3b8b0;
  --ws-line: #3b4039;
  --ws-focus: #d9ba7b;
}
.portal-page :is(.workspace-trigger, .workspace-panel) {
  --ws-bg: #fffefa;
  --ws-soft: #f0f1e9;
  --ws-text: #292b25;
  --ws-muted: #626959;
  --ws-line: #d9dece;
  --ws-focus: #677750;
  color-scheme: light;
}
.account-workspace :is(.workspace-trigger, .workspace-panel) {
  --ws-bg: var(--surface);
  --ws-soft: var(--surface-2);
  --ws-text: var(--text);
  --ws-muted: var(--muted);
  --ws-line: var(--border-strong);
  --ws-focus: var(--focus);
}
body .workspace-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  justify-self: end;
  border: 1px solid var(--ws-line);
  border-radius: 24px;
  min-height: 40px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  color: var(--ws-text);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}
.workspace-trigger svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.3;
}
body .workspace-trigger:hover {
  background: var(--ws-soft);
}
body.workspace-open {
  overflow: hidden;
}
body dialog.workspace-panel {
  position: fixed;
  inset: 12px 12px 12px auto;
  width: min(420px, calc(100% - 24px));
  max-width: none;
  height: calc(100% - 24px);
  max-height: none;
  box-sizing: border-box;
  margin: 0;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--ws-bg);
  color: var(--ws-text);
  border: 1px solid var(--ws-line);
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
}
.workspace-panel::backdrop {
  background: #0007;
}
.workspace-head {
  position: sticky;
  top: -24px;
  z-index: 2;
  padding: 8px 0;
  margin-top: -8px;
  background: var(--ws-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
body .workspace-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  color: var(--ws-text);
}
body .workspace-panel .workspace-close {
  border: 1px solid var(--ws-line);
  border-radius: 20px;
  color: var(--ws-text);
  background: transparent;
  padding: 6px 14px;
  font: inherit;
  font-size: 12px;
  min-height: 36px;
  cursor: pointer;
}
.workspace-identity {
  margin: 12px 0 24px;
  color: var(--ws-muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}
body .workspace-section {
  border-top: 1px solid var(--ws-line);
  padding: 20px 0;
  margin: 0;
  min-width: 0;
}
body .workspace-section:last-child {
  padding-bottom: 0;
}
body .workspace-section h3 {
  font-size: 12px;
  font-weight: 500;
  color: var(--ws-muted);
  margin: 0 0 10px;
  letter-spacing: 0.05em;
}
body .workspace-panel .workspace-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  margin: 2px 0;
  color: var(--ws-text);
  background: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.workspace-action-arrow {
  color: var(--ws-muted);
  font-size: 15px;
}
body .workspace-panel .workspace-action:hover {
  background: var(--ws-soft);
}
.workspace-panel :is(button, a, input, select):focus-visible,
.workspace-trigger:focus-visible {
  outline: 2px solid var(--ws-focus);
  outline-offset: 3px;
}
.workspace-panel .workspace-nav {
  display: grid;
  gap: 2px;
}
body .workspace-panel #resource-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 12px;
  gap: 12px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: var(--ws-soft);
}
body .workspace-panel #resource-strip span {
  color: var(--ws-muted);
  font-size: 12px;
}
body .workspace-panel #resource-strip strong {
  display: block;
  color: var(--ws-text);
  margin: 4px 0 0;
  font-size: 16px;
}
body .workspace-panel #resource-strip .live {
  margin: 0;
}
.workspace-gpu {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ws-line);
  font-size: 12px;
}
.workspace-gpu strong {
  font-weight: 500;
}
.workspace-gpu span {
  color: var(--ws-muted);
  text-align: right;
}
/* The audio controls are moved, not cloned, so polling and selection still work. */
body .workspace-panel .account-strip {
  display: grid;
  padding: 0;
  margin: 0;
  gap: 2px;
}
body .workspace-panel #resource-monitor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  margin: 12px 0;
  gap: 16px 12px;
  background: transparent;
}
body .workspace-panel .resource-card {
  border: 0;
  padding: 0;
  min-width: 0;
}
body .workspace-panel .resource-card small {
  font-size: 11px;
  overflow-wrap: anywhere;
}
body .workspace-panel .resource-card strong {
  font-size: 15px;
  white-space: normal;
}
body .workspace-panel .resource-updated {
  margin: 0;
  padding: 4px 0;
  font-size: 11px;
}
body .workspace-panel .compute-controls {
  display: grid;
  margin: 0 0 16px;
  padding: 0;
  gap: 8px;
}
body .workspace-panel .compute-controls select {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}
body .workspace-panel .compute-controls label {
  font-size: 13px;
}
body .workspace-panel .compute-controls .small {
  font-size: 11px;
  color: var(--ws-muted);
}
body .workspace-panel #statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  width: 100%;
  padding: 0;
}
.workspace-preferences {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
body .workspace-panel #model-state {
  display: inline-flex;
}
.workspace-preferences > label {
  font-size: 13px;
}
.workspace-preferences .theme-switch {
  margin-left: auto;
}
/* Music's own tabs remain the primary navigation. */
body.workspace-audio .topbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 24px;
}
body.workspace-audio .topbar .brand {
  width: auto;
  flex-shrink: 0;
}
body.workspace-audio .topbar .tabs {
  width: auto;
  flex: 1;
}
body.workspace-audio main {
  min-height: calc(100vh - 100px);
}
@media (max-width: 720px) {
  body .workspace-trigger {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 12px;
  }
  body .app-topbar {
    gap: 12px;
  }
  body .app-topbar .app-context {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  body.workspace-audio .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 12px 16px 0;
  }
  body.workspace-audio .topbar .brand {
    min-width: 0;
  }
  body.workspace-audio .topbar .version {
    display: none;
  }
  body.workspace-audio .topbar .tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-height: 44px;
  }
  body.workspace-audio .topbar .workspace-trigger {
    grid-column: 2;
    grid-row: 1;
  }
  body dialog.workspace-panel {
    padding: 20px;
  }
  .workspace-head {
    top: -20px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .studio-motion dialog.workspace-panel[open] {
    animation: workspace-slide 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes workspace-slide {
    from {
      opacity: 0;
      translate: 12px 0;
    }
    to {
      opacity: 1;
      translate: 0 0;
    }
  }
}
