/* Assistant Bhallot — reprend les couleurs du thème (variables avec valeurs de secours). */
.ba {
	--ba-ink: var(--ink, #1d1d1b);
	--ba-soft: var(--ink-soft, #4f4b45);
	--ba-linen: var(--linen, #f3eee5);
	--ba-line: var(--line, #e4ddd0);
	--ba-ochre: var(--ochre-text, #7a5729);
	position: fixed; right: 20px; bottom: 20px; z-index: 9990;
	font-family: var(--sans, Roboto, Arial, sans-serif); font-size: 15px; line-height: 1.5; color: var(--ba-ink);
}
.ba button { font: inherit; cursor: pointer; }
.ba-launch {
	display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px;
	background: var(--ba-ink); color: #fff; border: 0; border-radius: 999px;
	box-shadow: 0 6px 20px rgba(0,0,0,.18); font-weight: 500; letter-spacing: .01em;
	transition: transform .15s ease, box-shadow .15s ease;
}
.ba-launch:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.24); }
.ba-launch:focus-visible, .ba button:focus-visible, .ba input:focus-visible, .ba textarea:focus-visible { outline: 2px solid var(--ochre, #c19a66); outline-offset: 2px; }
.ba[data-state="open"] .ba-launch { display: none; }

.ba-panel {
	position: absolute; right: 0; bottom: 0; width: 380px; max-width: calc(100vw - 40px);
	height: min(600px, calc(100vh - 40px)); height: min(600px, calc(100dvh - 40px));
	display: flex; flex-direction: column; background: #fff; border: 1px solid var(--ba-line);
	border-radius: 6px; box-shadow: 0 16px 48px rgba(0,0,0,.2); overflow: hidden;
}
.ba-panel[hidden] { display: none; }
.ba-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 18px; background: var(--ba-ink); color: #fff; }
.ba-title { flex: 1; margin: 0; font-family: var(--serif, Georgia, serif); font-size: 17px; font-weight: 400; color: #fff; }
.ba-back, .ba-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; background: none; border: 0; color: #fff; border-radius: 50%; }
.ba-back:hover, .ba-close:hover { background: rgba(255,255,255,.12); }
.ba-back[hidden] { display: none; }

.ba-view { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 18px; }
.ba-view[hidden] { display: none; }
.ba-intro { margin: 0 0 14px; font-family: var(--serif, Georgia, serif); font-size: 18px; }
.ba-choice {
	display: block; width: 100%; margin: 0 0 10px; padding: 16px 18px; text-align: left;
	background: var(--ba-linen); color: var(--ba-ink); border: 1px solid transparent; border-radius: 4px;
}
.ba-choice:hover { border-color: var(--ba-ink); }
.ba-choice strong { display: block; margin-bottom: 3px; font-size: 16px; font-weight: 600; }
.ba-choice span { display: block; font-size: 14px; color: var(--ba-soft); }
.ba-choice--ai { background: #fff; border-color: var(--ba-line); }

.ba-form label { display: block; margin: 0 0 12px; font-size: 14px; font-weight: 500; }
.ba-opt { font-weight: 400; color: var(--ba-soft); }
.ba-form input, .ba-form textarea, .ba-ask textarea {
	display: block; width: 100%; margin-top: 4px; padding: 10px 12px; box-sizing: border-box;
	font: inherit; font-size: 16px; color: var(--ba-ink); background: #fff;
	border: 1px solid var(--line-strong, #8f8778); border-radius: 3px; resize: vertical;
}
.ba-hp { position: absolute !important; left: -9999px !important; }
.ba-note { margin: 0 0 14px; padding: 10px 12px; background: var(--ba-linen); font-size: 14px; }
.ba-legal { margin: 10px 0 12px; font-size: 12.5px; color: var(--ba-soft); }
.ba-legal a { color: inherit; }
.ba-error { margin: 0 0 12px; color: #a3261b; font-size: 14px; }
.ba-error[hidden], .ba-note[hidden] { display: none; }
.ba-send { width: 100%; padding: 13px; background: var(--ba-ink); color: #fff; border: 0; border-radius: 3px; font-weight: 500; }
.ba-send:disabled { opacity: .6; cursor: wait; }
.ba-link { padding: 0; background: none; border: 0; color: var(--ba-ochre); text-decoration: underline; text-underline-offset: 2px; }
.ba-done-text { font-family: var(--serif, Georgia, serif); font-size: 17px; margin: 8px 0 18px; }

/* Assistant */
.ba-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ba-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.ba-msg { max-width: 88%; padding: 10px 13px; border-radius: 12px; font-size: 14.5px; overflow-wrap: anywhere; }
.ba-msg p { margin: 0 0 .6em; }
.ba-msg p:last-of-type { margin-bottom: 0; }
.ba-msg a { color: var(--ba-ochre); font-weight: 600; }
.ba-msg--bot { align-self: flex-start; background: var(--ba-linen); border-bottom-left-radius: 3px; }
.ba-msg--user { align-self: flex-end; background: var(--ba-ink); color: #fff; border-bottom-right-radius: 3px; white-space: pre-wrap; }
.ba-msg--wait { color: var(--ba-soft); animation: ba-pulse 1.2s ease-in-out infinite; }
@keyframes ba-pulse { 50% { opacity: .4; } }
.ba-chip { display: inline-block; margin-top: 8px; padding: 7px 12px; background: var(--ba-ink); color: #fff; border: 0; border-radius: 999px; font-size: 13.5px; }
.ba-ask { display: flex; align-items: flex-end; gap: 8px; padding: 10px 16px 0; border-top: 1px solid var(--ba-line); }
.ba-ask textarea { margin: 0; resize: none; min-height: 44px; max-height: 120px; }
.ba-ask-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: var(--ba-ink); color: #fff; border: 0; border-radius: 3px; }
.ba-chat .ba-legal { margin: 8px 16px 12px; }

@media (max-width: 600px) {
	.ba { right: 12px; bottom: 12px; }
	.ba-launch { padding: 11px 15px; }
	.ba[data-state="open"] { left: 0; right: 0; bottom: 0; }
	.ba-panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 88vh; height: 88dvh; border-radius: 10px 10px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
	.ba-launch, .ba-msg--wait { transition: none; animation: none; }
}
@media print { .ba { display: none; } }
