/* Feishu-style global command bar: persistent, compact and non-obstructive. */
html:not(.react-student-embedded) body .main {
  padding-top: 0 !important;
}

html:not(.react-student-embedded) body .shell > .main > header.topbar,
html:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 240 !important;
  align-self: start !important;
  display: grid !important;
  grid-template-columns: minmax(140px, 200px) minmax(280px, 520px) minmax(140px, 200px) !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  width: calc(100% + 48px) !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;
  margin: 0 -24px 18px !important;
  padding: 0 24px !important;
  overflow: visible !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(210, 219, 232, 0.9) !important;
  border-radius: 0 !important;
  background: rgba(248, 250, 253, 0.94) !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: blur(16px) saturate(140%) !important;
  backdrop-filter: blur(16px) saturate(140%) !important;
}

/* The homepage owns its horizontal spacing inside the panel, so it does not need the full-bleed offset. */
html:not(.react-student-embedded) body[data-active-panel="landing"] .shell > .main > header.topbar {
  width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !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 {
  min-width: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  align-items: center !important;
}

html:not(.react-student-embedded) body .topbar-title-stack,
html:not(.react-student-embedded) body .topbar-title-stack h2 {
  min-width: 0 !important;
  margin: 0 !important;
}

html:not(.react-student-embedded) body .topbar-title-stack h2 {
  color: #172033 !important;
  font-size: 18px !important;
  font-weight: 760 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.01em !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

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

html:not(.react-student-embedded) body .topbar-search {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 520px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 11px !important;
  overflow: hidden !important;
  border: 1px solid #dce4ee !important;
  border-radius: 10px !important;
  background: #f3f6fa !important;
  box-shadow: none !important;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease !important;
}

html:not(.react-student-embedded) body .topbar-search:hover {
  border-color: #c8d4e3 !important;
  background: #f8fafc !important;
}

html:not(.react-student-embedded) body .topbar-search:focus-within {
  border-color: #6b7cff !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(84, 104, 255, 0.1) !important;
}

html:not(.react-student-embedded) body .topbar-search-icon {
  position: relative !important;
  display: block !important;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  box-shadow: none !important;
}

html:not(.react-student-embedded) body .topbar-search-icon::before {
  content: "" !important;
  position: absolute !important;
  top: 2px !important;
  left: 2px !important;
  width: 8px !important;
  height: 8px !important;
  border: 1.7px solid #718198 !important;
  border-radius: 50% !important;
}

html:not(.react-student-embedded) body .topbar-search-icon::after {
  content: "" !important;
  position: absolute !important;
  right: 1px !important;
  bottom: 2px !important;
  width: 6px !important;
  height: 1.7px !important;
  border-radius: 999px !important;
  background: #718198 !important;
  transform: rotate(45deg) !important;
  transform-origin: center !important;
}

html:not(.react-student-embedded) body .topbar-search > input#topbarCommandInput {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: #273449 !important;
  font-size: 14px !important;
  font-weight: 560 !important;
  line-height: 34px !important;
  box-shadow: none !important;
}

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

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

/* Beat the historical homepage-only grid lock so the icon and text keep one geometry everywhere. */
html:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar .topbar-center > .topbar-search {
  grid-template-columns: 18px minmax(0, 1fr) !important;
  gap: 8px !important;
  padding: 0 11px !important;
}

html:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar .topbar-search > .topbar-search-icon {
  display: block !important;
  justify-self: center !important;
}

html:not(.react-student-embedded) body .topbar-center .global-ai-search-panel {
  top: calc(50% + 26px) !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 520px !important;
  padding: 12px !important;
  border: 1px solid rgba(210, 219, 232, 0.96) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16) !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .shell > .main > header.topbar,
html[data-theme="dark"]:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar {
  color: #eef4ff !important;
  border-bottom-color: rgba(125, 145, 174, 0.18) !important;
  background: rgba(10, 18, 31, 0.94) !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-title-stack h2 {
  color: #eef4ff !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search {
  border-color: rgba(125, 145, 174, 0.24) !important;
  background: #121d2e !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search:hover,
html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search:focus-within {
  border-color: rgba(113, 133, 255, 0.78) !important;
  background: #172438 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search > input#topbarCommandInput {
  color: #e7eef9 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search > input#topbarCommandInput::placeholder {
  color: #8090a6 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search-icon::before {
  border-color: #91a0b5 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-search-icon::after {
  background: #91a0b5 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .topbar-center .global-ai-search-panel {
  border-color: rgba(125, 145, 174, 0.24) !important;
  background: rgba(17, 27, 43, 0.98) !important;
}

@media (max-width: 1040px) {
  html:not(.react-student-embedded) body .shell > .main > header.topbar,
  html:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar {
    grid-template-columns: minmax(100px, 150px) minmax(220px, 1fr) minmax(100px, 150px) !important;
    gap: 12px !important;
  }
}

@media (max-width: 900px) {
  html:not(.react-student-embedded) body .shell > .main > header.topbar,
  html:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar {
    width: 100% !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    margin: 0 0 14px !important;
    padding: 0 14px !important;
    grid-template-columns: minmax(88px, 120px) minmax(180px, 1fr) minmax(24px, 88px) !important;
    gap: 10px !important;
  }

  html:not(.react-student-embedded) body .topbar-title-stack h2 {
    font-size: 16px !important;
  }
}

@media (max-width: 680px) {
  html:not(.react-student-embedded) body .shell > .main > header.topbar,
  html:not(.react-student-embedded) body[data-active-panel] .shell > .main > header.topbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

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

  html:not(.react-student-embedded) body .topbar-center,
  html:not(.react-student-embedded) body .topbar-search {
    max-width: none !important;
  }
}
