/* Ars Nova Assistant chat widget. Scoped to #ana-chat; light and dark. */
#ana-chat {
	--ana-bg: #ffffff;
	--ana-fg: #1d1d1f;
	--ana-muted: #5f6368;
	--ana-line: #d9dce1;
	--ana-me: #e9eef6;
	--ana-bot: #f4f5f7;
	--ana-accent: #2b2d6e;
	--ana-accent-fg: #ffffff;
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 99999;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--ana-fg);
}
@media (prefers-color-scheme: dark) {
	#ana-chat {
		--ana-bg: #1c1d22;
		--ana-fg: #ececf1;
		--ana-muted: #a3a7b0;
		--ana-line: #34363e;
		--ana-me: #2c3350;
		--ana-bot: #26282f;
		--ana-accent: #8f93ff;
		--ana-accent-fg: #111217;
	}
}
#ana-chat * { box-sizing: border-box; }
#ana-chat .ana-chat__toggle {
	display: block;
	margin-left: auto;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--ana-accent);
	color: var(--ana-accent-fg);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
#ana-chat.is-open .ana-chat__toggle { display: none; }
#ana-chat .ana-chat__panel {
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 32px));
	height: min(560px, calc(100vh - 32px));
	background: var(--ana-bg);
	border: 1px solid var(--ana-line);
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
	overflow: hidden;
}
#ana-chat .ana-chat__panel[hidden] { display: none; }
#ana-chat .ana-chat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid var(--ana-line);
}
#ana-chat .ana-chat__title { font-weight: 600; }
#ana-chat .ana-chat__close {
	border: 0;
	background: none;
	color: var(--ana-muted);
	font: inherit;
	cursor: pointer;
	padding: 4px 6px;
}
#ana-chat .ana-chat__log {
	flex: 1;
	overflow-y: auto;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
#ana-chat .ana-chat__msg {
	max-width: 88%;
	padding: 8px 12px;
	border-radius: 12px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
#ana-chat .ana-chat__msg--me { align-self: flex-end; background: var(--ana-me); }
#ana-chat .ana-chat__msg--bot { align-self: flex-start; background: var(--ana-bot); }
#ana-chat .ana-chat__msg.is-waiting { color: var(--ana-muted); font-style: italic; }
#ana-chat .ana-chat__msg a { color: var(--ana-accent); text-decoration: underline; }
#ana-chat .ana-chat__form {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--ana-line);
}
#ana-chat .ana-chat__input {
	flex: 1;
	resize: none;
	padding: 8px 10px;
	border: 1px solid var(--ana-line);
	border-radius: 10px;
	background: var(--ana-bg);
	color: var(--ana-fg);
	font: inherit;
}
#ana-chat .ana-chat__send {
	padding: 0 16px;
	border: 0;
	border-radius: 10px;
	background: var(--ana-accent);
	color: var(--ana-accent-fg);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
#ana-chat .ana-chat__send:disabled { opacity: .5; cursor: default; }
#ana-chat .ana-chat__foot {
	margin: 0;
	padding: 0 12px 10px;
	font-size: 12px;
	color: var(--ana-muted);
}
