/* NDEVR QUAIL web assistant — chat side-panel styling. Theme-isolated; accent via --qa-accent.
 * Dark palette matches ndevr-product-manage.css.
 * Colors consume --nd-* tokens from /shared/css/theme.css, keeping the original dark literals as var() fallbacks. */
.ndevr-qa
{
	display: flex; flex-direction: column;
	flex: 1 1 auto; min-height: 0; width: 100%;
	overflow: hidden;            /* keep the feed's scroll inside the panel, never spilling out */
	color: var(--nd-text, #e8eaed);
}
.ndevr-qa-feed
{
	flex: 1 1 auto; min-height: 0; overflow-y: auto;   /* min-height:0 lets a long reply SCROLL, not grow the box */
	display: flex; flex-direction: column; gap: 0.5rem;
	padding: 0.8rem;
}
.ndevr-qa-msg
{
	padding: 0.5rem 0.7rem; border-radius: 12px;
	font-size: 0.9rem; line-height: 1.4;
	max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ndevr-qa-msg.is-you   { align-self: flex-end;   background: var(--qa-accent, var(--nd-accent-deep, #f2a900)); color: var(--nd-accent-contrast, #232323); }
.ndevr-qa-msg.is-quail { align-self: flex-start; background: var(--nd-surface-2, #23272f); color: var(--nd-text, #e8eaed); }
/* Rendered markdown inside a QUAIL bubble. */
.ndevr-qa-msg strong { font-weight: 700; }
.ndevr-qa-msg em     { font-style: italic; }
.ndevr-qa-msg a      { color: var(--qa-accent, var(--nd-accent-text, #ffb63b)); text-decoration: underline; }
.ndevr-qa-msg del    { opacity: .65; }
/* markdown headings (`#`..`######`) — inline spans on their own pre-wrap line, bold + scaled by level.
   The shared renderer (NDEVRWeb.renderMarkdown) emits the canonical `nchat-*` classes, same as chat. */
.ndevr-qa-msg .nchat-h  { font-weight: 700; line-height: 1.25; }
.ndevr-qa-msg .nchat-h1 { font-size: 1.3em; }
.ndevr-qa-msg .nchat-h2 { font-size: 1.16em; }
.ndevr-qa-msg .nchat-h3 { font-size: 1.06em; }
.ndevr-qa-msg .nchat-h4, .ndevr-qa-msg .nchat-h5, .ndevr-qa-msg .nchat-h6 { font-size: 1em; opacity: .85; }
.ndevr-qa-msg .nchat-quote { display: block; border-left: 3px solid var(--qa-accent, var(--nd-accent-text, #ffb63b)); padding: 1px 0 1px 10px; margin: 2px 0; color: var(--nd-muted, #9aa3b2); }
.ndevr-qa-msg .nchat-hr { display: block; height: 0; border-top: 1px solid var(--nd-border, #353b46); margin: 8px 0; }
.ndevr-qa-msg .nchat-mention { color: var(--qa-accent, var(--nd-accent-text, #ffb63b)); font-weight: 600; }
/* Fenced code blocks with a copy button (the API-docs assistant emits copy/paste snippets). */
.ndevr-qa-msg .ndevr-qa-code
{
	position: relative; margin: 0.5rem 0; padding: 0.6rem 0.7rem; padding-top: 1.7rem;
	background: #12151b; border: 1px solid #313845; border-radius: 8px;
	overflow-x: auto; white-space: pre; max-width: 100%;
}
.ndevr-qa-msg .ndevr-qa-code code
{
	background: none; padding: 0; border-radius: 0; font-size: 0.82rem; line-height: 1.45;
	font-family: var(--nd-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); color: #d6dbe4;
}
.ndevr-qa-msg .ndevr-qa-copy
{
	position: absolute; top: 0.3rem; right: 0.35rem;
	background: var(--nd-surface-2, #23272f); color: var(--nd-text-soft, #c7ccd6); border: 1px solid var(--nd-border, #353b46); border-radius: 6px;
	padding: 0.1rem 0.5rem; font-size: 0.72rem; cursor: pointer; line-height: 1.4;
}
.ndevr-qa-msg .ndevr-qa-copy:hover { background: var(--qa-accent, var(--nd-accent-deep, #f2a900)); color: var(--nd-accent-contrast, #232323); border-color: transparent; }
.ndevr-qa-msg code   { background: var(--nd-tint-2, rgba(255, 255, 255, 0.10)); padding: 0 0.25em; border-radius: 4px; font-size: 0.9em; }
/* Bubble entrance (ported from the OWL chat). */
.ndevr-qa-enter { animation: ndevr-qa-enter 0.2s ease-out; }
@keyframes ndevr-qa-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Animated "QUAIL is thinking" dots (ported from the OWL chat typing indicator). */
.ndevr-qa-typing { display: flex; align-items: center; gap: 7px; align-self: flex-start; padding: 0.2rem 0.4rem; color: var(--nd-muted, #9aa3b2); font-size: 0.85rem; font-style: italic; }
.ndevr-qa-typing-dots { display: inline-flex; gap: 3px; }
.ndevr-qa-typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--qa-accent, var(--nd-accent-deep, #f2a900)); display: inline-block; opacity: 0.35; animation: ndevr-qa-bounce 1.3s infinite ease-in-out; }
.ndevr-qa-typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.ndevr-qa-typing-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes ndevr-qa-bounce { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ndevr-qa-enter, .ndevr-qa-typing-dots i { animation: none; } }
.ndevr-qa-inputrow
{
	display: flex; gap: 0.4rem; padding: 0.6rem;
	border-top: 1px solid var(--nd-border, #353b46);
}
.ndevr-qa-input
{
	flex: 1 1 auto; resize: vertical; min-height: 2.2rem;
	background: var(--nd-field, #1b1e24); color: var(--nd-text, #e8eaed);
	border: 1px solid var(--nd-border, #353b46); border-radius: 8px;
	padding: 0.5rem; font: inherit;
}
.ndevr-qa-input:focus { outline: none; border-color: var(--qa-accent, var(--nd-accent-deep, #f2a900)); }
.ndevr-qa-send
{
	flex: 0 0 auto; align-self: flex-end;
	background: var(--qa-accent, var(--nd-accent-deep, #f2a900)); color: var(--nd-accent-contrast, #232323);
	border: none; border-radius: 8px; padding: 0.5rem 0.9rem;
	cursor: pointer; font: inherit; font-weight: 600;
}
.ndevr-qa-send:hover    { filter: brightness(1.08); }
.ndevr-qa-send:disabled { opacity: 0.55; cursor: default; }

/* --- image attachments (opt-in via allowAttachments) --------------------------------------- */
.ndevr-qa-attach
{
	flex: 0 0 auto; align-self: flex-end;
	display: inline-flex; align-items: center; gap: 0.35rem;
	background: var(--nd-surface-2, #23272f); color: var(--nd-text-soft, #c7ccd6);
	border: 1px solid var(--nd-border, #353b46); border-radius: 8px;
	padding: 0.45rem 0.6rem; cursor: pointer; font: inherit; line-height: 1.2;
}
.ndevr-qa-attach svg { display: block; }
.ndevr-qa-attach-label { font-size: 0.85rem; font-weight: 600; }
.ndevr-qa-attach:hover { border-color: var(--qa-accent, var(--nd-accent-deep, #f2a900)); color: var(--nd-text, #e8eaed); }
/* Pending-attachment thumbnail strip, just above the input row. */
.ndevr-qa-thumbs
{
	display: none; flex-wrap: wrap; gap: 0.4rem;
	padding: 0.4rem 0.6rem 0;
}
.ndevr-qa-thumb { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--nd-border, #353b46); }
.ndevr-qa-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ndevr-qa-thumb-x
{
	position: absolute; top: 1px; right: 1px; width: 18px; height: 18px; padding: 0; line-height: 16px;
	border: none; border-radius: 50%; cursor: pointer;
	background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 13px;
}
.ndevr-qa-thumb-x:hover { background: var(--nd-danger, #d9534f); }
/* Images carried inside a sent user bubble. */
.ndevr-qa-msg-text + .ndevr-qa-msg-imgs { margin-top: 0.4rem; }
.ndevr-qa-msg-imgs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ndevr-qa-msg-imgs img { max-width: 140px; max-height: 140px; border-radius: 8px; display: block; }
/* Drag-over affordance for the whole panel. */
.ndevr-qa.is-dropping { outline: 2px dashed var(--qa-accent, var(--nd-accent-deep, #f2a900)); outline-offset: -4px; }
