/* NexusDocs AI assistant widget.
 *
 * Self-contained styles for the launcher pill and the chat modal. The
 * visual language intentionally mirrors Zensical's built-in search
 * modal: same surface, border, radius, shadow, and tokens, so the two
 * read as a single design system. Vanilla JS, no framework.
 */

:root {
  --nx-z: 1000;
  --nx-z-modal: 1001;

  --nx-radius: 0.4rem;
  --nx-radius-sm: 0.3rem;

  --nx-bg: #ffffff;
  --nx-fg: #1f2328;
  --nx-fg-light: #5a6068;
  --nx-fg-lighter: #8b9098;
  --nx-fg-lightest: #e2e4e7;

  --nx-accent: #3b6cf6;
  --nx-accent-soft: rgba(59, 108, 246, 0.08);

  --nx-code-bg: #f3f4f6;

  --nx-shadow-z1: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.06),
    0 0.25rem 0.5rem rgba(0, 0, 0, 0.06);
  --nx-shadow-z2: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.07),
    0 0.5rem 1rem rgba(0, 0, 0, 0.08);
  --nx-shadow-z3: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.08),
    0 0.8rem 1.5rem rgba(0, 0, 0, 0.1), 0 2rem 3rem rgba(0, 0, 0, 0.08);

  --nx-backdrop: rgba(0, 0, 0, 0.32);
}

/* Dark scheme overrides. Zensical attaches data-md-color-scheme to
 * the <body>, not :root, so we re-define the palette here. Values
 * mirror the --md-* slate scheme. */
[data-md-color-scheme="slate"] {
  --nx-bg: hsla(225, 15%, 5%, 1);
  --nx-fg: hsla(225, 15%, 90%, 0.82);
  --nx-fg-light: hsla(225, 15%, 75%, 0.56);
  --nx-fg-lighter: hsla(225, 15%, 75%, 0.4);
  --nx-fg-lightest: hsla(225, 15%, 90%, 0.1);

  --nx-accent: #38bdf8;
  --nx-accent-soft: rgba(56, 189, 248, 0.12);

  --nx-code-bg: hsla(225, 15%, 90%, 0.05);

  --nx-shadow-z1: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.3),
    0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
  --nx-shadow-z2: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.35),
    0 0.5rem 1rem rgba(0, 0, 0, 0.4);
  --nx-shadow-z3: 0 0.05rem 0.2rem rgba(0, 0, 0, 0.4),
    0 0.8rem 1.5rem rgba(0, 0, 0, 0.45),
    0 2rem 3rem rgba(0, 0, 0, 0.45);

  --nx-backdrop: rgba(0, 0, 0, 0.6);
}

/* Launcher pill ------------------------------------------------------ */

.nexus-assistant-launcher {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.85rem, env(safe-area-inset-bottom));
  z-index: var(--nx-z);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.4rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  background: var(--nx-bg);
  color: var(--nx-fg);
  border: 1px solid var(--nx-fg-lightest);
  cursor: pointer;
  box-shadow: var(--nx-shadow-z1);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.nexus-assistant-launcher:hover {
  transform: translateY(-1px);
  border-color: var(--nx-fg-lighter);
  box-shadow: var(--nx-shadow-z2);
}

.nexus-assistant-launcher:active {
  transform: translateY(0);
}

.nexus-assistant-launcher:focus-visible {
  outline: none;
  box-shadow: var(--nx-shadow-z1), 0 0 0 2px var(--nx-accent);
}

.nexus-assistant-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--nx-accent);
  width: 1.05rem;
  height: 1.05rem;
}

.nexus-assistant-launcher-label {
  white-space: nowrap;
}

/* Modal overlay ------------------------------------------------------ */

.nexus-assistant-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--nx-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  background: var(--nx-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.nexus-assistant-overlay.nexus-assistant-open {
  opacity: 1;
  pointer-events: auto;
}

/* Modal panel -------------------------------------------------------- */

.nexus-assistant-modal {
  position: relative;
  width: min(780px, 100%);
  max-height: min(80vh, calc(100dvh - 2.5rem));
  background: var(--nx-bg);
  color: var(--nx-fg);
  border: 1px solid var(--nx-fg-lightest);
  border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow-z3);
  color-scheme: light;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition:
    transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 160ms ease;
  font-family: var(--md-text-font, system-ui, sans-serif);
  font-size: 0.9rem;
  line-height: 1.55;
}

[data-md-color-scheme="slate"] .nexus-assistant-modal {
  color-scheme: dark;
}

.nexus-assistant-overlay.nexus-assistant-open .nexus-assistant-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Header ------------------------------------------------------------- */

.nexus-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--nx-fg-lightest);
  background: var(--nx-bg);
}

.nexus-assistant-header-text {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.nexus-assistant-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--nx-radius-sm);
  background: var(--nx-accent-soft);
  color: var(--nx-accent);
  flex: 0 0 auto;
}

.nexus-assistant-header-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.nexus-assistant-header-titles strong {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--nx-fg);
  text-wrap: balance;
  letter-spacing: -0.005em;
}

.nexus-assistant-header-titles small {
  color: var(--nx-fg-light);
  font-size: 0.74rem;
  margin-top: 2px;
  max-width: 24rem;
  text-wrap: pretty;
}

.nexus-assistant-close {
  background: transparent;
  border: 0;
  color: var(--nx-fg-light);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--nx-radius-sm);
  display: inline-flex;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.nexus-assistant-close:hover {
  background: var(--nx-code-bg);
  color: var(--nx-fg);
}

.nexus-assistant-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--nx-accent);
}

/* Messages ----------------------------------------------------------- */

.nexus-assistant-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1.1rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--nx-fg-lightest) transparent;
}

.nexus-assistant-messages::-webkit-scrollbar {
  width: 8px;
}

.nexus-assistant-messages::-webkit-scrollbar-thumb {
  background: var(--nx-fg-lightest);
  border-radius: 8px;
}

.nexus-assistant-messages::-webkit-scrollbar-thumb:hover {
  background: var(--nx-fg-lighter);
}

.nexus-assistant-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* Empty state -------------------------------------------------------- */

.nexus-assistant-empty {
  margin: auto 0;
  padding: 0.5rem 0.25rem 1rem;
  color: var(--nx-fg-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.nexus-assistant-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--nx-accent-soft);
  color: var(--nx-accent);
}

.nexus-assistant-empty p {
  margin: 0;
  font-size: 0.92rem;
  max-width: 28rem;
  color: var(--nx-fg);
  text-wrap: balance;
}

.nexus-assistant-empty-sub {
  font-size: 0.82rem !important;
  color: var(--nx-fg-light) !important;
  margin-top: -0.4rem !important;
  text-wrap: pretty;
}

.nexus-assistant-suggestions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: 0.6rem;
  width: 100%;
  max-width: 32rem;
}

.nexus-assistant-suggestions-label {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--nx-fg-light);
  text-align: left;
  padding: 0 0.25rem 0.1rem;
}

.nexus-assistant-suggestion {
  background: var(--nx-code-bg);
  color: var(--nx-fg);
  border: 1px solid var(--nx-fg-lightest);
  border-radius: var(--nx-radius-sm);
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.nexus-assistant-suggestion:hover {
  border-color: var(--nx-fg-lighter);
  color: var(--nx-accent);
}

.nexus-assistant-suggestion:focus-visible {
  outline: none;
  border-color: var(--nx-accent);
  box-shadow: 0 0 0 2px var(--nx-accent-soft);
}

.nexus-assistant-suggestion-suggestion-icon {
  color: var(--nx-fg-lighter);
  flex: 0 0 auto;
}

/* Message bubbles ---------------------------------------------------- */

.nexus-assistant-msg {
  display: flex;
  animation: nx-msg-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nx-msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nexus-assistant-msg-user {
  justify-content: flex-end;
}

.nexus-assistant-msg-assistant {
  justify-content: flex-start;
}

.nexus-assistant-bubble {
  max-width: 92%;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.nexus-assistant-msg-user .nexus-assistant-bubble {
  padding: 0.5rem 0.8rem;
  border-radius: 0.6rem 0.6rem 0.15rem 0.6rem;
  background: var(--nx-accent-soft);
  color: var(--nx-fg);
  border: 1px solid var(--nx-fg-lightest);
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble {
  padding: 0.1rem 0;
  background: transparent;
  border: 0;
  color: var(--nx-fg);
  max-width: 100%;
  line-height: 1.6;
}

/* Rendered markdown --------------------------------------------------- */

.nexus-assistant-msg-assistant .nexus-assistant-bubble > :first-child {
  margin-top: 0;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble > :last-child {
  margin-bottom: 0;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble p {
  margin: 0.55rem 0;
  text-wrap: pretty;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble h3,
.nexus-assistant-msg-assistant .nexus-assistant-bubble h4,
.nexus-assistant-msg-assistant .nexus-assistant-bubble h5,
.nexus-assistant-msg-assistant .nexus-assistant-bubble h6 {
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 1rem 0 0.4rem;
  text-wrap: balance;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble h3 {
  font-size: 1rem;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble h4 {
  font-size: 0.95rem;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble h5,
.nexus-assistant-msg-assistant .nexus-assistant-bubble h6 {
  font-size: 0.9rem;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble strong {
  font-weight: 600;
  color: var(--nx-fg);
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble em {
  font-style: italic;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble code {
  font-family: var(--md-code-font, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.86em;
  background: var(--nx-code-bg);
  border: 1px solid var(--nx-fg-lightest);
  border-radius: 0.25rem;
  padding: 0.05em 0.35em;
  color: var(--nx-accent);
  word-break: break-word;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble pre {
  margin: 0.7rem 0;
  padding: 0.7rem 0.85rem;
  background: var(--nx-code-bg);
  border: 1px solid var(--nx-fg-lightest);
  border-radius: var(--nx-radius-sm);
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: var(--nx-fg-lighter) transparent;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble pre code {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--nx-fg);
  white-space: pre;
  word-break: normal;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble ul,
.nexus-assistant-msg-assistant .nexus-assistant-bubble ol {
  margin: 0.55rem 0 0.55rem 0;
  padding-left: 1.5rem;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble li {
  margin-bottom: 0.25rem;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble li::marker {
  color: var(--nx-fg-lighter);
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble a {
  color: var(--nx-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease, color 140ms ease;
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble a:hover {
  border-bottom-color: var(--nx-accent);
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble a:focus-visible {
  outline: none;
  border-radius: 3px;
  box-shadow: 0 0 0 2px var(--nx-accent-soft);
}

.nexus-assistant-msg-assistant .nexus-assistant-bubble hr {
  border: 0;
  border-top: 1px solid var(--nx-fg-lightest);
  margin: 1rem 0;
}

/* Thinking indicator ------------------------------------------------- */

.nexus-assistant-thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0;
}

.nexus-assistant-thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nx-fg-lighter);
  animation: nx-thinking 1.2s ease-in-out infinite;
}

.nexus-assistant-thinking-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.nexus-assistant-thinking-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes nx-thinking {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Error state -------------------------------------------------------- */

.nexus-assistant-msg-error .nexus-assistant-bubble {
  padding: 0.55rem 0.8rem !important;
  border-radius: var(--nx-radius-sm) !important;
  border: 1px solid rgba(220, 38, 38, 0.4) !important;
  background: rgba(254, 226, 226, 0.5) !important;
  color: #991b1b !important;
}

[data-md-color-scheme="slate"] .nexus-assistant-msg-error .nexus-assistant-bubble {
  background: rgba(127, 29, 29, 0.25) !important;
  color: rgb(252, 165, 165) !important;
  border-color: rgba(252, 165, 165, 0.28) !important;
}

.nexus-assistant-retry {
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--nx-fg-lightest);
  color: var(--nx-fg-light);
  padding: 3px 10px;
  border-radius: var(--nx-radius-sm);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.nexus-assistant-retry:hover {
  background: var(--nx-code-bg);
  color: var(--nx-fg);
  border-color: var(--nx-fg-lighter);
}

.nexus-assistant-retry:focus-visible {
  outline: none;
  border-color: var(--nx-accent);
  box-shadow: 0 0 0 2px var(--nx-accent-soft);
}

/* Citations ---------------------------------------------------------- */

/* Inline citation markers [N] / 【N】 rendered as clickable
   superscripts next to the claim they support. The widget appends
   them on the fly during streaming (as muted placeholders) and
   re-resolves them to real links once the SSE `done` event delivers
   the citation list. */
.nexus-assistant-bubble sup.nexus-assistant-cite {
  font-size: 0.72em;
  line-height: 0;
  margin-left: 1px;
  font-weight: 600;
  vertical-align: super;
}

.nexus-assistant-bubble sup.nexus-assistant-cite a {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 999px;
  background: var(--nx-accent-soft);
  color: var(--nx-accent);
  text-decoration: none;
  text-align: center;
  transition: background-color 140ms ease, color 140ms ease;
}

.nexus-assistant-bubble sup.nexus-assistant-cite a:hover,
.nexus-assistant-bubble sup.nexus-assistant-cite a:focus-visible {
  background: var(--nx-accent);
  color: var(--nx-bg, #fff);
  outline: none;
}

/* Streaming placeholder: shown before the SSE `done` event arrives
   and the citation list is known. */
.nexus-assistant-bubble sup.nexus-assistant-cite-pending {
  color: var(--nx-fg-lighter);
  background: transparent;
  padding: 0 2px;
  border-radius: 3px;
}

.nexus-assistant-citations {
  margin-top: 0.25rem;
  padding: 0.6rem 0.85rem;
  background: var(--nx-code-bg);
  border: 1px solid var(--nx-fg-lightest);
  border-radius: var(--nx-radius-sm);
  font-size: 0.82rem;
  color: var(--nx-fg-light);
}

.nexus-assistant-citations strong {
  color: var(--nx-fg-light);
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nexus-assistant-citations ol {
  margin: 0;
  padding-left: 1.4rem;
}

.nexus-assistant-citations li {
  margin-bottom: 4px;
}

.nexus-assistant-citations a {
  color: var(--nx-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease, color 140ms ease;
}

.nexus-assistant-citations a:hover {
  border-bottom-color: var(--nx-accent);
}

.nexus-assistant-citations a:focus-visible {
  outline: none;
  border-radius: 3px;
  box-shadow: 0 0 0 2px var(--nx-accent-soft);
}

/* Composer ----------------------------------------------------------- */

.nexus-assistant-composer {
  padding: 0.6rem 0.95rem 0.75rem;
  border-top: 1px solid var(--nx-fg-lightest);
  background: var(--nx-bg);
}

.nexus-assistant-form {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.4rem 0.4rem 0.4rem 0.8rem;
  border: 1px solid var(--nx-fg-lightest);
  border-radius: var(--nx-radius);
  background: var(--nx-bg);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.nexus-assistant-form:focus-within {
  border-color: var(--nx-accent);
  box-shadow: 0 0 0 2px var(--nx-accent-soft);
}

.nexus-assistant-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  border: 0;
  padding: 0.3rem 0;
  background: transparent;
  color: var(--nx-fg);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 8rem;
  min-height: 1.5rem;
}

.nexus-assistant-input:focus {
  outline: none;
}

.nexus-assistant-input::placeholder {
  color: var(--nx-fg-lighter);
}

.nexus-assistant-send {
  flex: 0 0 auto;
  background: transparent;
  color: var(--nx-fg-lighter);
  border: 0;
  border-radius: var(--nx-radius-sm);
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.nexus-assistant-send:hover:not(:disabled) {
  color: var(--nx-accent);
  background: var(--nx-accent-soft);
}

.nexus-assistant-send:focus-visible {
  outline: none;
  color: var(--nx-accent);
  box-shadow: 0 0 0 2px var(--nx-accent-soft);
}

.nexus-assistant-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Body scroll lock --------------------------------------------------- */

body.nexus-assistant-scroll-lock {
  overflow: hidden;
}

/* Reduced motion ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .nexus-assistant-overlay,
  .nexus-assistant-modal,
  .nexus-assistant-launcher,
  .nexus-assistant-msg,
  .nexus-assistant-thinking-dot,
  .nexus-assistant-suggestion,
  .nexus-assistant-send {
    transition-duration: 0.001ms;
    animation-duration: 0.001ms;
    animation-iteration-count: 1;
  }
  .nexus-assistant-modal,
  .nexus-assistant-launcher {
    transform: none;
  }
}

/* Mobile ------------------------------------------------------------- */

@media (max-width: 540px) {
  .nexus-assistant-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }
  .nexus-assistant-modal {
    width: 100%;
    max-height: calc(100dvh - 1rem);
    border-radius: 0.75rem;
  }
  .nexus-assistant-launcher {
    right: max(0.9rem, env(safe-area-inset-right));
    bottom: max(1.6rem, env(safe-area-inset-bottom));
    height: 2.3rem;
    padding: 0 0.85rem;
    font-size: 0.8rem;
  }
}

/* Conversation history ------------------------------------------------
 *
 * Additions for the multi-turn panel: a header slot for the "start new
 * conversation" button, the button itself, and the stream-drop suffix
 * appended to a partial assistant message.
 */

.nexus-assistant-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
}

.nexus-assistant-clear {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 0;
  color: var(--nx-fg-light);
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  border-radius: var(--nx-radius-sm);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

.nexus-assistant-clear:hover {
  background: var(--nx-code-bg);
  color: var(--nx-fg);
}

.nexus-assistant-clear:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--nx-accent);
}

.nexus-assistant-clear[hidden] {
  display: none;
}

.nexus-assistant-truncated {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--nx-fg-lighter);
  font-style: italic;
}
