/* Keep identity controls in one place: the sidebar account card. */
html:not(.react-student-embedded) body .shell > .main > .topbar {
  display: grid !important;
  /* Symmetric side tracks keep the search field on the visual center line. */
  grid-template-columns: minmax(140px, 210px) minmax(320px, 720px) minmax(140px, 210px) !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: clamp(18px, 3vw, 52px) !important;
  min-height: 72px !important;
  padding: 0 clamp(24px, 2.5vw, 48px) !important;
}

html:not(.react-student-embedded) body .topbar-left,
html:not(.react-student-embedded) body .topbar-center,
html:not(.react-student-embedded) body .topbar-right {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

html:not(.react-student-embedded) body .topbar-left,
html:not(.react-student-embedded) body .topbar-right {
  display: flex !important;
  align-items: center !important;
}

html:not(.react-student-embedded) body .topbar-right {
  justify-content: flex-end !important;
}

html:not(.react-student-embedded) body .topbar-right:empty {
  display: none !important;
}

html:not(.react-student-embedded) body .topbar-right:has(> .debug-topbar-actions[hidden]) {
  display: none !important;
}

html:not(.react-student-embedded) body[data-active-panel="debug-lab"] .shell > .main > .topbar {
  grid-template-columns: minmax(140px, 210px) minmax(320px, 720px) minmax(140px, 210px) !important;
}

html:not(.react-student-embedded) body .topbar-title-stack,
html:not(.react-student-embedded) body .topbar-title-stack h2 {
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
}

html:not(.react-student-embedded) body .topbar-title-stack h2 {
  overflow: hidden !important;
  font-size: 20px !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html:not(.react-student-embedded) body .topbar-center {
  position: relative !important;
  justify-self: center !important;
  max-width: 720px !important;
}

html:not(.react-student-embedded) body .topbar-search {
  display: grid !important;
  grid-template-columns: 24px minmax(0, 1fr) auto !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 44px !important;
  padding: 0 12px !important;
  gap: 10px !important;
  align-items: center !important;
}

html:not(.react-student-embedded) body .topbar label.topbar-search > .topbar-search-icon {
  position: static !important;
  display: grid !important;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  padding: 0 !important;
  margin: 0 !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #64748b !important;
  font-size: 18px !important;
  line-height: 1 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

html:not(.react-student-embedded) body .topbar label.topbar-search > input#topbarCommandInput {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  inline-size: 100% !important;
  color: inherit !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  padding: 0 !important;
  opacity: 1 !important;
}

html:not(.react-student-embedded) body .topbar label.topbar-search > input#topbarCommandInput::placeholder {
  color: #718399 !important;
  opacity: 1 !important;
}

html:not(.react-student-embedded) body .topbar .global-topbar-user,
html:not(.react-student-embedded) body .topbar .global-topbar-brand {
  display: none !important;
}

html:not(.react-student-embedded) body .sidebar-account-copy {
  display: flex !important;
  min-width: 0 !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 3px !important;
}

html:not(.react-student-embedded) body .sidebar-account-copy small {
  display: block !important;
  color: #8fa4bc !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

html:not(.react-student-embedded) body .sidebar-account-button > i {
  display: grid !important;
  width: 20px !important;
  height: 20px !important;
  place-items: center !important;
  font-size: 13px !important;
  font-style: normal !important;
}

html:not(.react-student-embedded) body .shell.sidebar-collapsed .sidebar-account-copy,
html:not(.react-student-embedded) body .shell.sidebar-collapsed .sidebar-account-button > i {
  display: none !important;
}

html:not(.react-student-embedded) body .topbar-center .global-ai-search-panel {
  position: absolute !important;
  box-sizing: border-box !important;
  top: calc(100% + 10px) !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 3000 !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  max-height: min(500px, calc(100vh - 110px)) !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 12px !important;
  overflow: auto !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22) !important;
  transform: none !important;
}

html:not(.react-student-embedded) body .topbar-center .global-ai-search-panel[hidden] {
  display: none !important;
}

html:not(.react-student-embedded) body .global-ai-search-head {
  display: flex !important;
  min-height: 44px !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 0 4px 10px !important;
}

html:not(.react-student-embedded) body .global-ai-search-head > div {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

html:not(.react-student-embedded) body .global-ai-search-head button {
  display: grid !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: rgba(148, 163, 184, 0.12) !important;
  color: #64748b !important;
  font-size: 21px !important;
  cursor: pointer !important;
}

html:not(.react-student-embedded) body .global-ai-search-results {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}

html:not(.react-student-embedded) body .global-ai-result-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  min-height: 68px !important;
  padding: 10px 12px !important;
  gap: 12px !important;
  align-items: center !important;
}

html:not(.react-student-embedded) body .global-ai-result-card p {
  display: none !important;
}

@media (max-width: 900px) {
  html:not(.react-student-embedded) body .shell > .main > .topbar {
    grid-template-columns: minmax(86px, 120px) minmax(220px, 1fr) minmax(86px, 120px) !important;
    gap: 12px !important;
    padding-inline: 18px !important;
  }
}
