/**
 * LinkNearBiz Agent - Chat Widget styles
 *
 * Scoped entirely under .sm-root so nothing here can leak into, or be
 * overridden by, the host theme's own styles. Uses the system font
 * stack deliberately — a third-party embedded widget forcing a custom
 * webfont load onto an arbitrary host page is poor practice (FOUC risk,
 * extra network request, potential visual clash with the theme's own
 * type). --sm-primary is set inline by the widget script from the
 * admin's configured primary_color; every accent color here derives
 * from that one variable so the whole widget re-themes from a single
 * admin setting.
 */

.sm-root {
	--sm-primary: #2563eb;
	--sm-primary-dark: color-mix(in srgb, var(--sm-primary) 80%, black 20%);
	--sm-text: #1f2430;
	--sm-text-muted: #6b7280;
	--sm-surface: #ffffff;
	--sm-surface-alt: #f5f6f8;
	--sm-border: #e5e7eb;
	--sm-fallback-bg: #fef6e7;
	--sm-fallback-border: #f0d999;
	--sm-error-bg: #fdecec;
	--sm-error-border: #f3b4b4;
	--sm-radius: 16px;
	--sm-shadow: 0 12px 32px rgba(20, 20, 30, 0.16), 0 2px 8px rgba(20, 20, 30, 0.08);

	position: fixed;
	z-index: 2147483000; /* Sit above essentially anything a host theme could throw at it, without resorting to !important everywhere. */
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--sm-text);
	bottom: 24px;
}

.sm-root[data-position="bottom-right"] { right: 24px; }
.sm-root[data-position="bottom-left"] { left: 24px; }

.sm-root *,
.sm-root *::before,
.sm-root *::after {
	box-sizing: border-box;
}

.sm-hidden {
	display: none !important;
}

/* ------------------------------------------------------------------ */
/* Launcher (fab)                                                      */
/* ------------------------------------------------------------------ */

.sm-fab {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, var(--sm-primary), var(--sm-primary-dark));
	color: #fff;
	box-shadow: var(--sm-shadow);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	animation: sm-pulse 2.4s ease-in-out infinite;
	transition: transform 0.15s ease;
	overflow: hidden;
	padding: 10px;
}

.sm-fab-avatar {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.sm-fab:hover {
	transform: scale(1.06);
}

.sm-fab:focus-visible {
	outline: 3px solid var(--sm-primary-dark);
	outline-offset: 3px;
}

.sm-open .sm-fab {
	animation: none;
	display: none;
}

@keyframes sm-pulse {
	0%, 100% { box-shadow: var(--sm-shadow), 0 0 0 0 color-mix(in srgb, var(--sm-primary) 45%, transparent); }
	50% { box-shadow: var(--sm-shadow), 0 0 0 10px color-mix(in srgb, var(--sm-primary) 0%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
	.sm-fab {
		animation: none;
	}
}

/* ------------------------------------------------------------------ */
/* Teaser bubble                                                        */
/* ------------------------------------------------------------------ */

.sm-teaser {
	position: absolute;
	bottom: 74px;
	max-width: min(280px, calc(100vw - 56px));
	background: var(--sm-surface);
	border: 1px solid var(--sm-border);
	border-radius: 14px;
	box-shadow: var(--sm-shadow);
	padding: 12px 32px 12px 14px;
	cursor: pointer;
	animation: sm-teaser-in 0.25s ease-out;
	white-space: nowrap;
}

.sm-root[data-position="bottom-right"] .sm-teaser { right: 0; }
.sm-root[data-position="bottom-left"] .sm-teaser { left: 0; }

@keyframes sm-teaser-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

.sm-teaser-text {
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sm-teaser-close {
	position: absolute;
	top: 6px;
	right: 8px;
	border: none;
	background: none;
	font-size: 16px;
	line-height: 1;
	color: var(--sm-text-muted);
	cursor: pointer;
	padding: 2px 4px;
}

/* ------------------------------------------------------------------ */
/* Panel                                                                */
/* ------------------------------------------------------------------ */

.sm-panel {
	position: absolute;
	bottom: 74px;
	width: 380px;
	height: 570px;
	max-height: calc(100vh - 100px);
	background: var(--sm-surface);
	border-radius: var(--sm-radius);
	box-shadow: var(--sm-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: sm-panel-in 0.2s ease-out;
}

.sm-root[data-position="bottom-right"] .sm-panel { right: 0; }
.sm-root[data-position="bottom-left"] .sm-panel { left: 0; }

@keyframes sm-panel-in {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 767px) {
	.sm-panel {
		position: fixed;
		top: 12px;
		left: 12px;
		right: 12px;
		height: calc(var(--sm-vh, 100vh) - 24px);
		max-height: calc(var(--sm-vh, 100vh) - 24px);
		bottom: auto;
		width: auto;
	}
}

.sm-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--sm-primary), var(--sm-primary-dark));
	color: #fff;
	flex-shrink: 0;
}

.sm-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	overflow: hidden;
	flex-shrink: 0;
}

.sm-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sm-header-meta {
	flex: 1;
	min-width: 0;
}

.sm-header-name {
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sm-header-status {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	opacity: 0.9;
}

.sm-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

.sm-header-end {
	border: 1px solid rgba(255, 255, 255, 0.55);
	background: transparent;
	color: #fff;
	border-radius: 14px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	flex-shrink: 0;
}

.sm-header-end:hover {
	background: rgba(255, 255, 255, 0.2);
}

.sm-header-close {
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
}

.sm-header-close:hover {
	background: rgba(255, 255, 255, 0.28);
}

.sm-tabs {
	display: flex;
	flex-shrink: 0;
	border-bottom: 1px solid #e5e7eb;
	background: #fff;
}

.sm-tab {
	flex: 1;
	border: none;
	background: transparent;
	padding: 11px 8px;
	font-size: 13px;
	font-weight: 600;
	color: #6b7280;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.sm-tab:hover {
	color: var(--sm-primary);
}

.sm-tab-active {
	color: var(--sm-primary);
	border-bottom-color: var(--sm-primary);
}

.sm-contact-view {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 16px;
}

.sm-agent-inbox {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.sm-agent-queue {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
}

.sm-agent-queue-title {
	margin: 0 0 8px;
	font-size: 13px;
	color: #374151;
}

.sm-a-muted-widget {
	font-size: 12px;
	color: #9ca3af;
}

.sm-agent-queue-item {
	padding: 10px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	margin-bottom: 8px;
	cursor: pointer;
}

.sm-agent-queue-item:hover {
	border-color: var(--sm-primary);
}

.sm-agent-queue-item-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 13px;
}

.sm-agent-status-badge {
	font-size: 10px;
	font-weight: 700;
	padding: 1px 8px;
	border-radius: 10px;
}

.sm-agent-status-requested {
	background: #fef3c7;
	color: #92400e;
}

.sm-agent-status-active {
	background: #d1fae5;
	color: #065f46;
}

.sm-agent-thread {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.sm-agent-thread-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-bottom: 1px solid #e5e7eb;
	font-size: 13px;
}

.sm-agent-thread-header strong {
	flex: 1;
}

.sm-agent-thread-log {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sm-agent-bubble {
	max-width: 80%;
	padding: 8px 12px;
	border-radius: 10px;
	font-size: 13px;
}

.sm-agent-bubble-visitor {
	align-self: flex-start;
	background: #f3f4f6;
}

.sm-agent-bubble-agent {
	align-self: flex-end;
	background: var(--sm-primary);
	color: #fff;
}

.sm-agent-bubble-row {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	max-width: 88%;
}

.sm-agent-bubble-row .sm-agent-bubble {
	max-width: 100%;
}

.sm-agent-bubble-row-visitor {
	align-self: flex-start;
}

.sm-agent-bubble-row-agent {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.sm-agent-msg-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 9px;
	font-weight: 700;
	color: #fff;
}

.sm-agent-msg-avatar-visitor {
	background: #9ca3af;
}

.sm-agent-msg-avatar-agent {
	background: var(--sm-primary);
}

.sm-agent-bubble-system {
	align-self: center;
	max-width: 92%;
	font-size: 11px;
	color: #9ca3af;
	text-align: center;
	padding: 2px 10px;
}

.sm-agent-composer {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #e5e7eb;
	align-items: flex-end;
}

.sm-agent-composer-input {
	flex: 1;
	min-height: 38px;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	padding: 8px;
	font-family: inherit;
	font-size: 13px;
}

.sm-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* ------------------------------------------------------------------ */
/* Shared view / form elements                                         */
/* ------------------------------------------------------------------ */

.sm-view {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.sm-view-prechat,
.sm-view-starting,
.sm-view-expired,
.sm-view-broken {
	padding: 20px;
	align-items: center;
	text-align: center;
	gap: 12px;
	overflow-y: auto;
}

/*
 * The pre-chat form has real content now (the banner below) to fill the
 * space, so it starts from the top rather than being vertically
 * centered — centering a short block of content inside a near-fullscreen
 * mobile panel is what left a large empty gap above it.
 */
.sm-view-prechat {
	justify-content: flex-start;
}

.sm-view-starting,
.sm-view-expired,
.sm-view-broken {
	justify-content: center;
}

.sm-prechat-intro {
	margin: 0 0 4px;
	font-weight: 600;
	align-self: flex-start;
}

.sm-prechat-banner {
	width: 100%;
	background: linear-gradient(135deg, var(--sm-primary), var(--sm-primary-dark));
	color: #fff;
	border-radius: 14px;
	padding: 22px 20px 24px;
	text-align: center;
	margin-bottom: 4px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.sm-prechat-banner-icon {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 18px;
	overflow: hidden;
	flex-shrink: 0;
	margin-bottom: 10px;
}

.sm-prechat-banner-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sm-prechat-banner-title {
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 8px;
}

.sm-prechat-banner-text {
	font-size: 13px;
	line-height: 1.55;
	margin: 0;
	color: rgba(255, 255, 255, 0.92);
	max-width: 46ch;
}

.sm-prechat-form {
	display: flex;
	flex-direction: column;
	width: 100%;
	gap: 6px;
	text-align: left;
}

.sm-field-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--sm-text-muted);
	margin-top: 6px;
}

.sm-field-input {
	border: 1px solid var(--sm-border);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	color: var(--sm-text);
}

.sm-field-input:focus-visible {
	outline: 2px solid var(--sm-primary);
	outline-offset: 1px;
}

.sm-field-invalid {
	border-color: #dc2626;
}

.sm-field-error {
	font-size: 12px;
	color: #dc2626;
}

.sm-consent-row {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	font-size: 12px;
	color: var(--sm-text-muted);
	margin-top: 6px;
}

.sm-privacy-note {
	font-size: 11px;
	color: var(--sm-text-muted);
	margin: 6px 0 0;
}

.sm-privacy-link {
	color: var(--sm-primary);
}

.sm-btn {
	border: none;
	border-radius: 10px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
}

.sm-btn-primary {
	background: var(--sm-primary);
	color: #fff;
	margin-top: 10px;
}

.sm-btn-primary:hover {
	background: var(--sm-primary-dark);
}

.sm-btn-outline {
	background: transparent;
	border: 1px solid var(--sm-primary);
	color: var(--sm-primary);
	text-decoration: none;
	display: inline-block;
}

.sm-btn-small {
	padding: 6px 10px;
	font-size: 12px;
	background: var(--sm-surface-alt);
	color: var(--sm-text);
}

/* ------------------------------------------------------------------ */
/* Starting spinner                                                     */
/* ------------------------------------------------------------------ */

.sm-spinner {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 3px solid var(--sm-border);
	border-top-color: var(--sm-primary);
	animation: sm-spin 0.7s linear infinite;
}

@keyframes sm-spin {
	to { transform: rotate(360deg); }
}

.sm-starting-text {
	color: var(--sm-text-muted);
	margin: 0;
}

/* ------------------------------------------------------------------ */
/* Chat log + bubbles                                                   */
/* ------------------------------------------------------------------ */

.sm-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--sm-surface-alt);
}

.sm-bubble {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 14px;
	word-wrap: break-word;
}

.sm-bubble-content strong {
	font-weight: 700;
}

.sm-bubble-user {
	align-self: flex-end;
	background: var(--sm-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.sm-bubble-assistant {
	align-self: flex-start;
	background: var(--sm-surface);
	border: 1px solid var(--sm-border);
	border-bottom-left-radius: 4px;
}

.sm-bubble-fallback {
	background: var(--sm-fallback-bg);
	border-color: var(--sm-fallback-border);
}

.sm-bubble-agent {
	align-self: flex-start;
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	border-bottom-left-radius: 4px;
}

.sm-bubble-system {
	align-self: center;
	max-width: 92%;
	background: transparent;
	color: #6b7280;
	font-size: 12px;
	text-align: center;
	padding: 4px 10px;
}

.sm-bubble-row {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	max-width: 88%;
}

.sm-bubble-row .sm-bubble {
	max-width: 100%;
}

.sm-bubble-row-user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.sm-bubble-row-assistant,
.sm-bubble-row-agent {
	align-self: flex-start;
}

.sm-bubble-with-name {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.sm-bubble-agent-name {
	font-size: 11px;
	font-weight: 600;
	color: #4f46e5;
	padding-left: 2px;
}

.sm-msg-avatar {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	overflow: hidden;
}

.sm-msg-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sm-msg-avatar-assistant {
	background: var(--sm-primary);
}

.sm-msg-avatar-agent {
	background: #4f46e5;
}

.sm-msg-avatar-user {
	background: #9ca3af;
}

.sm-live-chat-banner {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 14px;
	background: #eef2ff;
	border-bottom: 1px solid #c7d2fe;
	font-size: 12px;
	color: #3730a3;
}

.sm-live-chat-banner-active {
	justify-content: center;
	background: #ecfdf5;
	border-bottom-color: #a7f3d0;
	color: #065f46;
}

.sm-live-chat-banner-closed {
	justify-content: center;
	background: #f9fafb;
	border-bottom-color: #e5e7eb;
	color: #6b7280;
	text-align: center;
}

.sm-contact-cta {
	margin-top: 8px;
}

.sm-error-banner {
	align-self: center;
	max-width: 92%;
	background: var(--sm-error-bg);
	border: 1px solid var(--sm-error-border);
	border-radius: 12px;
	padding: 8px 12px;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
}

.sm-idle-prompt {
	align-self: center;
	max-width: 92%;
	background: #fcf9e8;
	border: 1px solid #f0dfa0;
	border-radius: 12px;
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	text-align: center;
}

.sm-idle-prompt p {
	margin: 0;
}

/* ------------------------------------------------------------------ */
/* Typing indicator                                                     */
/* ------------------------------------------------------------------ */

.sm-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 13px;
	background: var(--sm-surface);
	border: 1px solid var(--sm-border);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.sm-typing-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--sm-text-muted);
	animation: sm-typing-bounce 1.2s ease-in-out infinite;
}

.sm-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.sm-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes sm-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

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

.sm-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid var(--sm-border);
	background: var(--sm-surface);
	flex-shrink: 0;
}

.sm-quota-note {
	padding: 0 10px 8px;
	text-align: center;
	font-size: 11px;
	line-height: 1.3;
	color: var(--sm-text-muted);
	background: var(--sm-surface);
	flex-shrink: 0;
}

.sm-quota-note.sm-quota-low { color: #b45309; }
.sm-quota-note.sm-quota-reached { color: #b91c1c; font-weight: 600; }
/* Message lock: calmer than the plain "limit reached" red, and it may wrap to two lines. */
.sm-quota-note.sm-quota-locked { color: #92400e; font-weight: 500; line-height: 1.4; }

/* Blocked composer (limit reached or locked): the box looks switched off, the suggested questions above stay live. */
.sm-composer.is-locked .sm-composer-input { background: rgba(0, 0, 0, 0.04); }
.sm-composer.is-locked .sm-send-btn { opacity: 0.5; cursor: not-allowed; }

.sm-composer-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--sm-border);
	border-radius: 12px;
	padding: 9px 12px;
	font-family: inherit;
	font-size: 14px;
	max-height: 120px;
	color: var(--sm-text);
}

.sm-composer-input:focus-visible {
	outline: 2px solid var(--sm-primary);
	outline-offset: 1px;
}

.sm-composer-input:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.sm-send-btn {
	margin-top: 0;
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sm-btn-stop {
	background: #c0392b;
	color: #fff;
}

.sm-btn-stop:hover {
	background: #a93226;
}

/* ------------------------------------------------------------------ */
/* Toast (transient errors outside the chat log, e.g. pre-chat failure) */
/* ------------------------------------------------------------------ */

/*
 * Deliberately `position: fixed` against the VIEWPORT rather than
 * `position: absolute` against .sm-root. .sm-root has no explicit width
 * of its own — it shrink-wraps to its only normal-flow child (the fab
 * button, ~60px) — so an absolutely-positioned child using left:0 AND
 * right:0 (a stretch-to-parent) would collapse to that same ~60px box,
 * wrapping every word onto its own line. Anchoring from a single side
 * with an explicit width sidesteps that entirely and keeps the toast
 * aligned with whichever corner the widget itself is configured for.
 */
.sm-toast {
	position: fixed;
	bottom: 100px;
	width: 300px;
	max-width: calc(100vw - 48px);
	background: var(--sm-error-bg);
	border: 1px solid var(--sm-error-border);
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13px;
	text-align: center;
	box-shadow: var(--sm-shadow);
}

.sm-root[data-position="bottom-right"] .sm-toast { right: 24px; }
.sm-root[data-position="bottom-left"] .sm-toast { left: 24px; }

/* End-of-chat review card: stars + optional written review */
.sm-feedback-card {
	align-self: stretch;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	font-size: 14px;
	margin: 8px 0;
	padding: 12px;
}

.sm-feedback-card p {
	margin: 0 0 8px;
}

.sm-feedback-title {
	font-weight: 600;
}

.sm-feedback-thanks {
	color: #15803d;
	font-weight: 600;
	margin: 0;
	text-align: center;
}

.sm-stars {
	display: flex;
	gap: 4px;
	justify-content: center;
}

.sm-star {
	background: transparent;
	border: none;
	color: #cbd5e1;
	cursor: pointer;
	font-size: 34px;
	line-height: 1;
	padding: 2px 4px;
	transition: transform 0.1s ease, color 0.1s ease;
}

.sm-star:hover:not(:disabled) {
	transform: scale(1.12);
}

.sm-star:focus-visible {
	outline: 2px solid var(--sm-primary);
	border-radius: 6px;
}

.sm-star-on {
	color: #f59e0b;
}

.sm-star-label {
	color: var(--sm-text-muted);
	font-size: 12px;
	margin: 2px 0 8px;
	min-height: 16px;
	text-align: center;
}

.sm-feedback-input {
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	box-sizing: border-box;
	font: inherit;
	padding: 8px;
	resize: vertical;
	width: 100%;
}

.sm-feedback-counter {
	color: var(--sm-text-muted);
	font-size: 11px;
	margin: 2px 0 8px;
	text-align: right;
}

.sm-feedback-error {
	background: var(--sm-error-bg);
	border: 1px solid var(--sm-error-border);
	border-radius: 8px;
	font-size: 13px;
	margin-bottom: 8px;
	padding: 8px 10px;
}

.sm-feedback-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sm-feedback-actions .sm-feedback-submit {
	margin-top: 0;
}

.sm-feedback-submit:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.sm-feedback-skip {
	opacity: 0.8;
}

/* ------------------------------------------------------------------
 * Suggested questions (FAQs)
 * The panel sits in the blank space above the message box: because
 * .sm-log is a flex column, margin-top:auto pushes it to the bottom of
 * a short chat and lets it follow the last message in a long one.
 * ---------------------------------------------------------------- */
.sm-faq-panel {
	margin-top: auto;
	padding-top: 6px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sm-faq-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.sm-faq-title {
	min-width: 0;
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--sm-text-muted);
}

.sm-faq-nav {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.sm-faq-pageno {
	font-size: 12px;
	color: var(--sm-text-muted);
	min-width: 28px;
	text-align: center;
}

.sm-faq-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid var(--sm-border);
	border-radius: 50%;
	background: var(--sm-surface);
	color: var(--sm-primary);
	cursor: pointer;
}

.sm-faq-iconbtn:hover:not(:disabled) {
	background: color-mix(in srgb, var(--sm-primary) 10%, var(--sm-surface));
}

.sm-faq-iconbtn:disabled {
	opacity: 0.5;
	cursor: default;
}

.sm-faq-iconbtn:focus-visible,
.sm-faq-item:focus-visible,
.sm-faq-toggle:focus-visible {
	outline: 2px solid var(--sm-primary);
	outline-offset: 2px;
}

.sm-faq-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sm-faq-item {
	width: 100%;
	text-align: left;
	padding: 10px 12px;
	font: inherit;
	font-size: 13px;
	line-height: 1.35;
	color: var(--sm-text);
	background: var(--sm-surface);
	border: 1px solid var(--sm-border);
	border-radius: 12px;
	cursor: pointer;
	overflow-wrap: anywhere;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.sm-faq-item:hover {
	border-color: var(--sm-primary);
	background: color-mix(in srgb, var(--sm-primary) 6%, var(--sm-surface));
}

/* The "?" button beside the message box. */
.sm-faq-toggle {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--sm-border);
	border-radius: 50%;
	background: var(--sm-surface);
	color: var(--sm-primary);
	cursor: pointer;
}

.sm-faq-toggle[hidden] {
	display: none;
}

.sm-faq-toggle.is-active {
	background: color-mix(in srgb, var(--sm-primary) 12%, var(--sm-surface));
	border-color: var(--sm-primary);
}

@media (max-width: 767px) {
	.sm-faq-item { font-size: 13.5px; padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.sm-faq-item { transition: none; }
}

/* FAQ search: the field replaces the title; the magnifier sits beside the arrows. */
.sm-faq-tools {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.sm-faq-iconbtn {
	flex: 0 0 auto;
}

.sm-faq-head-search {
	gap: 6px;
}

.sm-faq-search {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	height: 38px;
	padding: 0 12px;
	background: var(--sm-surface);
	/* Same border as the normal message field; it does not change on focus. */
	border: 1px solid var(--sm-border);
	border-radius: 12px;
	color: var(--sm-text-muted);
}

.sm-faq-search-icon {
	display: inline-flex;
	flex: 0 0 auto;
}

.sm-faq-search .sm-faq-search-input,
.sm-faq-search .sm-faq-search-input:focus,
.sm-faq-search .sm-faq-search-input:focus-visible,
.sm-faq-search .sm-faq-search-input:active {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	height: 100%;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	outline-offset: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--sm-text);
	font: inherit;
	font-size: 14px;
	-webkit-appearance: none;
	appearance: none;
}

.sm-faq-search-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.sm-faq-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 30px;
}

.sm-faq-count {
	font-size: 12px;
	color: var(--sm-text-muted);
}

.sm-faq-empty {
	margin: 0;
	padding: 10px 12px;
	font-size: 13px;
	color: var(--sm-text-muted);
	background: var(--sm-surface);
	border: 1px dashed var(--sm-border);
	border-radius: 12px;
}

.sm-faq-list.is-loading {
	opacity: 0.55;
	transition: opacity 0.15s ease;
}
