/* ==========================================================================
   AIDR Chatbot - front-end styles.

   Every rule is scoped `.aidr-chat.aidr-chat …` (0,3,0 and above). Astra and
   most themes style bare `textarea`, `input[type="text"]` and `button` with
   selectors like `input[type="text"]` (0,1,1); that out-ranked the single-class
   rules this widget started with, which turned the input white and full width,
   pushed the buttons onto a second row and forced uppercase onto the cards.
   Doubling the root class keeps the widget's own skin in any theme.
   ========================================================================== */

.aidr-chat.aidr-chat {
	/* Set inline per instance by the shortcode. */
	--aidr-accent: #10a37f;
	--aidr-radius: 16px;
	--aidr-height: 520px;
	--aidr-font: 14px;

	/* Dark palette. */
	--aidr-bg: #0b0d12;
	--aidr-surface: #13161d;
	--aidr-surface-2: #191d27;
	--aidr-raise: #232937;
	--aidr-line: rgba(255, 255, 255, 0.08);
	--aidr-line-strong: rgba(255, 255, 255, 0.14);
	--aidr-text: #e9edf4;
	--aidr-dim: #99a3b4;
	--aidr-faint: #6d7789;
	--aidr-shadow: 0 28px 60px -34px rgba(0, 0, 0, 0.9), 0 2px 10px -6px rgba(0, 0, 0, 0.6);
	--aidr-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0;
	font-family: inherit;
	font-size: var(--aidr-font);
	line-height: 1.6;
	color: var(--aidr-text);
	-webkit-font-smoothing: antialiased;
}

.aidr-chat.aidr-chat *,
.aidr-chat.aidr-chat *::before,
.aidr-chat.aidr-chat *::after {
	box-sizing: border-box;
}

.aidr-chat.aidr-chat[data-aidr-theme="light"] {
	--aidr-bg: #ffffff;
	--aidr-surface: #ffffff;
	--aidr-surface-2: #f6f7fa;
	--aidr-raise: #eaedf2;
	--aidr-line: rgba(16, 24, 40, 0.1);
	--aidr-line-strong: rgba(16, 24, 40, 0.16);
	--aidr-text: #101828;
	--aidr-dim: #5a6879;
	--aidr-faint: #7f8da0;
	--aidr-shadow: 0 22px 44px -30px rgba(16, 24, 40, 0.35), 0 1px 2px rgba(16, 24, 40, 0.06);
	--aidr-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

@media (prefers-color-scheme: light) {
	.aidr-chat.aidr-chat[data-aidr-theme="auto"] {
		--aidr-bg: #ffffff;
		--aidr-surface: #ffffff;
		--aidr-surface-2: #f6f7fa;
		--aidr-raise: #eaedf2;
		--aidr-line: rgba(16, 24, 40, 0.1);
		--aidr-line-strong: rgba(16, 24, 40, 0.16);
		--aidr-text: #101828;
		--aidr-dim: #5a6879;
		--aidr-faint: #7f8da0;
		--aidr-shadow: 0 22px 44px -30px rgba(16, 24, 40, 0.35), 0 1px 2px rgba(16, 24, 40, 0.06);
		--aidr-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
	}
}

/* ------------------------------------------------------------------ card */

.aidr-chat.aidr-chat .aidr-chat__card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: var(--aidr-height);
	max-height: 82vh;
	min-height: 340px;
	background: var(--aidr-surface);
	border: 1px solid var(--aidr-line);
	border-radius: var(--aidr-radius);
	box-shadow: var(--aidr-shadow), var(--aidr-inset);
	overflow: hidden;
	isolation: isolate;
}

.aidr-chat.aidr-chat .aidr-chat__boot {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
	color: var(--aidr-faint);
	font-size: 0.85em;
}

.aidr-chat.aidr-chat .aidr-chat__noscript {
	margin: 10px 0 0;
	color: #b42318;
	font-size: 0.85em;
}

/* ---------------------------------------------------------------- header */

.aidr-chat.aidr-chat .aidr-chat__head {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 12px 14px;
	background: linear-gradient(180deg, rgba(140, 152, 175, 0.08), rgba(140, 152, 175, 0));
	border-bottom: 1px solid var(--aidr-line);
	flex: 0 0 auto;
	margin: 0;
}

.aidr-chat.aidr-chat .aidr-chat__mark {
	width: 34px;
	height: 34px;
	border-radius: 11px;
	background: linear-gradient(145deg, var(--aidr-accent), #0a7a5f);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	box-shadow: 0 6px 16px -8px var(--aidr-accent);
}

.aidr-chat.aidr-chat .aidr-chat__mark svg {
	width: 17px;
	height: 17px;
	display: block;
}

.aidr-chat.aidr-chat .aidr-chat__id {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
	line-height: 1.2;
}

.aidr-chat.aidr-chat .aidr-chat__name {
	font-family: inherit;
	font-weight: 600;
	font-size: 1.02em;
	letter-spacing: -0.012em;
	text-transform: none;
	color: var(--aidr-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aidr-chat.aidr-chat .aidr-chat__sub {
	font-family: inherit;
	font-size: 0.66em;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--aidr-faint);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aidr-chat.aidr-chat .aidr-chat__head-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 8px;
}

.aidr-chat.aidr-chat .aidr-chat__status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 4px 10px 4px 9px;
	border: 1px solid var(--aidr-line);
	border-radius: 99px;
	background: rgba(140, 152, 175, 0.08);
	font-family: inherit;
	font-size: 0.62em;
	font-weight: 600;
	letter-spacing: 0.12em;
	line-height: 1.6;
	text-transform: uppercase;
	color: var(--aidr-dim);
	white-space: nowrap;
}

.aidr-chat.aidr-chat .aidr-chat__status::before {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 99px;
	background: var(--aidr-accent);
	box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.16);
}

.aidr-chat.aidr-chat .aidr-chat__ghost {
	appearance: none;
	-webkit-appearance: none;
	width: 32px;
	height: 32px;
	min-width: 32px;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 9px;
	background: transparent;
	background-image: none;
	box-shadow: none;
	color: var(--aidr-dim);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 0;
	line-height: 0;
	text-transform: none;
	transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.aidr-chat.aidr-chat .aidr-chat__ghost:hover {
	background-color: var(--aidr-surface-2);
	border-color: var(--aidr-line);
	color: var(--aidr-text);
}

.aidr-chat.aidr-chat .aidr-chat__ghost:focus-visible {
	outline: 2px solid var(--aidr-accent);
	outline-offset: 2px;
}

.aidr-chat.aidr-chat .aidr-chat__ghost svg {
	width: 15px;
	height: 15px;
	display: block;
}

/* ---------------------------------------------------------- conversation */

.aidr-chat.aidr-chat .aidr-chat__log {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 18px 15px 10px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin: 0;
	background: var(--aidr-bg);
	scrollbar-width: thin;
	scrollbar-color: var(--aidr-raise) transparent;
	overscroll-behavior: contain;
}

.aidr-chat.aidr-chat .aidr-chat__log::-webkit-scrollbar {
	width: 10px;
}

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

.aidr-chat.aidr-chat .aidr-chat__log::-webkit-scrollbar-thumb {
	background: var(--aidr-raise);
	border-radius: 99px;
	border: 3px solid var(--aidr-bg);
}

/* Before the first question, centre the greeting and starters. */
.aidr-chat.aidr-chat .aidr-chat__log.is-empty {
	justify-content: center;
	justify-content: safe center;
	padding-bottom: 16px;
}

/*
 * Fill the card. The conversation used to sit in a 780px reading column, which
 * left a wide dead margin either side of a full-width Elementor row. The
 * question keeps its bubble shape on the right; the answer spans the card.
 */
@media (min-width: 1000px) {
	.aidr-chat.aidr-chat .aidr-chat__log {
		padding-left: 24px;
		padding-right: 24px;
	}

	.aidr-chat.aidr-chat .aidr-msg__bubble {
		padding: 15px 20px;
		font-size: 1.02em;
		line-height: 1.66;
	}

	.aidr-chat.aidr-chat .aidr-msg--ai .aidr-msg__bubble {
		max-width: none;
	}

	.aidr-chat.aidr-chat .aidr-msg--user .aidr-msg__bubble {
		max-width: 70%;
	}
}

.aidr-chat.aidr-chat .aidr-msg {
	display: flex;
	flex-direction: column;
	gap: 5px;
	max-width: 100%;
	margin: 0;
	animation: aidr-in 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes aidr-in {
	from {
		opacity: 0;
		transform: translateY(5px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.aidr-chat.aidr-chat .aidr-msg--ai {
	align-items: flex-start;
	width: 100%;
}

.aidr-chat.aidr-chat .aidr-msg--user {
	align-items: flex-end;
}

.aidr-chat.aidr-chat .aidr-msg__bubble {
	position: relative;
	max-width: 100%;
	margin: 0;
	padding: 13px 16px;
	border-radius: 15px;
	border: 1px solid var(--aidr-line);
	background: var(--aidr-surface-2);
	box-shadow: var(--aidr-inset);
	font-family: inherit;
	font-size: 0.97em;
	line-height: 1.62;
	color: var(--aidr-text);
	overflow-wrap: anywhere;
	word-break: break-word;
	text-transform: none;
}

.aidr-chat.aidr-chat .aidr-msg--ai .aidr-msg__bubble {
	width: 100%;
	border-bottom-left-radius: 5px;
}

/* The opening line is a lead-in, not an answer: no panel, a touch larger. */
.aidr-chat.aidr-chat .aidr-msg--greeting .aidr-msg__bubble {
	width: 100%;
	padding: 2px 4px 4px;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font-size: 1.06em;
	line-height: 1.55;
	color: var(--aidr-text);
}

.aidr-chat.aidr-chat .aidr-msg--user .aidr-msg__bubble {
	max-width: 82%;
	background: linear-gradient(180deg, var(--aidr-accent), #0c8467);
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-bottom-right-radius: 5px;
	border-bottom-left-radius: 15px;
	color: #fff;
	box-shadow: 0 8px 22px -14px rgba(0, 0, 0, 0.8);
}

.aidr-chat.aidr-chat .aidr-msg--error .aidr-msg__bubble {
	background: rgba(180, 35, 24, 0.1);
	border-color: rgba(217, 45, 32, 0.38);
	color: #ff9a8f;
	font-size: 0.94em;
}

.aidr-chat.aidr-chat[data-aidr-theme="light"] .aidr-msg--error .aidr-msg__bubble {
	color: #b42318;
}

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

.aidr-chat.aidr-chat .aidr-msg__bubble > *:first-child {
	margin-top: 0;
}

.aidr-chat.aidr-chat .aidr-msg__bubble > *:last-child {
	margin-bottom: 0;
}

.aidr-chat.aidr-chat .aidr-msg__bubble p {
	margin: 0 0 0.6em;
	font-size: inherit;
	line-height: inherit;
}

.aidr-chat.aidr-chat .aidr-msg__bubble strong {
	font-weight: 650;
	color: inherit;
}

.aidr-chat.aidr-chat .aidr-msg__bubble em {
	font-style: italic;
}

.aidr-chat.aidr-chat .aidr-msg__bubble h4,
.aidr-chat.aidr-chat .aidr-msg__bubble h5,
.aidr-chat.aidr-chat .aidr-msg__bubble h6 {
	margin: 1em 0 0.35em;
	font-family: inherit;
	font-size: 0.95em;
	font-weight: 650;
	line-height: 1.35;
	letter-spacing: normal;
	text-transform: none;
	color: inherit;
}

.aidr-chat.aidr-chat .aidr-msg__bubble h4:first-child {
	margin-top: 0;
}

.aidr-chat.aidr-chat .aidr-msg__bubble ul,
.aidr-chat.aidr-chat .aidr-msg__bubble ol {
	margin: 0 0 0.6em;
	padding: 0 0 0 1.15em;
	list-style-position: outside;
}

.aidr-chat.aidr-chat .aidr-msg__bubble ul {
	list-style-type: disc;
}

.aidr-chat.aidr-chat .aidr-msg__bubble ol {
	list-style-type: decimal;
}

.aidr-chat.aidr-chat .aidr-msg__bubble li {
	margin: 0 0 0.3em;
	padding: 0;
	font-size: inherit;
	line-height: inherit;
}

.aidr-chat.aidr-chat .aidr-msg__bubble li::marker {
	color: var(--aidr-accent);
	font-weight: 600;
}

.aidr-chat.aidr-chat .aidr-msg--user .aidr-msg__bubble li::marker {
	color: #fff;
}

.aidr-chat.aidr-chat .aidr-msg__bubble code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.86em;
	background: rgba(140, 152, 175, 0.18);
	border: 1px solid var(--aidr-line);
	border-radius: 5px;
	padding: 0.14em 0.4em;
}

.aidr-chat.aidr-chat .aidr-msg__bubble pre {
	margin: 0 0 0.6em;
	padding: 11px 13px;
	background: rgba(140, 152, 175, 0.12);
	border: 1px solid var(--aidr-line);
	border-radius: 10px;
	overflow-x: auto;
	line-height: 1.5;
}

.aidr-chat.aidr-chat .aidr-msg__bubble pre code {
	background: none;
	border: 0;
	padding: 0;
}

.aidr-chat.aidr-chat .aidr-msg__bubble a,
.aidr-chat.aidr-chat .aidr-msg__bubble a:hover {
	color: var(--aidr-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
	box-shadow: none;
	border: 0;
}

.aidr-chat.aidr-chat .aidr-msg--user .aidr-msg__bubble a {
	color: #fff;
}

.aidr-chat.aidr-chat .aidr-msg__bubble table {
	width: 100%;
	margin: 0 0 0.7em;
	border-collapse: collapse;
	border: 0;
	background: transparent;
	font-size: 0.9em;
	display: block;
	overflow-x: auto;
}

.aidr-chat.aidr-chat .aidr-msg__bubble th,
.aidr-chat.aidr-chat .aidr-msg__bubble td {
	padding: 7px 10px;
	border: 1px solid var(--aidr-line);
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	text-align: left;
	vertical-align: top;
	white-space: nowrap;
}

.aidr-chat.aidr-chat .aidr-msg__bubble th {
	background: rgba(140, 152, 175, 0.12);
	font-weight: 600;
}

/* --------------------------------------------------------- answer tools */

.aidr-chat.aidr-chat .aidr-msg__tools {
	display: flex;
	gap: 6px;
	padding-left: 4px;
	opacity: 0;
	transition: opacity 0.16s ease;
}

.aidr-chat.aidr-chat .aidr-msg:hover .aidr-msg__tools,
.aidr-chat.aidr-chat .aidr-msg__tools:focus-within {
	opacity: 1;
}

.aidr-chat.aidr-chat .aidr-msg__copy {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 3px 10px;
	border: 1px solid var(--aidr-line);
	border-radius: 99px;
	background: transparent;
	background-image: none;
	box-shadow: none;
	color: var(--aidr-faint);
	font-family: inherit;
	font-size: 0.7em;
	font-weight: 400;
	line-height: 1.6;
	letter-spacing: 0.03em;
	text-transform: none;
	cursor: pointer;
	transition: color 0.16s ease, border-color 0.16s ease;
}

.aidr-chat.aidr-chat .aidr-msg__copy:hover {
	color: var(--aidr-text);
	border-color: var(--aidr-line-strong);
}

.aidr-chat.aidr-chat .aidr-msg__note {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	max-width: 100%;
	margin: 0;
	padding: 1px 4px 0;
	font-family: inherit;
	font-size: 0.73em;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	color: var(--aidr-faint);
}

.aidr-chat.aidr-chat .aidr-msg__note svg {
	width: 12px;
	height: 12px;
	flex: 0 0 auto;
	margin-top: 2px;
	opacity: 0.85;
}

/* --------------------------------------------------------------- typing */

.aidr-chat.aidr-chat .aidr-dots {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 3px 1px;
}

.aidr-chat.aidr-chat .aidr-dots span {
	width: 6px;
	height: 6px;
	border-radius: 99px;
	background: var(--aidr-dim);
	animation: aidr-dot 1.15s infinite ease-in-out;
}

.aidr-chat.aidr-chat .aidr-dots span:nth-child(2) {
	animation-delay: 0.16s;
}

.aidr-chat.aidr-chat .aidr-dots span:nth-child(3) {
	animation-delay: 0.32s;
}

@keyframes aidr-dot {
	0%,
	60%,
	100% {
		opacity: 0.3;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

.aidr-chat.aidr-chat .aidr-caret::after {
	content: "";
	display: inline-block;
	width: 2px;
	height: 1em;
	margin-left: 2px;
	vertical-align: -0.16em;
	background: var(--aidr-accent);
	animation: aidr-blink 1.05s steps(2, start) infinite;
}

@keyframes aidr-blink {
	to {
		visibility: hidden;
	}
}

/* ---------------------------------------------------- starters / empty UI */

.aidr-chat.aidr-chat .aidr-chat__empty {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 2px 0 0;
	padding: 0;
	animation: aidr-in 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.aidr-chat.aidr-chat .aidr-chat__empty-label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 2px 0 0;
	font-family: inherit;
	font-size: 0.62em;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--aidr-faint);
}

.aidr-chat.aidr-chat .aidr-chat__empty-label::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: var(--aidr-line);
}

.aidr-chat.aidr-chat .aidr-chat__starters {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 8px;
	max-width: 100%;
	align-items: stretch;
	margin: 0;
}

.aidr-chat.aidr-chat .aidr-try {
	appearance: none;
	-webkit-appearance: none;
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: 10px;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 11px 13px;
	text-align: left;
	background-color: var(--aidr-surface-2);
	background-image: none;
	border: 1px solid var(--aidr-line);
	border-radius: 11px;
	box-shadow: none;
	color: var(--aidr-text);
	font-family: inherit;
	font-size: 0.85em;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	cursor: pointer;
	transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.aidr-chat.aidr-chat .aidr-try:hover {
	background-color: var(--aidr-raise);
	transform: translateY(-1px);
}

.aidr-chat.aidr-chat .aidr-try:focus-visible {
	outline: 2px solid var(--aidr-accent);
	outline-offset: 1px;
}

@supports (color: color-mix(in srgb, red, blue)) {
	.aidr-chat.aidr-chat .aidr-try:hover {
		border-color: color-mix(in srgb, var(--aidr-accent) 55%, transparent);
	}
}

.aidr-chat.aidr-chat .aidr-try__icon {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	margin-top: 1px;
	color: var(--aidr-accent);
	opacity: 0.9;
}

.aidr-chat.aidr-chat .aidr-try__icon svg {
	width: 16px;
	height: 16px;
	display: block;
}

.aidr-chat.aidr-chat .aidr-try__text {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-width: 0;
}

/* ------------------------------------------------------------- composer */

.aidr-chat.aidr-chat .aidr-chat__composer {
	flex: 0 0 auto;
	margin: 0;
	padding: 12px 14px 10px;
	background: var(--aidr-surface);
	border-top: 1px solid var(--aidr-line);
}

.aidr-chat.aidr-chat .aidr-chat__form {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-end;
	gap: 6px;
	margin: 0;
	padding: 6px 6px 6px 14px;
	background-color: var(--aidr-surface-2);
	background-image: none;
	border: 1px solid var(--aidr-line-strong);
	border-radius: calc(var(--aidr-radius) * 0.72);
	box-shadow: none;
	transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.aidr-chat.aidr-chat .aidr-chat__form:focus-within {
	border-color: var(--aidr-accent);
	box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.14);
}

@supports (color: color-mix(in srgb, red, blue)) {
	.aidr-chat.aidr-chat .aidr-chat__form:focus-within {
		border-color: color-mix(in srgb, var(--aidr-accent) 70%, transparent);
		box-shadow: 0 0 0 3px color-mix(in srgb, var(--aidr-accent) 15%, transparent);
	}
}

.aidr-chat.aidr-chat .aidr-chat__input {
	appearance: none;
	-webkit-appearance: none;
	display: block;
	float: none;
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	max-width: 100%;
	height: auto;
	min-height: 26px;
	margin: 0;
	padding: 7px 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	background-image: none;
	box-shadow: none;
	color: var(--aidr-text);
	font-family: inherit;
	font-size: 0.97em;
	font-weight: 400;
	line-height: 1.55;
	letter-spacing: normal;
	text-transform: none;
	text-indent: 0;
	resize: none;
	outline: none;
	opacity: 1;
	caret-color: var(--aidr-accent);
}

.aidr-chat.aidr-chat .aidr-chat__input::placeholder {
	color: var(--aidr-faint);
	font-size: inherit;
	letter-spacing: normal;
	text-transform: none;
	opacity: 1;
}

.aidr-chat.aidr-chat .aidr-chat__mic {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	width: 32px;
	height: 40px;
	min-width: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 9px;
	background: transparent;
	background-image: none;
	box-shadow: none;
	color: var(--aidr-faint);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	line-height: 0;
	transition: color 0.16s ease, background-color 0.16s ease;
}

.aidr-chat.aidr-chat .aidr-chat__mic:hover {
	color: var(--aidr-text);
	background-color: var(--aidr-raise);
}

.aidr-chat.aidr-chat .aidr-chat__mic.is-live {
	color: var(--aidr-accent);
	animation: aidr-pulse 1.4s infinite;
}

.aidr-chat.aidr-chat .aidr-chat__mic[hidden] {
	display: none;
}

.aidr-chat.aidr-chat .aidr-chat__mic svg {
	width: 17px;
	height: 17px;
	display: block;
}

@keyframes aidr-pulse {
	50% {
		opacity: 0.45;
	}
}

.aidr-chat.aidr-chat .aidr-chat__send {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	min-width: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 11px;
	background: linear-gradient(180deg, var(--aidr-accent), #0c8467);
	background-image: linear-gradient(180deg, var(--aidr-accent), #0c8467);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 18px -12px var(--aidr-accent);
	font-size: 0;
	line-height: 0;
	letter-spacing: 0;
	text-transform: none;
	text-shadow: none;
	cursor: pointer;
	transition: filter 0.16s ease, transform 0.12s ease;
}

.aidr-chat.aidr-chat .aidr-chat__send:hover:not(:disabled) {
	filter: brightness(1.08);
}

.aidr-chat.aidr-chat .aidr-chat__send:active:not(:disabled) {
	transform: scale(0.97);
}

/* An empty composer should read as "waiting", not as a broken dim button. */
.aidr-chat.aidr-chat .aidr-chat__send:disabled {
	background: var(--aidr-surface-2);
	background-image: none;
	border: 1px solid var(--aidr-line);
	color: var(--aidr-faint);
	opacity: 1;
	box-shadow: none;
	cursor: not-allowed;
}

.aidr-chat.aidr-chat .aidr-chat__send:focus-visible {
	outline: 2px solid var(--aidr-text);
	outline-offset: 2px;
}

.aidr-chat.aidr-chat .aidr-chat__send svg {
	width: 17px;
	height: 17px;
	display: block;
}

.aidr-chat.aidr-chat .aidr-chat__meta {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	margin: 0;
	padding: 9px 2px 0;
	min-height: 14px;
}

.aidr-chat.aidr-chat .aidr-chat__note {
	margin: 0;
	font-family: inherit;
	font-size: 0.71em;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	color: var(--aidr-faint);
	max-width: 78ch;
}

.aidr-chat.aidr-chat .aidr-chat__note:empty {
	display: none;
}

.aidr-chat.aidr-chat .aidr-chat__count {
	margin-left: auto;
	font-family: inherit;
	font-size: 0.71em;
	color: var(--aidr-faint);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.aidr-chat.aidr-chat .aidr-chat__count.is-warn {
	color: #d92d20;
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 560px) {
	.aidr-chat.aidr-chat .aidr-chat__card {
		max-height: 78vh;
		border-radius: max(12px, calc(var(--aidr-radius) - 4px));
	}

	.aidr-chat.aidr-chat .aidr-chat__head {
		padding: 11px 12px;
	}

	.aidr-chat.aidr-chat .aidr-chat__status {
		display: none;
	}

	.aidr-chat.aidr-chat .aidr-chat__log {
		padding: 14px 11px 8px;
		gap: 12px;
	}

	.aidr-chat.aidr-chat .aidr-msg--user .aidr-msg__bubble {
		max-width: 92%;
	}

	.aidr-chat.aidr-chat .aidr-msg__bubble {
		padding: 11px 13px;
	}

	.aidr-chat.aidr-chat .aidr-chat__starters {
		grid-template-columns: 1fr;
	}

	.aidr-chat.aidr-chat .aidr-chat__composer {
		padding: 10px 10px 8px;
	}

	.aidr-chat.aidr-chat .aidr-chat__input {
		font-size: 16px; /* stops iOS zooming on focus */
	}
}

@media (prefers-reduced-motion: reduce) {
	.aidr-chat.aidr-chat *,
	.aidr-chat.aidr-chat *::before,
	.aidr-chat.aidr-chat *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}

	.aidr-chat.aidr-chat .aidr-caret::after {
		display: none;
	}
}

/* ------------------------------------------------- mobile: visual viewport */

/* The card follows the visual viewport (set by JS as --aidr-vh) so the type
   box stays on screen when the keyboard opens, instead of the browser
   scrolling the page up to reach a fixed 520px card. */
.aidr-chat.aidr-chat .aidr-chat__card {
	height: min(var(--aidr-height), var(--aidr-vh, 82vh));
	max-height: none;
}

@media (max-width: 782px) {
	.aidr-chat.aidr-chat .aidr-chat__card {
		height: min(var(--aidr-height), var(--aidr-vh, 72vh));
		min-height: 300px;
		max-height: none;
	}

	.aidr-chat.aidr-chat .aidr-chat__log {
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}

	.aidr-chat.aidr-chat .aidr-chat__input {
		font-size: 16px;
		line-height: 1.4;
		scroll-margin-block: 96px;
	}

	.aidr-chat.aidr-chat .aidr-chat__composer {
		position: relative;
		z-index: 2;
	}
}
