/* V147 — professional XiaoWen entry: topbar button + right-side engineering assistant drawer. */

html:not(.react-student-embedded) body .topbar-right {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
}

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

html:not(.react-student-embedded) body .xiaowen-engineering-entry {
  display: inline-flex !important;
  width: auto !important;
  min-width: 134px !important;
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 4px 10px 4px 5px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  border: 1px solid #dce4ee !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.82) !important;
  color: #1f2b3d !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry[hidden] {
  display: none !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry:hover {
  border-color: #c5d1e0 !important;
  background: #ffffff !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08) !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry.is-active,
html:not(.react-student-embedded) body .xiaowen-engineering-entry[aria-expanded="true"] {
  border-color: rgba(79, 70, 229, 0.34) !important;
  background: #f4f3ff !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.2) !important;
  outline-offset: 2px !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry__avatar-wrap {
  position: relative !important;
  display: block !important;
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  overflow: visible !important;
  border-radius: 9px !important;
  background: #eef2ff !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry__avatar-wrap img {
  display: block !important;
  width: 28px !important;
  height: 28px !important;
  object-fit: cover !important;
  object-position: center 34% !important;
  border: 1px solid rgba(99, 102, 241, 0.18) !important;
  border-radius: 9px !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry__avatar-wrap i {
  position: absolute !important;
  right: -2px !important;
  bottom: -2px !important;
  width: 8px !important;
  height: 8px !important;
  border: 2px solid #ffffff !important;
  border-radius: 999px !important;
  background: #22c55e !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry__copy {
  display: grid !important;
  min-width: 0 !important;
  gap: 1px !important;
  text-align: left !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry__copy strong {
  color: #172033 !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  line-height: 1.1 !important;
}

html:not(.react-student-embedded) body .xiaowen-engineering-entry__copy small {
  color: #718198 !important;
  font-size: 9px !important;
  font-weight: 620 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

html:not(.react-student-embedded) body[data-active-panel="debug-lab"] .xiaowen-engineering-entry {
  width: 36px !important;
  min-width: 36px !important;
  padding: 4px !important;
  justify-content: center !important;
}

html:not(.react-student-embedded) body[data-active-panel="debug-lab"] .xiaowen-engineering-entry__copy {
  display: none !important;
}

html:not(.react-student-embedded) body[data-active-panel="debug-lab"] .debug-topbar-actions {
  gap: 6px !important;
}

html:not(.react-student-embedded) body[data-active-panel="debug-lab"] .debug-topbar-actions button {
  min-height: 34px !important;
  padding: 0 9px !important;
  font-size: 11px !important;
}

/* The old character and avatar launcher are removed from the product surface. */
html:not(.react-student-embedded) body #companionAvatarDock.companion-avatar-dock,
html:not(.react-student-embedded) body #companionAmbientStage,
html:not(.react-student-embedded) body #companionMini {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html:not(.react-student-embedded) body .companion-drawer-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 3180 !important;
  display: block !important;
  border: 0 !important;
  background: rgba(15, 23, 42, 0.32) !important;
  -webkit-backdrop-filter: blur(2px) !important;
  backdrop-filter: blur(2px) !important;
}

html:not(.react-student-embedded) body .companion-drawer-backdrop[hidden] {
  display: none !important;
}

html:not(.react-student-embedded) body.companion-drawer-open {
  overflow: hidden !important;
}

html:not(.react-student-embedded) body #companionDock.companion-dock.companion-simple-assistant,
html:not(.react-student-embedded) body #companionDock.companion-dock.companion-expanded.companion-simple-assistant:not(.companion-fullscreen) {
  position: fixed !important;
  inset: 0 0 0 auto !important;
  z-index: 3200 !important;
  display: block !important;
  width: min(430px, 100vw) !important;
  min-width: min(430px, 100vw) !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: -18px 0 52px rgba(15, 23, 42, 0.16) !important;
  transform: none !important;
}

html:not(.react-student-embedded) body #companionDock.companion-dock[hidden] {
  display: none !important;
}

html:not(.react-student-embedded) body #companionDock #companionPanel.companion-panel {
  position: static !important;
  inset: auto !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100vh !important;
  min-height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
  transform: none !important;
}

html:not(.react-student-embedded) body #companionDock #companionPanel.companion-panel[hidden] {
  display: none !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-panel-head {
  min-height: 72px !important;
  padding: 12px 16px !important;
  gap: 11px !important;
  border-bottom: 1px solid #e6ebf2 !important;
  background: rgba(255, 255, 255, 0.98) !important;
}

html:not(.react-student-embedded) body #companionPanel #companionPanelAvatar.companion-panel-avatar-token,
html:not(.react-student-embedded) body #companionPanel .companion-brief-avatar-token {
  display: block !important;
  padding: 0 !important;
  object-fit: cover !important;
  object-position: center 34% !important;
  border: 1px solid rgba(99, 102, 241, 0.16) !important;
  background: #eef2ff !important;
  box-shadow: none !important;
}

html:not(.react-student-embedded) body #companionPanel #companionPanelAvatar.companion-panel-avatar-token {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-panel-heading > strong {
  color: #172033 !important;
  font-size: 15px !important;
  font-weight: 780 !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-panel-heading > p {
  max-width: 240px !important;
  margin-top: 3px !important;
  color: #718198 !important;
  font-size: 11px !important;
  font-weight: 540 !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-panel-tools button {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 9px !important;
  background: #f8fafc !important;
  color: #64748b !important;
  font-size: 15px !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-panel-tools button:hover {
  border-color: #cbd5e1 !important;
  background: #f1f5f9 !important;
  color: #334155 !important;
}

html:not(.react-student-embedded) body #companionPanel #companionHideBtn {
  display: none !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-agent-layout {
  min-height: 0 !important;
  overflow: hidden !important;
  background: #f6f8fb !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-agent-workspace {
  display: grid !important;
  grid-template-rows: auto auto minmax(96px, 1fr) auto auto auto !important;
  gap: 10px !important;
  height: 100% !important;
  padding: 16px !important;
  overflow: hidden !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-brief-card {
  min-height: 96px !important;
  padding: 14px !important;
  gap: 9px !important;
  border: 1px solid #e1e7f0 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04) !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-brief-avatar-token {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-brief-card .eyebrow {
  color: #4f46e5 !important;
  font-size: 9px !important;
  letter-spacing: 0.08em !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-brief-card strong {
  color: #1e293b !important;
  font-size: 13px !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-brief-card > p {
  color: #64748b !important;
  font-size: 11px !important;
  line-height: 1.6 !important;
}

html:not(.react-student-embedded) body #companionPanel #companionMessages.companion-messages {
  display: grid !important;
  min-height: 96px !important;
  padding: 2px !important;
  overflow-y: auto !important;
}

html:not(.react-student-embedded) body #companionPanel #companionActions.companion-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

html:not(.react-student-embedded) body #companionPanel #companionActions button {
  min-height: 38px !important;
  border: 1px solid rgba(79, 70, 229, 0.15) !important;
  border-radius: 10px !important;
  background: #f2f1ff !important;
  color: #4338ca !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

html:not(.react-student-embedded) body #companionPanel .companion-open-coach-btn {
  display: none !important;
}

html:not(.react-student-embedded) body #companionPanel #companionForm.companion-input-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  gap: 8px !important;
  padding: 10px !important;
  border: 1px solid #dde4ee !important;
  border-radius: 13px !important;
  background: #ffffff !important;
}

html:not(.react-student-embedded) body #companionPanel #companionInput {
  display: block !important;
  min-height: 38px !important;
  max-height: 96px !important;
  padding: 8px 4px !important;
  resize: none !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: #1e293b !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
  box-shadow: none !important;
}

html:not(.react-student-embedded) body #companionPanel #companionVoiceBtn,
html:not(.react-student-embedded) body #companionPanel #companionForm button[type="submit"] {
  display: inline-flex !important;
  min-width: 50px !important;
  min-height: 36px !important;
  padding: 0 10px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  font-weight: 720 !important;
}

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

html[data-theme="dark"]:not(.react-student-embedded) body .xiaowen-engineering-entry__copy strong {
  color: #eef4ff !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body .xiaowen-engineering-entry__copy small {
  color: #91a0b5 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body #companionDock.companion-dock,
html[data-theme="dark"]:not(.react-student-embedded) body #companionDock #companionPanel.companion-panel,
html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel .companion-panel-head {
  border-color: #26364c !important;
  background: #101a2a !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel .companion-agent-layout {
  background: #0c1523 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel .companion-brief-card,
html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel #companionForm.companion-input-row {
  border-color: #26364c !important;
  background: #142033 !important;
}

html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel .companion-panel-heading > strong,
html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel .companion-brief-card strong,
html[data-theme="dark"]:not(.react-student-embedded) body #companionPanel #companionInput {
  color: #eef4ff !important;
}

@media (max-width: 900px) {
  html:not(.react-student-embedded) body .xiaowen-engineering-entry {
    min-width: 112px !important;
    padding-right: 7px !important;
  }

  html:not(.react-student-embedded) body .xiaowen-engineering-entry__copy small {
    display: none !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) auto !important;
  }

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

  html:not(.react-student-embedded) body .xiaowen-engineering-entry {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 4px !important;
    justify-content: center !important;
  }

  html:not(.react-student-embedded) body .xiaowen-engineering-entry__copy {
    display: none !important;
  }

  html:not(.react-student-embedded) body #companionDock.companion-dock.companion-simple-assistant,
  html:not(.react-student-embedded) body #companionDock.companion-dock.companion-expanded.companion-simple-assistant:not(.companion-fullscreen) {
    width: 100vw !important;
    min-width: 100vw !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.react-student-embedded) body .xiaowen-engineering-entry {
    transition: none !important;
  }
}
