/* Standalone scoped component: respects the shared light/dark brand tokens. */
#site-assistant { font: 16px/1.5 var(--font-body, system-ui, sans-serif); color: var(--text); }
#site-assistant [hidden] { display: none !important; }
#site-assistant button, #site-assistant textarea, #site-assistant a { font: inherit; }
#site-assistant button { cursor: pointer; }
#site-assistant :is(button, a, textarea):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#site-assistant .sa-help-launch {
  position: fixed; right: 22px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 900;
  display: flex; gap: 10px; align-items: center; padding: 12px 18px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--ds-surface-solid, var(--bg)); color: var(--text); box-shadow: 0 6px 24px #0002;
  font-weight: 700; min-height: 48px;
}
#site-assistant .sa-help-launch span { color: var(--accent); font-size: 24px; line-height: 1; }
#site-assistant .sa-help-launch:hover { border-color: var(--accent); }
#site-assistant .sa-help-dialog {
  padding: 0; margin: auto 20px 20px auto; width: min(460px, calc(100vw - 32px));
  max-width: none; max-height: calc(100dvh - 32px); border: 1px solid var(--border);
  border-radius: 20px; background: var(--ds-surface-solid, var(--bg)); color: var(--text);
  box-shadow: 0 18px 70px #0004; overflow: hidden;
}
#site-assistant .sa-help-dialog:not([open]) { display: none; }
#site-assistant .sa-help-dialog::backdrop { background: #0005; }
#site-assistant .sa-help-shell { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
#site-assistant .sa-help-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
#site-assistant .sa-help-eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .09em; }
#site-assistant #sa-help-title { color: var(--text); font-size: 21px; line-height: 1.3; margin: 3px 0 0; }
#site-assistant .sa-help-close { flex: 0 0 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); color: var(--text); font-size: 26px; }
#site-assistant .sa-help-scroll { padding: 16px 20px; overflow-y: auto; overscroll-behavior: contain; min-height: 80px; max-height: 360px; }
#site-assistant #sa-help-intro { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
#site-assistant .sa-help-suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
#site-assistant .sa-help-suggestions button { text-align: left; border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; background: var(--surface2); color: var(--text); font-size: 14px; min-height: 40px; }
#site-assistant .sa-help-suggestions button:hover { border-color: var(--accent); }
#site-assistant .sa-help-message { margin: 16px 0 0; padding: 13px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; overflow-wrap: anywhere; }
#site-assistant .sa-help-message[data-role="user"] { border-left: 3px solid var(--accent); }
#site-assistant .sa-help-message strong { display: block; font-size: 13px; margin-bottom: 7px; color: var(--muted); }
#site-assistant .sa-help-message p { margin: 0; white-space: pre-wrap; color: var(--text); }
#site-assistant .sa-help-sources { margin: 12px 0 0; padding-left: 20px; }
#site-assistant .sa-help-sources a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
#site-assistant .sa-help-sources li + li { margin-top: 8px; }
#site-assistant .sa-help-form { border-top: 1px solid var(--border); margin: 0; padding: 14px 20px 18px; overflow-y: auto; flex-shrink: 0; }
#site-assistant .sa-help-form label { display: block; font: 600 16px/1.5 system-ui, sans-serif !important; letter-spacing: normal !important; text-transform: none !important; color: var(--text) !important; margin-bottom: 6px; }
#site-assistant #sa-help-question { width: 100%; box-sizing: border-box; resize: vertical; min-height: 76px; max-height: 160px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface2); color: var(--text); font-size: 16px; line-height: 1.45; }
#site-assistant .sa-help-form-meta, #site-assistant .sa-help-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
#site-assistant .sa-help-form-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
#site-assistant .sa-help-clear { padding: 3px 0; background: none; border: none; color: var(--muted); text-decoration: underline; font-size: 13px; }
#site-assistant .sa-help-privacy { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 8px 0 12px; }
#site-assistant .sa-help-actions a { color: var(--muted); font-size: 13px; text-decoration: underline; }
#site-assistant .sa-help-send { border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: #151515; font-weight: 700; padding: 10px 18px; min-height: 44px; }
#site-assistant .sa-help-send:hover { border-color: var(--text); }
#site-assistant .sa-help-send:disabled { opacity: .6; cursor: wait; }
#site-assistant .sa-help-status { color: var(--muted); font-size: 14px; margin: 0; }
#site-assistant .sa-help-status:not(:empty) { margin-bottom: 8px; }
.sa-help-mobile-launch { display: none; }
@media (max-width: 520px) {
  #site-assistant .sa-help-launch { display: none; }
  .has-site-assistant .nav-right > #themeToggle { display: none; }
  .has-site-assistant .sa-help-mobile-launch { display: inline-flex; align-items: center; justify-content: center; color: var(--accent); font-size: 24px; }
  #site-assistant .sa-help-dialog { margin: auto; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 16px; }
  #site-assistant .sa-help-shell { max-height: calc(100dvh - 22px); }
  #site-assistant .sa-help-header { padding: 12px 16px; }
  #site-assistant .sa-help-scroll { padding: 12px 16px; }
  #site-assistant .sa-help-form { padding: 12px 16px; }
}
@media (max-height: 480px) {
  #site-assistant .sa-help-shell { display: block; overflow-y: auto; }
  #site-assistant .sa-help-header { position: sticky; top: 0; z-index: 1; background: var(--ds-surface-solid, var(--bg)); }
  #site-assistant .sa-help-scroll { max-height: 140px; }
}
