/* Shared corrections after the legacy visual layers. Keep the existing tokens. */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2147483100;
  padding: 0.75rem 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

body.has-unified-topbar :is(h1, h2, h3) {
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

body.has-unified-topbar
  .app-main
  :is(
    .workspace-stage-copy,
    .support-stage .section-copy,
    .page-intro,
    .profile-title-row
  )
  h1 {
  font-size: 2rem;
  line-height: 1.3;
  max-width: 100%;
  min-width: 0;
}

body.has-unified-topbar .site-header .nav-shell {
  overflow: visible;
}

.history-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

body.has-unified-topbar .surface-lift {
  will-change: auto;
}

body.has-unified-topbar .app-main .surface-lift-strong {
  transform: none;
}

body.has-unified-topbar .app-main .surface-lift-strong:hover,
body.has-unified-topbar .app-main .surface-lift-strong:focus-within {
  transform: none;
}

body.has-unified-topbar .apps-heading .status-pill {
  display: inline-flex;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  body.has-unified-topbar .site-header .nav-shell-main.nav-shell-main-unified {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    text-align: left;
  }

  body.has-unified-topbar .site-header .topbar-slot-start {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  body.has-unified-topbar .site-header .topbar-slot-end {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    justify-self: end;
  }

  body.has-unified-topbar .site-header .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.has-unified-topbar .site-header .site-nav-group a {
    min-height: 40px !important;
    font-size: 0.85rem !important;
    padding: 0.5rem 0.65rem !important;
  }
}

@media (max-width: 980px) {
  body.app-body.has-unified-topbar[data-page="dashboard"]
    .app-main
    .dashboard-inbox-grid
    > :is(.dashboard-history-card, .dashboard-inbox-meta) {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 768px) {
  body.app-body.has-unified-topbar[data-page="dashboard"]
    .app-main
    .workspace-stage-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-body.has-unified-topbar[data-page="dashboard"]
    .workspace-stage-metric:last-child {
    grid-column: 1 / -1;
  }

  body.app-body.has-unified-topbar[data-page="dashboard"]
    .chat-form
    .composer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 0.75rem;
  }

  body.app-body.has-unified-topbar[data-page="dashboard"]
    .chat-form
    .composer-actions
    :is(.inline-field, [data-new-chat]) {
    grid-column: 1 / -1;
    flex: none;
    min-height: 0;
  }

  body.app-body.has-unified-topbar[data-page="dashboard"]
    .chat-form
    .inline-field
    select {
    flex: 1;
    min-width: 0;
  }

  body.app-body.has-unified-topbar[data-page="dashboard"]
    .chat-form
    .composer-actions
    button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 0.75rem;
    white-space: normal;
  }

  body.app-body.has-unified-topbar[data-page="dashboard"] .chat-sample-prompts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-body.has-unified-topbar[data-page="dashboard"] .chat-sample-prompt {
    min-width: 0;
    white-space: normal;
  }

  body.has-unified-topbar .panel-header {
    flex-wrap: wrap;
    gap: 1rem;
  }

  body.has-unified-topbar .inline-search {
    width: 100%;
    min-width: 0;
  }

  body.has-unified-topbar .inline-search input {
    width: 100%;
    min-width: 0;
  }

  body.has-unified-topbar .main-wrapper {
    width: calc(100% - 1.5rem);
    padding-inline: 0;
  }

  body.has-unified-topbar
    :is(.site-main, .app-main)
    > :where(.section, .app-page) {
    padding-inline: 0;
  }

  body.has-unified-topbar
    .app-main
    :is(
      .workspace-stage-copy,
      .support-stage .section-copy,
      .page-intro,
      .profile-title-row
    )
    h1 {
    font-size: 1.75rem;
  }

  body.has-unified-topbar .auto-refresh-widget {
    left: 12px;
    right: auto;
    width: auto;
    max-width: calc(100% - 110px);
    padding: 0.6rem 0.75rem;
    gap: 0.75rem;
    transform: none;
  }

  body.has-unified-topbar .auto-refresh-copy small,
  body.has-unified-topbar .notification-label {
    display: none;
  }
}

@media (max-width: 430px) {
  body.has-unified-topbar .nav-actions-unified .button {
    min-height: 40px;
    padding-inline: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
