/* Signed-in application chrome. Sits above every page in the application
   layout so no screen is a dead end -- the dashboard in particular had no way
   back and no sign-out. */

.app-nav {
  margin: calc(var(--space-md) * -1) calc(var(--space-md) * -1) var(--space-lg);
  padding: 0 var(--space-md);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-nav__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-lg);
  max-width: 1180px;
  margin: 0 auto;
  min-height: 3.25rem;
}

.app-nav__brand {
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--font-size-md);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.app-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  /* Pushes the account cluster to the far edge. */
  margin-right: auto;
}

.app-nav__link {
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
}
.app-nav__link:hover { color: var(--color-text); background: var(--color-surface-muted); }

/* The active tab is underlined on the nav's own bottom rule, hence the -1px. */
.app-nav__link.is-active {
  color: var(--color-brand);
  background: transparent;
  border-bottom: 2px solid var(--color-brand);
  border-radius: 0;
  margin-bottom: -1px;
}

.app-nav__account {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.app-nav__email {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-subtle);
  font-size: var(--font-size-xs);
}

.app-nav__signout-form { display: inline; margin: 0; }

.app-nav__signout {
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
}
.app-nav__signout:hover { color: var(--color-text); background: var(--color-surface-muted); }

.app-nav a:focus-visible,
.app-nav button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

@media (max-width: 40rem) {
  .app-nav__inner { padding: var(--space-xs) 0; }
  .app-nav__email { display: none; }
  .app-nav__links { margin-right: 0; width: 100%; order: 3; }
}
