/*
 * Chat widget. Ink launcher, paper panel with an ink header, one lime accent.
 * Motion: transform/opacity only. base.css has a global reduced-motion
 * kill-switch; the overrides at the bottom fix the few wrong end-states.
 */

.adbull-chat {
	--chat-edge: 24px;
	--chat-pop: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
 * Launcher.
 * ----------------------------------------------------------------------- */

/* A round icon button, like the reference messengers: the bubble turns into
   a chevron while the chat is open. The name lives in aria-label. */
.adbull-chat__launch {
	visibility: visible;
	position: fixed;
	z-index: 160;
	right: var(--chat-edge);
	bottom: calc(var(--chat-edge) + env(safe-area-inset-bottom) + var(--adbull-chat-lift, 0px));
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 50%;
	background: var(--ink);
	/* White robot in a speech bubble: it says chat and AI at once, and lime stays on the calls to action. */
	color: #fff;
	cursor: pointer;
	box-shadow: var(--shadow-lg);
	transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.adbull-chat__launch:hover {
	background: var(--ink-2);
	transform: scale(1.06);
}

.adbull-chat__launch:active {
	transform: scale(0.96);
}

/* The icon and the chevron swap places when the chat opens. */
.adbull-chat__bubble,
.adbull-chat__chevron {
	grid-area: 1 / 1;
	transition: transform 260ms var(--chat-pop), opacity 200ms var(--ease);
}

.adbull-chat__chevron {
	color: var(--paper);
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}

.adbull-chat.is-open .adbull-chat__bubble {
	opacity: 0;
	transform: rotate(90deg) scale(0.6);
}

.adbull-chat.is-open .adbull-chat__chevron {
	opacity: 1;
	transform: none;
}

/* One gentle hop if the chat was never opened. JS adds .do-nudge once per session. */
.adbull-chat__launch.do-nudge {
	animation: adbull-chat-nudge 1100ms var(--ease) 1;
}

.adbull-chat__launch.do-nudge .adbull-chat__bubble {
	animation: adbull-chat-nudge-icon 1100ms var(--ease) 1;
}

@keyframes adbull-chat-nudge {
	0% { transform: none; }
	35% { transform: translateY(-5px); }
	55% { transform: none; }
	70% { transform: translateY(-2px); }
	100% { transform: none; }
}

@keyframes adbull-chat-nudge-icon {
	0% { transform: none; }
	35% { transform: scale(1.12); }
	100% { transform: none; }
}

/* --------------------------------------------------------------------------
 * Panel. Desktop: floating card that springs out of the launcher corner.
 * ----------------------------------------------------------------------- */

.adbull-chat__panel {
	position: fixed;
	z-index: 170;
	right: var(--chat-edge);
	bottom: calc(var(--chat-edge) + 56px + 16px + env(safe-area-inset-bottom) + var(--adbull-chat-lift, 0px));
	display: flex;
	flex-direction: column;
	width: min(400px, calc(100vw - 48px));
	height: min(680px, calc(100dvh - 120px));
	overflow: hidden;
	background: var(--surface-2);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: 0 22px 50px -28px rgba(25, 28, 25, 0.55);
	transform-origin: 100% 100%;
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), width 320ms var(--chat-pop), height 320ms var(--chat-pop);
}

/* Expanded: a larger reading surface, anchored to the same corner. */
.adbull-chat.is-expanded .adbull-chat__panel {
	width: min(720px, calc(100vw - 48px));
	height: calc(100dvh - 120px);
}

.adbull-chat__panel.is-open {
	opacity: 1;
	transform: none;
	animation: adbull-chat-pop 420ms var(--chat-pop);
}

.adbull-chat__panel[hidden] {
	display: none;
}

@keyframes adbull-chat-pop {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* The interior rises in after the panel, like the staggered nav items. */
.adbull-chat__panel.is-open .adbull-chat__id {
	animation: adbull-chat-rise 320ms var(--ease) 40ms backwards;
}

.adbull-chat__panel.is-open [data-chat-welcome].adbull-chat__msg {
	animation: adbull-chat-rise 320ms var(--ease) 90ms backwards;
}

.adbull-chat__panel.is-open [data-chat-welcome] .adbull-chat__chips {
	animation: adbull-chat-rise 320ms var(--ease) 140ms backwards;
}

@keyframes adbull-chat-rise {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* --------------------------------------------------------------------------
 * Header. Dark ink, so the panel grows out of the ink launcher.
 * ----------------------------------------------------------------------- */

.adbull-chat__head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
	padding: 10px 8px 10px 16px;
	border-bottom: 1px solid var(--ink-line);
	background: var(--ink);
	color: var(--ink-text);
}

.adbull-chat__id {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
	flex: 1;
	gap: 4px;
}

.adbull-chat__brand {
	margin: 0;
	color: var(--ink-text);
	font-size: 19px;
	line-height: 1;
}

.adbull-chat__brand:focus {
	outline: none;
}

.adbull-chat__mark {
	display: flex;
}

.adbull-chat__wordmark {
	display: block;
	width: auto;
	height: 0.84em;
	overflow: visible;
	fill: var(--ink-text);
}

.adbull-chat__wordmark path {
	fill: var(--ink-text);
}

.adbull-chat__sub {
	margin: 0;
	color: var(--ink-muted);
	font-size: 12px;
	line-height: 1.3;
}

.adbull-chat__clear,
.adbull-chat__close,
.adbull-chat__send,
.adbull-chat__chips button,
.adbull-chat__jump,
.adbull-chat__error button,
.adbull-chat__error a {
	font-family: var(--font);
}

.adbull-chat__clear {
	flex: none;
	min-height: 44px;
	padding: 0 8px;
	border: 0;
	background: transparent;
	color: var(--ink-muted);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.adbull-chat__clear:hover {
	color: var(--ink-text);
}

.adbull-chat__close,
.adbull-chat__send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: var(--radius-sm);
	cursor: pointer;
}

.adbull-chat__close {
	border: 0;
	background: transparent;
	color: var(--ink-text);
}

.adbull-chat__close:hover {
	background: var(--ink-2);
}

/* Header tools: sound and expand, quieter than the close button. */
.adbull-chat__tool {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--ink-muted);
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.adbull-chat__tool:hover {
	background: var(--ink-2);
	color: var(--ink-text);
}

.adbull-chat__tool svg {
	grid-area: 1 / 1;
}

.adbull-chat__sound-off,
.adbull-chat__sound[aria-pressed="false"] .adbull-chat__sound-on,
.adbull-chat__expand-shrink,
.adbull-chat__expand[aria-pressed="true"] .adbull-chat__expand-grow {
	visibility: hidden;
}

.adbull-chat__sound[aria-pressed="false"] .adbull-chat__sound-off,
.adbull-chat__expand[aria-pressed="true"] .adbull-chat__expand-shrink {
	visibility: visible;
}

/* --------------------------------------------------------------------------
 * Log and bubbles.
 * ----------------------------------------------------------------------- */

.adbull-chat__log {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	padding: 18px 18px 10px;
	scrollbar-width: thin;
	scrollbar-color: var(--line-strong) transparent;
}

.adbull-chat__log::-webkit-scrollbar {
	width: 8px;
}

.adbull-chat__log::-webkit-scrollbar-thumb {
	background: var(--line-strong);
	border-radius: 4px;
}

.adbull-chat__log::-webkit-scrollbar-track {
	background: transparent;
}

.adbull-chat__thread {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* The message is a layout wrapper; the bubble inside carries the surface.
   Meta line, chips and the lead form sit under the bubble. */
.adbull-chat__msg {
	max-width: 85%;
	animation: adbull-chat-rise 240ms var(--ease) backwards;
}

.adbull-chat__text {
	padding: 13px 16px;
	border-radius: 16px;
	font-size: 15px;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.adbull-chat__text p {
	margin: 0;
}

.adbull-chat__text p + p,
.adbull-chat__text p + ul,
.adbull-chat__text p + ol,
.adbull-chat__text ul + p,
.adbull-chat__text ol + p {
	margin-top: 0.6em;
}

.adbull-chat__text ul,
.adbull-chat__text ol {
	margin: 0.5em 0 0;
	padding-inline-start: 1.2em;
}

.adbull-chat__text li + li {
	margin-top: 0.35em;
}

.adbull-chat__text a {
	color: inherit;
	font-weight: 650;
	text-underline-offset: 3px;
}

/* Flat surfaces, one tight corner pointing at the sender. */
.adbull-chat__msg--bot {
	align-self: flex-start;
}

.adbull-chat__msg--bot .adbull-chat__text {
	background: var(--surface);
	color: var(--ink);
	border-end-start-radius: 6px;
}

.adbull-chat__msg--user {
	align-self: flex-end;
}

.adbull-chat__msg--user .adbull-chat__text {
	white-space: pre-wrap;
	background: var(--ink);
	color: var(--paper);
	border-end-end-radius: 6px;
}

/* The AI disclosure under the newest answer, like "Fin · AI Agent". */
.adbull-chat__meta {
	margin: 6px 0 0 6px;
	font-size: 12px;
	line-height: 1.3;
	color: var(--text-faint);
}

/* Streaming words fade in and fill out from a soft blur. JS keeps each
   word's animation running across re-renders with a negative delay. */
.adbull-chat__w {
	animation: adbull-chat-word 460ms var(--ease) both;
}

@keyframes adbull-chat-word {
	from {
		opacity: 0;
		filter: blur(3px);
	}
	to {
		opacity: 1;
		filter: none;
	}
}

/* --------------------------------------------------------------------------
 * Quick replies. Pills, because chips are tags.
 * ----------------------------------------------------------------------- */

.adbull-chat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.adbull-chat__chips[hidden],
.adbull-chat__jump[hidden] {
	display: none;
}

.adbull-chat__chips button {
	min-height: 44px;
	padding: 8px 16px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-pill);
	background: var(--surface-2);
	color: var(--ink);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.adbull-chat__chips button:hover {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--paper);
}

.adbull-chat__chips--follow {
	margin-top: 10px;
}

/* --------------------------------------------------------------------------
 * Lead form, following the site's .field conventions.
 * ----------------------------------------------------------------------- */

.adbull-chat__msg--lead {
	max-width: 100%;
}

.adbull-chat__lead {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
}

.adbull-chat__lead label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: var(--ink);
	font-size: 13px;
	font-weight: 650;
}

.adbull-chat__lead input:not(.adbull-chat__hp),
.adbull-chat__lead textarea {
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 8px 12px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	font-weight: 450;
	line-height: 1.4;
	transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.adbull-chat__lead textarea {
	min-height: 84px;
	resize: vertical;
}

/* A quiet ink edge while typing, instead of the site's green focus ring
   and lime glow. */
.adbull-chat__lead input:not(.adbull-chat__hp):focus,
.adbull-chat__lead input:not(.adbull-chat__hp):focus-visible,
.adbull-chat__lead textarea:focus,
.adbull-chat__lead textarea:focus-visible {
	border-color: var(--ink);
	box-shadow: none;
	outline: none;
}

.adbull-chat__lead input:not(.adbull-chat__hp)::placeholder,
.adbull-chat__lead textarea::placeholder {
	color: #4e5348;
	opacity: 1;
}

.adbull-chat__optional {
	color: var(--text-muted);
	font-weight: 450;
}

.adbull-chat__hp {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.adbull-chat__lead-error {
	margin: 8px 0 0;
	font-size: 14px;
	line-height: 1.45;
}

.adbull-chat__lead-error {
	color: var(--danger);
}

.adbull-chat__lead-error[hidden] {
	display: none;
}

/* Sent: a box of its own, so the confirmation is not read as chat text. */
.adbull-chat__sent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 12px 0 0;
	padding: 12px 14px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--ink);
	font-size: 14px;
	line-height: 1.45;
}

.adbull-chat__sent-mark {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 24px;
	height: 24px;
	margin-top: 1px;
	border-radius: 50%;
	background: var(--ink);
	color: var(--paper);
}

.adbull-chat__sent strong {
	display: block;
	font-weight: 600;
}

.adbull-chat__sent p {
	margin: 2px 0 0;
	color: var(--text-muted);
}

.adbull-chat__cta {
	display: flex;
	width: 100%;
	margin-top: 12px;
	white-space: normal;
	text-align: center;
}

/* --------------------------------------------------------------------------
 * Thinking indicator: three dots bouncing in a bot bubble. During a lookup
 * the bubble also says what it is reading, in small muted text.
 * ----------------------------------------------------------------------- */

.adbull-chat__pending {
	align-self: flex-start;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 85%;
	min-height: 44px;
	margin: 0;
	padding: 12px 16px;
	border-radius: 16px;
	border-end-start-radius: 6px;
	background: var(--surface);
	animation: adbull-chat-rise 240ms var(--ease) backwards;
}

.adbull-chat__dots {
	display: flex;
	align-items: center;
	gap: 5px;
	flex: none;
	height: 10px;
}

.adbull-chat__dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ink);
	opacity: 0.3;
	animation: adbull-chat-dot 1.2s var(--chat-pop) infinite;
}

.adbull-chat__dots span:nth-child(2) {
	animation-delay: 0.15s;
}

.adbull-chat__dots span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes adbull-chat-dot {
	0%,
	60%,
	100% {
		transform: none;
		opacity: 0.3;
	}
	30% {
		transform: translateY(-4px);
		opacity: 0.9;
	}
}

/* Empty while thinking; "Søger på adbull.dk" / "Læser …" during a lookup. */
.adbull-chat__status {
	min-width: 0;
	overflow: hidden;
	color: var(--text-muted);
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.adbull-chat__status:empty {
	display: none;
}

/* --------------------------------------------------------------------------
 * Error box and jump button.
 * ----------------------------------------------------------------------- */

.adbull-chat__error {
	align-self: stretch;
	padding: 12px 14px;
	border: 1px solid var(--danger-line);
	border-radius: var(--radius);
	background: var(--danger-bg);
	color: var(--ink);
	font-size: 15px;
	line-height: 1.45;
	animation: adbull-chat-rise 240ms var(--ease) backwards;
}

.adbull-chat__error p {
	margin: 0 0 10px;
}

.adbull-chat__error .adbull-chat__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.adbull-chat__error button,
.adbull-chat__error a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid var(--ink);
	border-radius: var(--radius-sm);
	background: var(--paper);
	color: var(--ink);
	font-size: 14px;
	font-weight: 650;
	text-decoration: none;
	cursor: pointer;
}

.adbull-chat__error button {
	background: var(--ink);
	color: var(--paper);
}

.adbull-chat__jump {
	align-self: center;
	margin: 0 0 8px;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid var(--ink);
	border-radius: var(--radius-pill);
	background: var(--ink);
	color: var(--paper);
	font-size: 14px;
	font-weight: 650;
	cursor: pointer;
	box-shadow: var(--shadow-lg);
}

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

/* The composer, like the reference messenger: the text on top, a tool row
   underneath with attach and microphone on the left and send on the right.
   The send button sits 8px from the right and bottom edges. */
.adbull-chat__form {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: none;
	margin: 10px 12px 8px;
	padding: 10px 8px 8px 14px;
	border: 1px solid var(--line-strong);
	border-radius: 18px;
	background: transparent;
	transition: border-color var(--dur-fast) var(--ease);
}

.adbull-chat__form:focus-within {
	border-color: var(--ink);
}

.adbull-chat__input {
	width: 100%;
	min-height: 28px;
	max-height: 120px;
	margin: 0;
	padding: 2px 6px 2px 0;
	border: 0;
	resize: none;
	overflow: auto;
	background: transparent;
	color: var(--ink);
	caret-color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
}

.adbull-chat__input::placeholder {
	color: #4e5348;
	opacity: 1;
}

.adbull-chat__input:focus,
.adbull-chat__input:focus-visible {
	outline: none;
	box-shadow: none;
}

.adbull-chat__bar {
	display: flex;
	align-items: center;
	gap: 2px;
	margin-left: -6px;
}

.adbull-chat__icon {
	position: relative;
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.adbull-chat__icon:hover {
	background: var(--surface);
	color: var(--ink);
}

.adbull-chat__icon:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 1px;
}

.adbull-chat__icon[hidden] {
	display: none;
}

/* Recording, like the reference messenger: the composer turns into a pill
   with cancel on the left, the live waveform in the middle and stop on the
   right. The text lands in the field when the visitor stops. */
.adbull-chat__form.is-recording {
	padding: 6px;
	border-color: var(--ink);
	border-radius: 24px;
}

.adbull-chat__form.is-recording > :not(.adbull-chat__rec) {
	display: none;
}

.adbull-chat__rec {
	display: flex;
	align-items: center;
	gap: 10px;
	animation: adbull-chat-rec-in 220ms var(--ease) both;
}

.adbull-chat__rec[hidden] {
	display: none;
}

@keyframes adbull-chat-rec-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.adbull-chat__rec-cancel,
.adbull-chat__rec-stop {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}

.adbull-chat__rec-cancel {
	background: var(--surface);
	color: var(--ink);
}

.adbull-chat__rec-cancel:hover {
	background: var(--line);
}

.adbull-chat__rec-stop {
	background: var(--ink);
}

.adbull-chat__rec-stop:hover {
	background: var(--accent-hover);
}

.adbull-chat__rec-stop span {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	background: var(--paper);
}

.adbull-chat__rec-cancel:focus-visible,
.adbull-chat__rec-stop:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 2px;
}

.adbull-chat__wave {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	height: 32px;
	color: var(--ink);
	transition: opacity 200ms var(--ease);
}

/* Stopped: the browser is finishing the last words. */
.adbull-chat__form.is-finishing .adbull-chat__wave {
	opacity: 0.35;
}

.adbull-chat__form.is-finishing .adbull-chat__rec-stop {
	opacity: 0.45;
	pointer-events: none;
}

/* Off-screen but clickable from script, so the native picker opens. */
.adbull-chat__file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.adbull-chat__note {
	min-width: 0;
	margin-left: 6px;
	overflow: hidden;
	color: var(--text-muted);
	font-size: 12px;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.adbull-chat__note[hidden] {
	display: none;
}

.adbull-chat__send {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 32px;
	height: 32px;
	margin-left: auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--surface);
	color: var(--gray);
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.adbull-chat__form.has-text .adbull-chat__send {
	background: var(--ink);
	color: var(--paper);
	transform: scale(1.06);
}

.adbull-chat__form.has-text .adbull-chat__send:not(:disabled):hover {
	background: var(--accent-hover);
}

.adbull-chat__send:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 2px;
}

.adbull-chat__send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Attachments waiting to be sent, above the text. */
.adbull-chat__files {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-right: 6px;
}

.adbull-chat__files[hidden] {
	display: none;
}

.adbull-chat__file {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	padding: 4px 4px 4px 4px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--ink);
	font-size: 13px;
	line-height: 1.2;
	animation: adbull-chat-rise 200ms var(--ease) backwards;
}

.adbull-chat__file-thumb {
	display: grid;
	place-items: center;
	flex: none;
	width: 34px;
	height: 34px;
	overflow: hidden;
	border-radius: 6px;
	background: var(--surface-2);
	color: var(--text-muted);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.adbull-chat__file-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.adbull-chat__file-name {
	min-width: 0;
	max-width: 150px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.adbull-chat__file-remove {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
}

.adbull-chat__file-remove:hover {
	background: var(--surface-2);
	color: var(--ink);
}

/* Attachments shown in the visitor's own bubble. */
.adbull-chat__attached {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
	margin-bottom: 6px;
}

.adbull-chat__attached .adbull-chat__file {
	border-color: var(--line);
	background: var(--surface-2);
	animation: none;
}

/* While the panel has dropped files hovering over it. */
.adbull-chat__panel.is-dropping .adbull-chat__form {
	border-color: var(--ink);
	border-style: dashed;
}

.adbull-chat__privacy {
	flex: none;
	margin: 0;
	padding: 0 18px 10px;
	font-size: 12px;
	color: var(--text-faint);
	text-align: center;
}

/* Once the conversation has started, the privacy link steps aside. */
.adbull-chat.has-messages .adbull-chat__privacy {
	display: none;
}

.adbull-chat.has-messages .adbull-chat__form {
	margin-bottom: 12px;
}

.adbull-chat__privacy a {
	color: var(--text-muted);
	font-weight: 650;
	text-underline-offset: 3px;
}

.adbull-chat__live {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
 * Mobile: full-screen sheet that slides up, sized by visualViewport JS.
 * ----------------------------------------------------------------------- */

@media (max-width: 767px) {
	/* Hide chat while the mobile offcanvas nav is open. */
	html.is-nav-open .adbull-chat {
		visibility: hidden;
		pointer-events: none;
	}

	.adbull-chat__launch {
		right: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom) + var(--adbull-chat-lift, 0px));
		width: 52px;
		height: 52px;
	}

	.adbull-chat.is-open .adbull-chat__launch {
		display: none;
	}

	/* The sheet is already full screen. */
	.adbull-chat__expand {
		display: none;
	}

	.adbull-chat__panel {
		inset: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100dvh;
		max-height: none;
		border: 0;
		border-radius: 0;
		transform-origin: 50% 100%;
		transform: translateY(100%);
	}

	.adbull-chat__panel.is-open {
		transform: none;
		animation: adbull-chat-slide 380ms var(--chat-pop);
	}

	@keyframes adbull-chat-slide {
		from {
			opacity: 1;
			transform: translateY(100%);
		}
		to {
			opacity: 1;
			transform: none;
		}
	}

	.adbull-chat__head {
		padding-top: max(16px, env(safe-area-inset-top));
	}

	.adbull-chat__log {
		padding: 16px 16px 8px;
	}

	.adbull-chat__text {
		font-size: 16px;
	}

	.adbull-chat__privacy {
		padding: 0 16px max(10px, calc(6px + env(safe-area-inset-bottom)));
	}

	.adbull-chat__form {
		margin: 8px 10px 6px;
	}

	.adbull-chat.has-messages .adbull-chat__form {
		margin-bottom: max(10px, calc(6px + env(safe-area-inset-bottom)));
	}

	/* One compact row: text on the left, attach and send on the right.
	   Dictation is left to the keyboard's own microphone. */
	.adbull-chat__form {
		position: relative;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-end;
		gap: 4px;
		padding: 5px 5px 5px 14px;
		border-radius: 22px;
	}

	.adbull-chat__files {
		flex: 1 0 100%;
		margin: 4px 0 2px;
	}

	.adbull-chat__input {
		flex: 1 1 0;
		width: auto;
		min-width: 0;
		padding: 4px 0;
	}

	.adbull-chat__bar {
		flex: none;
		gap: 0;
		margin-left: 0;
	}

	.adbull-chat__mic {
		display: none;
	}

	/* No room in the row: notes float just above the composer. */
	.adbull-chat__note {
		position: absolute;
		bottom: calc(100% + 4px);
		left: 14px;
		right: 14px;
		margin: 0;
	}

	.adbull-chat__form.is-recording > .adbull-chat__rec {
		flex: 1 0 100%;
	}

	/* Behind the sheet: covers the page wherever the keyboard's floating
	   AutoFill/accessory bar leaves gaps below the visual viewport. */
	.adbull-chat.is-keyboard::before {
		content: "";
		position: fixed;
		z-index: 169;
		top: 0;
		left: 0;
		right: 0;
		bottom: -100vh;
		background: var(--surface-2);
	}

	/* Keyboard open: dock the composer to the keyboard, free vertical space. */
	.adbull-chat.is-keyboard .adbull-chat__privacy,
	.adbull-chat.is-keyboard .adbull-chat__chips,
	.adbull-chat.is-keyboard .adbull-chat__head {
		display: none;
	}

	.adbull-chat.is-keyboard .adbull-chat__log {
		padding-top: max(12px, env(safe-area-inset-top));
	}

	/* The sheet blends into the fill below it. */
	.adbull-chat.is-keyboard .adbull-chat__panel {
		box-shadow: none;
	}

	.adbull-chat.is-keyboard .adbull-chat__form {
		margin: 6px 10px 8px;
	}


	html.is-chat-open,
	html.is-chat-open body {
		overflow: hidden;
		height: 100%;
		overscroll-behavior: none;
	}
}

/* --------------------------------------------------------------------------
 * Reduced motion. base.css kills animation durations globally; these fix
 * the states where a 1ms animation would still land wrong.
 * ----------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.adbull-chat__launch,
	.adbull-chat__bubble,
	.adbull-chat__chevron,
	.adbull-chat__panel,
	.adbull-chat__msg,
	.adbull-chat__pending,
	.adbull-chat__error,
	.adbull-chat__w,
	.adbull-chat__dots span,
	.adbull-chat__rec {
		transition: none;
		animation: none;
	}

	/* Still dots, evenly visible. */
	.adbull-chat__dots span {
		opacity: 0.55;
	}

	.adbull-chat__launch:hover,
	.adbull-chat__launch:active {
		transform: none;
	}

	.adbull-chat__panel.is-open {
		opacity: 1;
		transform: none;
	}
}
