/* MOI Docs Assistant: isolated from article typography and shared navigation. */
#mo-docs-chat-root {
  --chat-bg: #fff; --chat-fg: #17191d; --chat-muted: #69717e; --chat-border: #e2e5eb;
  --chat-soft: #f5f6f8; --chat-brand: var(--mo-primary, #004af0); --chat-width: 400px;
  color: var(--chat-fg); font: 14px/1.6 "Geist", "PingFang SC", system-ui, sans-serif;
}
:is(body[data-theme="dark"], html[data-mo-resolved-theme="dark"] body) #mo-docs-chat-root {
  --chat-bg: #191e24; --chat-fg: #e4e9ef; --chat-muted: #aeb8c7; --chat-border: #39424f; --chat-soft: #242c36;
}
#mo-docs-chat-root * { box-sizing: border-box; }
#mo-docs-chat-root [hidden] { display: none !important; }
#mo-docs-chat-root button, #mo-docs-chat-root textarea { font: inherit; }
#mo-docs-chat-root button { cursor: pointer; }
#mo-docs-chat-root button:disabled { cursor: default; opacity: .5; }
#mo-docs-chat-root button:focus-visible, #mo-docs-chat-root a:focus-visible, #mo-docs-chat-root textarea:focus-visible { outline: 2px solid var(--chat-brand); outline-offset: 3px; }
#mo-docs-chat-root .mo-chat-icon { display: inline-flex; flex-shrink: 0; width: 19px; height: 19px; }
#mo-docs-chat-root .mo-chat-icon svg { display: block; width: 100%; height: 100%; }
#mo-docs-chat-root .mo-chat-button { border: 1px solid var(--chat-border); border-radius: 7px; background: var(--chat-bg); color: var(--chat-fg); padding: 8px 11px; text-align: left; }
#mo-docs-chat-root .mo-chat-button:hover { background: var(--chat-soft); }
#mo-docs-chat-root .mo-chat-launcher { position: fixed; right: 24px; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 9px; border: 0; border-radius: 28px; padding: 13px 19px; background: var(--chat-fg); color: var(--chat-bg); z-index: 95; box-shadow: 0 4px 16px #0002; }
#mo-docs-chat-root .mo-chat-launcher:hover { background: var(--chat-fg); }
#mo-docs-chat-root .mo-chat-panel { position: fixed; right: 0; top: var(--mo-topbar-h, 112px); bottom: 0; width: min(var(--chat-width), 100%); display: flex; flex-direction: column; background: var(--chat-bg); border-left: 1px solid var(--chat-border); z-index: 90; box-shadow: -8px 0 28px #0000000a; }
#mo-docs-chat-root .mo-chat-header { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--chat-border); }
#mo-docs-chat-root .mo-chat-header > button { display: grid; place-items: center; padding: 6px; background: transparent; border: 0; }
#mo-docs-chat-root .mo-chat-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--chat-border); border-radius: 9px; flex-shrink: 0; }
#mo-docs-chat-root .mo-chat-title-block { flex: 1; min-width: 0; }
#mo-docs-chat-root .mo-chat-title-block h2 { margin: 0; font-size: 15px; font-weight: 600; }
#mo-docs-chat-root .mo-chat-title-block p { margin: 1px 0 0; color: var(--chat-muted); font-size: 11px; }
#mo-docs-chat-root .mo-chat-scope { display: flex; align-items: flex-start; gap: 8px; padding: 13px 17px 0; color: var(--chat-muted); font-size: 11px; }
#mo-docs-chat-root .mo-chat-scope .mo-chat-icon { width: 14px; height: 14px; margin-top: 2px; }
#mo-docs-chat-root .mo-chat-conversation { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 18px; scrollbar-width: thin; }
#mo-docs-chat-root .mo-chat-welcome { padding: 8px 0 15px; }
#mo-docs-chat-root .mo-chat-welcome > .mo-chat-icon { width: 27px; height: 27px; color: var(--chat-brand); margin-bottom: 16px; }
#mo-docs-chat-root .mo-chat-welcome h3 { font-size: 21px; line-height: 1.4; font-weight: 600; margin: 0 0 8px; }
#mo-docs-chat-root .mo-chat-welcome p { color: var(--chat-muted); font-size: 13px; margin: 0 0 23px; }
#mo-docs-chat-root .mo-chat-suggestion { width: 100%; display: block; margin: 9px 0; font-size: 13px; }
#mo-docs-chat-root .mo-chat-user { margin: 0 0 22px 22px; background: var(--chat-soft); border: 1px solid var(--chat-border); border-radius: 12px 12px 3px 12px; padding: 11px 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
#mo-docs-chat-root .mo-chat-turn + .mo-chat-turn { margin-top: 26px; }
#mo-docs-chat-root .mo-chat-answer { overflow-wrap: anywhere; font-size: 13px; }
#mo-docs-chat-root .mo-chat-answer p { margin: 8px 0 13px; }
#mo-docs-chat-root .mo-chat-answer h4 { font-size: 14px; font-weight: 600; margin: 20px 0 9px; }
#mo-docs-chat-root .mo-chat-agent-label { color: var(--chat-muted); font-size: 11px; margin-bottom: 10px; }
#mo-docs-chat-root .mo-chat-answer ul, #mo-docs-chat-root .mo-chat-answer ol { padding-left: 21px; }
#mo-docs-chat-root .mo-chat-answer li { margin-bottom: 8px; }
#mo-docs-chat-root .mo-chat-answer pre { background: var(--chat-soft); color: var(--chat-fg); padding: 12px; border: 1px solid var(--chat-border); border-radius: 7px; max-width: 100%; overflow: auto; }
#mo-docs-chat-root .mo-chat-answer code { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
#mo-docs-chat-root .mo-chat-answer a { color: var(--chat-brand); text-decoration: underline; text-underline-offset: 3px; }
#mo-docs-chat-root .mo-chat-sources { display: flex; flex-direction: column; gap: 9px; border-top: 1px solid var(--chat-border); padding-top: 13px; margin-top: 20px; font-size: 12px; }
#mo-docs-chat-root .mo-chat-sources strong { font-weight: 500; color: var(--chat-muted); }
#mo-docs-chat-root .mo-chat-sources a { text-decoration: none; }
#mo-docs-chat-root .mo-chat-wait { font-weight: 500; }
#mo-docs-chat-root .mo-chat-wait-note { color: var(--chat-muted); font-size: 12px; }
#mo-docs-chat-root .mo-chat-composer { padding: 12px 16px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--chat-border); }
#mo-docs-chat-root .mo-chat-composer form { padding: 10px; border: 1px solid var(--chat-border); border-radius: 10px; background: var(--chat-bg); margin: 0; }
#mo-docs-chat-root textarea { display: block; width: 100%; resize: none; background: transparent; color: var(--chat-fg); border: 0; padding: 0; min-height: 48px; font-size: 13px; }
#mo-docs-chat-root textarea::placeholder { color: var(--chat-muted); opacity: 1; }
#mo-docs-chat-root .mo-chat-compose-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
#mo-docs-chat-root .mo-chat-compose-bottom > span { color: var(--chat-muted); font-size: 10px; }
#mo-docs-chat-root .mo-chat-send { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 6px; background: var(--chat-fg); color: var(--chat-bg); padding: 7px 10px; font-size: 12px; }
#mo-docs-chat-root .mo-chat-disclaimer { color: var(--chat-muted); text-align: center; font-size: 11px; margin: 9px 0 0; }
#mo-docs-chat-root .mo-chat-notice { font-size: 12px; color: var(--chat-muted); margin: 0 0 10px; }
@media (min-width: 1280px) {
  html.mo-docs-chat-open .main { margin-right: 400px; }
  html.mo-docs-chat-open .toc-drawer { display: none; }
  html.mo-docs-chat-open .content { width: 100%; max-width: 100%; }
}
@media (max-width: 700px) {
  #mo-docs-chat-root .mo-chat-panel { width: 100%; top: 0; height: 100dvh; bottom: auto; z-index: 1100; border: 0; }
  #mo-docs-chat-root .mo-chat-launcher { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  #mo-docs-chat-root textarea { font-size: 16px; }
  #mo-docs-chat-root .mo-chat-header { padding-top: max(18px, env(safe-area-inset-top)); }
  html.mo-docs-chat-open, html.mo-docs-chat-open body { overflow: hidden; }
}
@media (pointer: coarse) { #mo-docs-chat-root button { min-height: 44px; } }
