.site-nav {
  display: grid;
  /* brand · flexible spacer · account. The nav markup (site-nav.js) is exactly
     these three cells — the create/pricing/docs links moved into the account
     dropdown. A stale `repeat(4, auto)` left three empty trailing tracks whose
     column gaps still rendered, padding ~2.25rem of dead space to the right of
     the avatar so it sat inset from the page column instead of flush-right. */
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.875rem;
  /* Clear the iOS notch on pages that opt into edge-to-edge (viewport-fit=cover,
     e.g. the entity/job chat surfaces). Resolves to 0 everywhere else, so this
     is a no-op on pages without viewport-fit=cover. */
  padding-top: env(safe-area-inset-top);
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.0025rem;
}

/* Account avatar dropdown — bundles the create actions (New run, New topic),
   Pricing, Docs, a collapsible theme chooser, and Log out. The container is the
   grid cell; the menu is absolutely positioned beneath the avatar. */
.site-nav-account {
  position: relative;
}

.site-nav-account-login {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav-account-login:hover {
  color: var(--ink);
}

.site-nav-account-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 40;
  min-width: 15rem;
  display: flex;
  flex-direction: column;
  padding: 0.375rem;
  border: 1px solid var(--soft-line);
  border-radius: 0.625rem;
  background: var(--warm-panel);
  box-shadow:
    0 0.5rem 1.5rem var(--shadow-color),
    0 0.0625rem 0.125rem var(--shadow-color-weak);
}

.site-nav-account-menu[hidden] {
  display: none;
}

.site-nav-account-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.4375rem 0.625rem;
  border: 0;
  border-radius: 0.4375rem;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    color 0.12s ease,
    background-color 0.12s ease;
}

.site-nav-account-menu-item:hover {
  color: var(--ink);
  background: var(--hover-bg);
}

.site-nav-account-trigger:focus-visible,
.site-nav-account-menu-item:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Coarse pointers (touch) — keep the tappable rows at the ~44px minimum. */
@media (pointer: coarse) {
  .site-nav-account-menu-item {
    min-height: 2.75rem;
    display: flex;
    align-items: center;
  }
}

.site-nav-account-menu-divider {
  height: 1px;
  margin: 0.3125rem 0.375rem;
  background: var(--soft-line);
}

.site-nav-account-menu-logout {
  color: var(--danger);
}

.site-nav-account-menu-logout:hover {
  color: var(--danger);
  background: var(--danger-tint);
}

/* Create group — the primary "New run" / "New topic" actions at the top of the
   menu. Emphasized (ink, not muted) so they read as the main reason to open it. */
.site-nav-account-menu-group {
  display: flex;
  flex-direction: column;
}

.site-nav-account-menu-create {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-weight: 500;
}

.site-nav-account-menu-icon {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  color: var(--ink-muted);
  transition: color 0.12s ease;
}

.site-nav-account-menu-icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.site-nav-account-menu-create:hover .site-nav-account-menu-icon {
  color: var(--ink);
}

/* Theme chooser as a collapsible secondary row, not an always-open block. */
.site-nav-account-theme {
  display: flex;
  flex-direction: column;
}

.site-nav-account-theme-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav-account-theme-icon,
.site-nav-account-theme-chevron {
  display: inline-grid;
  place-items: center;
  color: currentColor;
}

.site-nav-account-theme-icon {
  width: 1rem;
  height: 1rem;
}

.site-nav-account-theme-icon svg {
  width: 1rem;
  height: 1rem;
}

.site-nav-account-theme-value {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.65;
}

.site-nav-account-theme-chevron {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.65;
  transition: transform 0.15s ease;
}

.site-nav-account-theme-chevron svg {
  width: 0.875rem;
  height: 0.875rem;
}

.site-nav-account-theme.is-open .site-nav-account-theme-chevron {
  transform: rotate(180deg);
}

.site-nav-account-theme-panel {
  padding-top: 0.125rem;
  /* Entrance paired with the chevron rotation so the reveal feels deliberate
     rather than a snap while the chevron animates. */
  animation: site-nav-theme-panel-in 0.15s ease;
}

.site-nav-account-theme-panel[hidden] {
  display: none;
}

@keyframes site-nav-theme-panel-in {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect reduced-motion: no chevron spin, item transitions, or panel reveal. */
@media (prefers-reduced-motion: reduce) {
  .site-nav-account-menu-item,
  .site-nav-account-menu-icon,
  .site-nav-account-trigger,
  .site-nav-account-theme-chevron {
    transition: none;
  }

  .site-nav-account-theme.is-open .site-nav-account-theme-chevron {
    transform: none;
  }

  .site-nav-account-theme-panel {
    animation: none;
  }
}

.legal-page main {
  width: min(100%, 42rem);
}
