/* One navigation component for all six workspaces. Colors deliberately do
   not inherit each workspace's accent or typography. */
.page-header {
  position: sticky;
}

.page-header > .button:last-child {
  margin-left: auto;
}

.page-mode-switch {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: 640px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid #303a40;
  border-radius: 13px;
  background: #0e1417;
  box-shadow: 0 8px 28px rgb(0 0 0 / 16%);
  transform: translate(-50%, -50%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-mode-switch a {
  display: inline-flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #9ca9b1;
  font-size: 13px;
  font-weight: 650;
  line-height: 20px;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.page-mode-switch a:hover {
  color: #edf1f3;
  background: #1a2328;
}

.page-mode-switch a[aria-current="page"] {
  color: #a0ebbf;
  background: #203329;
  border-color: #365142;
}

.page-mode-switch a:focus-visible {
  outline: 2px solid #a0ebbf;
  outline-offset: 2px;
}

/* Keep navigation in the header at every normal workspace size. */
:root { --workspace-header-height: 84px; }
html:has(.page-mode-switch) {
  scroll-padding-top: calc(var(--workspace-header-height) + 20px);
}
body:not(.mobile-conversation-mode) .page-header {
  top: 0;
  z-index: 30;
  height: var(--workspace-header-height);
  min-height: var(--workspace-header-height);
}

@media (max-width: 1600px) {
  :root { --workspace-header-height: 148px; }

  body:not(.mobile-conversation-mode) .page-header:has(.page-mode-switch:not(.hidden)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 20px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .page-header > .page-mode-switch {
    position: static;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: min(640px, 100%);
    transform: none;
  }

  .page-header > .brand,
  .page-header > .brand-link { min-width: 0; }

  .page-header > .topbar-actions,
  .page-header > .top-controls,
  .page-header > .account-tools,
  .page-header > .top-links { justify-self: end; }
}

/* The simulator has independently scrolling panels below its header. */
@media (min-width: 1101px) and (max-width: 1600px) {
  .simulator-shell:has(.page-mode-switch:not(.hidden)) .sim-layout {
    height: calc(100dvh - var(--workspace-header-height));
  }
}

@media (max-width: 600px) {
  :root { --workspace-header-height: 190px; }

  .page-header > .page-mode-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .page-mode-switch a {
    min-height: 38px;
    padding-inline: 6px;
    font-size: 12px;
  }

  .page-header > .brand h1 { font-size: 14px; }
  .page-header > .brand .brand-mark { flex-shrink: 0; }
  .page-header > .topbar-actions { gap: 5px; }
  .page-header > .topbar-actions .button { padding: 8px; font-size: 11px; }
}

/* Simulator-only deployments hide the workspace navigation entirely. */
body:not(.mobile-conversation-mode) .page-header:has(.page-mode-switch.hidden) {
  height: 84px;
  min-height: 84px;
}

@media (prefers-reduced-motion: reduce) {
  .page-mode-switch a {
    transition: none;
  }
}
