.yours-ai-chat {
	border: 1px solid #d7dee8;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	font-size: 16px;
	gap: 12px;
	margin: 24px 0;
	max-width: 720px;
	padding: 16px;
}

.yours-ai-chat__messages {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 420px;
	min-height: 180px;
	overflow-y: auto;
}

.yours-ai-chat__toolbar {
	display: flex;
	justify-content: flex-end;
}

.yours-ai-chat__clear {
	align-items: center;
	background: transparent;
	border: 0;
	color: #475569;
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	justify-content: center;
	min-height: 44px;
	min-width: 44px;
	padding: 8px;
}

.yours-ai-chat__clear svg {
	display: block;
	flex-shrink: 0;
}

.yours-ai-chat__clear:disabled {
	cursor: wait;
	opacity: 0.7;
}

.yours-ai-chat__status {
	color: #475569;
	font-size: 0.875rem;
	margin: 0;
}

.yours-ai-chat__message {
	display: flex;
}

.yours-ai-chat__message--user {
	justify-content: flex-end;
}

.yours-ai-chat__message--assistant {
	justify-content: flex-start;
}

.yours-ai-chat__message-body {
	background: #f3f6fa;
	border-radius: 8px;
	color: #1f2937;
	font-size: 1rem;
	line-height: 1.5;
	max-width: min(86%, 560px);
	overflow-wrap: anywhere;
	padding: 10px 12px;
	white-space: pre-wrap;
}

.yours-ai-chat__message--user .yours-ai-chat__message-body {
	background: #1f6feb;
	color: #ffffff;
}

.yours-ai-chat__form {
	display: flex;
	gap: 10px;
}

.yours-ai-chat__input {
	flex: 1;
	font-size: 1rem;
	min-height: 52px;
	resize: vertical;
}

.yours-ai-chat__button {
	align-self: stretch;
	cursor: pointer;
	font-size: 1rem;
	min-width: 88px;
}

.yours-ai-chat__button:disabled,
.yours-ai-chat__input:disabled {
	cursor: wait;
	opacity: 0.7;
}

.yours-ai-chat__sources {
	border-top: 1px solid #dfe7f1;
	color: #64748b;
	font-size: 0.875rem;
	margin: 8px 0 0;
	max-width: 100%;
	overflow-wrap: anywhere;
	padding-top: 8px;
	white-space: normal;
}

.yours-ai-chat__sources summary {
	cursor: pointer;
	font-weight: 600;
	list-style-position: inside;
}

.yours-ai-chat__sources ul {
	margin: 6px 0 0;
	padding-left: 20px;
}

.yours-ai-chat__sources a {
	word-break: break-word;
}

.yours-ai-chat__products {
	border-top: 1px solid #dfe7f1;
	margin-top: 10px;
	padding-top: 10px;
	white-space: normal;
}

.yours-ai-chat__products-title {
	color: #475569;
	font-size: 0.875rem;
	font-weight: 700;
	margin-bottom: 8px;
}

.yours-ai-chat__product-grid {
	display: grid;
	gap: 8px;
}

.yours-ai-chat__product-card {
	align-items: stretch;
	background: #ffffff;
	border: 1px solid #dbe4ef;
	border-radius: 8px;
	color: #1f2937;
	display: grid;
	gap: 10px;
	grid-template-columns: 84px minmax(0, 1fr);
	overflow: hidden;
	padding: 8px;
	text-decoration: none;
}

.yours-ai-chat__product-card:hover,
.yours-ai-chat__product-card:focus {
	border-color: #60a5fa;
	box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
	outline: none;
}

.yours-ai-chat__product-image {
	aspect-ratio: 1;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	display: block;
	overflow: hidden;
}

.yours-ai-chat__product-image img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.yours-ai-chat__product-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.yours-ai-chat__product-title {
	font-weight: 700;
	line-height: 1.25;
}

.yours-ai-chat__product-meta,
.yours-ai-chat__product-summary {
	color: #64748b;
	font-size: 0.8125rem;
	line-height: 1.35;
}

.yours-ai-chat__product-link {
	color: #1f6feb;
	font-size: 0.8125rem;
	font-weight: 700;
	margin-top: 2px;
}

@media (max-width: 520px) {
	.yours-ai-chat__form {
		flex-direction: column;
	}

	.yours-ai-chat__button {
		min-height: 44px;
	}

	.yours-ai-chat__product-card {
		grid-template-columns: 72px minmax(0, 1fr);
	}
}

/* A single global chat panel. */
.yours-ai-widget {
	bottom: max(20px, env(safe-area-inset-bottom));
	position: fixed;
	left: max(20px, env(safe-area-inset-left));
	z-index: 99999;
}

.yours-ai-widget__toggle,
.yours-ai-widget__close {
	cursor: pointer;
	font: inherit;
}

.yours-ai-widget__toggle {
	background: #1f6feb;
	border: 0;
	border-radius: 999px;
	box-shadow: 0 4px 20px rgba(15, 23, 42, 0.2);
	color: #fff;
	font-size: 16px;
	min-height: 48px;
	padding: 12px 20px;
}

.yours-ai-widget__panel {
	background: #fff;
	border: 1px solid #d7dee8;
	border-radius: 12px;
	bottom: calc(100% + 12px);
	box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
	display: flex;
	flex-direction: column;
	max-height: min(620px, calc(100vh - 110px));
	max-height: min(620px, calc(100dvh - 110px));
	position: absolute;
	left: 0;
	width: min(400px, calc(100vw - 40px));
}

.yours-ai-widget__panel[hidden] {
	display: none !important;
}

.yours-ai-widget__header {
	align-items: center;
	border-bottom: 1px solid #d7dee8;
	color: #1f2937;
	display: flex;
	flex-shrink: 0;
	font-size: 16px;
	justify-content: space-between;
	padding: 8px 12px;
}

.yours-ai-widget__close {
	background: transparent;
	border: 0;
	color: #475569;
	font-size: 26px;
	line-height: 1;
	min-height: 44px;
	min-width: 44px;
}

.yours-ai-widget .yours-ai-chat {
	border: 0;
	margin: 0;
	min-height: 0;
	padding: 12px;
}

.yours-ai-widget .yours-ai-chat__messages {
	min-height: 0;
	max-height: 380px;
}

.yours-ai-widget .yours-ai-chat__form {
	flex-direction: row;
	flex-shrink: 0;
}

.yours-ai-widget .yours-ai-chat__input {
	background: #fff;
	border: 1px solid #94a3b8;
	border-radius: 6px;
	color: #1f2937;
	margin: 0;
	min-width: 0;
	font-family: inherit;
	padding: 8px;
}

.yours-ai-widget .yours-ai-chat__button {
	background: #1f6feb;
	border: 0;
	border-radius: 6px;
	color: #fff;
	min-width: 64px;
	padding: 8px;
}

.yours-ai-widget button:focus-visible,
.yours-ai-widget textarea:focus-visible {
	outline: 3px solid #60a5fa;
	outline-offset: 2px;
}
