/**
 * AI Sales Console front-end image character chat widget.
 */

.aisc-chat-widget {
	position: fixed;
	right: 24px;
	bottom: 0;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: #172033;
	display: flex;
	flex-direction: column;
	align-items: center;
}

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

/* =============================================
   STANDING SOPHIE LAUNCHER (replaces pill button)
   ============================================= */

.aisc-launcher {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: pointer;
	user-select: none;
}

/* Hidden state: collapsed */
.aisc-launcher[hidden] {
	display: none;
}

/* Sophie's character image — standing on page bottom */
.aisc-launcher-character {
	position: relative;
	width: 160px;
	height: 280px;
	flex: 0 0 auto;
}

.aisc-launcher-character-wrap {
	position: absolute;
	left: 50%;
	bottom: 0;
	width: 160px;
	height: 280px;
	transform: translateX(-50%);
	transform-origin: 50% 100%;
	animation: aisc-launcher-float 4s ease-in-out infinite;
}

.aisc-launcher-img {
	position: absolute;
	left: 50%;
	bottom: 0;
	display: block;
	width: auto;
	height: 100%;
	max-width: none;
	transform: translateX(-50%);
	filter: drop-shadow(0 16px 18px rgba(15, 23, 42, 0.22));
	pointer-events: none;
	user-select: none;
	object-fit: contain;
}

/* Wave arm — uses the character-image-wrap to tilt */
.aisc-launcher-waving .aisc-launcher-character-wrap {
	animation: aisc-wave 0.5s ease-in-out 3;
}

/* Greeting speech bubble */
.aisc-launcher-bubble {
	position: absolute;
	bottom: 318px;
	right: 0;
	left: auto;
	transform: none;
	width: 360px;
	max-width: min(360px, calc(100vw - 48px));
	white-space: pre-line;
	text-align: left;
	padding: 10px 16px;
	border-radius: 20px 20px 4px 20px;
	background: #ffffff;
	border: 1px solid rgba(37, 99, 235, 0.18);
	box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
	font-size: 13px;
	font-weight: 700;
	color: #172033;
	line-height: 1.4;
	opacity: 0;
	pointer-events: none;
	z-index: 3;
	animation: aisc-bubble-appear 0.4s ease-out 1.2s both;
}

.aisc-launcher-bubble::after {
	content: "";
	position: absolute;
	bottom: -8px;
	right: 52px;
	left: auto;
	width: 16px;
	height: 16px;
	background: #ffffff;
	border-right: 1px solid rgba(37, 99, 235, 0.18);
	border-bottom: 1px solid rgba(37, 99, 235, 0.18);
	transform: rotate(45deg);
}

/* Click-to-chat CTA label */
.aisc-launcher-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: -4px;
	padding: 7px 14px;
	border-radius: 999px;
	background: linear-gradient(135deg, #13213f 0%, #2563eb 100%);
	color: #ffffff;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.01em;
	box-shadow: 0 8px 22px rgba(17, 24, 39, 0.22);
	cursor: pointer;
	border: 0;
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
	line-height: 1;
	white-space: nowrap;
}

.aisc-launcher-cta:hover,
.aisc-launcher-cta:focus {
	filter: brightness(1.08);
	transform: translateY(-2px);
	box-shadow: 0 14px 32px rgba(17, 24, 39, 0.3);
	outline: none;
}

/* Minimise X button — top-right of Sophie */
.aisc-launcher-minimize {
	position: absolute;
	top: 0;
	right: -4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 999px;
	border: 2px solid #ffffff;
	background: #6b7280;
	color: #ffffff;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
	transition: background 0.15s ease, transform 0.15s ease;
	z-index: 2;
}

.aisc-launcher-minimize:hover,
.aisc-launcher-minimize:focus {
	background: #374151;
	transform: scale(1.1);
	outline: none;
}

/* Shadow under Sophie's feet */
.aisc-launcher-shadow {
	width: 90px;
	height: 12px;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.12);
	filter: blur(4px);
	margin-top: -6px;
	flex: 0 0 auto;
}

/* Minimised restore pill (shows when Sophie is hidden) */
.aisc-restore-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
	padding: 9px 16px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, #13213f 0%, #2563eb 100%);
	color: #ffffff;
	font-size: 13px;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(17, 24, 39, 0.24);
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
	line-height: 1;
}

.aisc-restore-btn[hidden] {
	display: none;
}

.aisc-restore-btn:hover,
.aisc-restore-btn:focus {
	filter: brightness(1.06);
	transform: translateY(-2px);
	outline: none;
}

/* =============================================
   CHAT PANEL
   ============================================= */

.aisc-chat-panel {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 740px;
	max-width: calc(100vw - 32px);
	height: 610px;
	max-height: calc(100vh - 116px);
	overflow: hidden;
	border: 1px solid rgba(37, 99, 235, 0.12);
	border-radius: 30px;
	background: #ffffff;
	box-shadow: 0 34px 95px rgba(15, 23, 42, 0.24);
}

.aisc-chat-panel[hidden] {
	display: none;
}

/* Hide the closed launcher while the full chat panel is open.
   The .aisc-chat-open class is the mobile-safe fallback; :has() is kept for browsers that support it. */
.aisc-chat-widget.aisc-chat-open .aisc-launcher,
.aisc-chat-widget:has(.aisc-chat-panel:not([hidden])) .aisc-launcher {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.aisc-chat-panel-opening .aisc-chat-panel {
	animation: aisc-panel-pop 0.42s ease-out both;
}

.aisc-chat-scene,
.aisc-chat-stage {
	width: 100%;
	height: 100%;
}

.aisc-chat-stage {
	display: flex;
	flex-direction: column;
	background:
		radial-gradient(circle at 16% 18%, rgba(96, 165, 250, 0.18) 0, rgba(96, 165, 250, 0) 30%),
		radial-gradient(circle at 88% 12%, rgba(236, 72, 153, 0.08) 0, rgba(236, 72, 153, 0) 24%),
		linear-gradient(180deg, #f9fbff 0%, #eef4ff 100%);
}

.aisc-chat-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 18px;
	background: linear-gradient(135deg, #13213f 0%, #1d4ed8 100%);
	color: #ffffff;
}

.aisc-chat-header-text {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.aisc-chat-title {
	display: block;
	margin: 0;
	font-size: 17px;
	font-weight: 900;
	line-height: 1.2;
	color: #ffffff;
}

.aisc-chat-role {
	display: block;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	color: rgba(255, 255, 255, 0.78);
}

.aisc-chat-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	color: #ffffff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.aisc-chat-close:hover,
.aisc-chat-close:focus {
	background: rgba(255, 255, 255, 0.23);
	border-color: rgba(255, 255, 255, 0.35);
	transform: rotate(4deg);
	outline: none;
}

.aisc-chat-scene-body {
	position: relative;
	flex: 1;
	display: grid;
	grid-template-columns: 270px minmax(0, 1fr);
	gap: 16px;
	min-height: 0;
	padding: 18px;
}

.aisc-chat-character-side {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	min-height: 0;
	padding-top: 18px;
}

.aisc-chat-bubbles-side {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	min-height: 0;
	overflow: visible;
}

/**
 * Image character (inside open panel).
 */

.aisc-character {
	position: relative;
	width: 238px;
	height: 414px;
	flex: 0 0 auto;
}

.aisc-character-glow {
	position: absolute;
	left: 50%;
	top: 42px;
	width: 194px;
	height: 294px;
	border-radius: 999px;
	background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0, rgba(37, 99, 235, 0) 70%);
	transform: translateX(-50%);
	pointer-events: none;
}

.aisc-character-image-wrap {
	position: absolute;
	left: 50%;
	bottom: 8px;
	width: 238px;
	height: 414px;
	transform: translateX(-50%);
	transform-origin: 50% 100%;
	animation: aisc-character-idle 4s ease-in-out infinite;
}

.aisc-character-image {
	position: absolute;
	left: 50%;
	bottom: 0;
	display: block;
	width: auto;
	height: 100%;
	max-width: none;
	transform: translateX(-50%);
	filter: drop-shadow(0 20px 18px rgba(15, 23, 42, 0.18));
	transition: opacity 0.1s linear;
	pointer-events: none;
	user-select: none;
	object-fit: contain;
}

.aisc-character-image-idle {
	opacity: 1;
}

.aisc-character-image-talking {
	opacity: 0;
}

.aisc-chat-speaking .aisc-character-image-wrap {
	animation: none;
	transform: translateX(-50%);
}

.aisc-chat-speaking .aisc-character-image {
	transition: none;
}

.aisc-chat-speaking .aisc-character-image-idle {
	opacity: 1;
	animation: aisc-mouth-closed-frame 0.34s steps(1, end) infinite;
}

.aisc-chat-speaking .aisc-character-image-talking {
	opacity: 0;
	animation: aisc-mouth-open-frame 0.34s steps(1, end) infinite;
}

.aisc-chat-talk-frame-two .aisc-character-image-wrap {
	transform: translateX(-50%);
}

.aisc-character-speaking-dots {
	position: absolute;
	left: 48px;
	top: 72px;
	display: flex;
	gap: 5px;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.aisc-character-speaking-dots span {
	display: block;
	width: 7px;
	height: 7px;
	border-radius: 999px;
	background: #2563eb;
	box-shadow: 0 5px 12px rgba(37, 99, 235, 0.22);
	animation: aisc-speaking-dot 0.8s ease-in-out infinite;
}

.aisc-character-speaking-dots span:nth-child(2) {
	animation-delay: 0.12s;
}

.aisc-character-speaking-dots span:nth-child(3) {
	animation-delay: 0.24s;
}

.aisc-chat-speaking .aisc-character-speaking-dots {
	opacity: 1;
	transform: translateY(0);
}

.aisc-character-shadow {
	position: absolute;
	left: 50%;
	bottom: 4px;
	width: 136px;
	height: 18px;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.14);
	filter: blur(3px);
	transform: translateX(-50%);
}

.aisc-chat-character-label {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	width: 150px;
	margin-top: 2px;
	padding: 10px 10px 9px;
	border: 1px solid rgba(37, 99, 235, 0.12);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.88);
	box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
	backdrop-filter: blur(8px);
}

.aisc-chat-character-name {
	font-size: 13px;
	font-weight: 900;
	line-height: 1.1;
	color: #111827;
}

.aisc-chat-character-status {
	font-size: 11px;
	font-weight: 700;
	line-height: 1.1;
	color: #2563eb;
}

/**
 * Assistant bubble.
 */

.aisc-chat-assistant-bubble-wrap {
	position: relative;
	flex: 1;
	min-height: 0;
}

.aisc-chat-assistant-pointer {
	position: absolute;
	left: -12px;
	top: 56px;
	width: 30px;
	height: 30px;
	background: #ffffff;
	border-left: 1px solid rgba(37, 99, 235, 0.12);
	border-bottom: 1px solid rgba(37, 99, 235, 0.12);
	transform: rotate(45deg);
	z-index: 1;
}

.aisc-chat-assistant-bubble {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 270px;
	max-height: 365px;
	overflow: hidden;
	border: 1px solid rgba(37, 99, 235, 0.12);
	border-radius: 28px;
	background: #ffffff;
	box-shadow: 0 18px 44px rgba(15, 23, 42, 0.11);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aisc-chat-speaking .aisc-chat-assistant-bubble {
	box-shadow: 0 22px 54px rgba(37, 99, 235, 0.16);
	transform: translateY(-1px);
}

.aisc-chat-messages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 18px;
	overflow-y: auto;
	scroll-behavior: smooth;
}

.aisc-chat-message-row {
	display: flex;
	width: 100%;
}

.aisc-chat-message-new {
	animation: aisc-message-in 0.32s ease-out both;
}

.aisc-chat-message-row-assistant {
	justify-content: flex-start;
}

.aisc-chat-message-row-user {
	justify-content: flex-end;
}

.aisc-chat-message-stack {
	display: flex;
	flex-direction: column;
	gap: 5px;
	max-width: 90%;
}

.aisc-chat-message-row-user .aisc-chat-message-stack {
	align-items: flex-end;
}

.aisc-chat-message-name {
	display: inline-block;
	padding-left: 3px;
	font-size: 11px;
	font-weight: 900;
	line-height: 1.2;
	color: #2563eb;
}

.aisc-chat-message-row-user .aisc-chat-message-name {
	padding-right: 3px;
	padding-left: 0;
	color: #c2410c;
}

.aisc-chat-message {
	width: fit-content;
	max-width: 100%;
	padding: 12px 14px;
	border-radius: 18px;
	font-size: 14px;
	line-height: 1.55;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.aisc-chat-message-assistant {
	border-bottom-left-radius: 7px;
	background: #f8fbff;
	color: #172033;
	border: 1px solid rgba(37, 99, 235, 0.1);
}

.aisc-chat-message-user {
	border-bottom-right-radius: 7px;
	background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
	color: #ffffff;
}

.aisc-chat-message a,
.aisc-chat-message .aisc-chat-link {
	color: #1d4ed8;
	font-weight: 800;
	text-decoration: underline;
	text-underline-offset: 3px;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.aisc-chat-message a:hover,
.aisc-chat-message a:focus,
.aisc-chat-message .aisc-chat-link:hover,
.aisc-chat-message .aisc-chat-link:focus {
	color: #0f172a;
	text-decoration-thickness: 2px;
}

.aisc-chat-message-user a,
.aisc-chat-message-user .aisc-chat-link {
	color: #ffffff;
	text-decoration-color: rgba(255, 255, 255, 0.78);
}

/**
 * Customer bubble.
 */

.aisc-chat-customer-bubble-wrap {
	position: relative;
	flex: 0 0 auto;
}

.aisc-chat-customer-pointer {
	position: absolute;
	right: 34px;
	bottom: -8px;
	width: 22px;
	height: 22px;
	background: #fff7ed;
	border-right: 1px solid rgba(249, 115, 22, 0.16);
	border-bottom: 1px solid rgba(249, 115, 22, 0.16);
	transform: rotate(45deg);
	z-index: 1;
}

.aisc-chat-form {
	position: relative;
	z-index: 2;
	margin: 0;
}

.aisc-chat-customer-bubble {
	padding: 13px;
	border: 1px solid rgba(249, 115, 22, 0.18);
	border-radius: 24px;
	background: #fff7ed;
	box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.aisc-chat-customer-turn .aisc-chat-customer-bubble {
	border-color: rgba(249, 115, 22, 0.36);
	box-shadow: 0 18px 42px rgba(249, 115, 22, 0.14);
	transform: translateY(-1px);
}

.aisc-chat-customer-heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.aisc-chat-customer-name {
	font-size: 12px;
	font-weight: 900;
	line-height: 1.2;
	color: #9a3412;
}

.aisc-chat-customer-prompt {
	font-size: 11px;
	font-weight: 800;
	line-height: 1.2;
	color: #c2410c;
}

.aisc-chat-input {
	display: block;
	width: 100%;
	min-height: 54px;
	max-height: 180px;
	margin: 0;
	padding: 12px 13px;
	resize: none;
	border: 1px solid rgba(249, 115, 22, 0.24);
	border-radius: 17px;
	background: #ffffff;
	color: #172033;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.45;
	box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.aisc-chat-input:focus {
	border-color: #f97316;
	box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.13);
	outline: none;
}

.aisc-chat-input:disabled {
	background: #f3f4f6;
	color: #6b7280;
	cursor: not-allowed;
}

.aisc-chat-form-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 9px;
}

.aisc-chat-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 10px 16px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
	color: #ffffff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 900;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 12px 24px rgba(249, 115, 22, 0.22);
	transition: filter 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.aisc-chat-send:hover,
.aisc-chat-send:focus {
	filter: brightness(1.04);
	transform: translateY(-1px);
	box-shadow: 0 16px 30px rgba(249, 115, 22, 0.28);
	outline: none;
}

.aisc-chat-send:disabled {
	background: #cbd5e1;
	box-shadow: none;
	transform: none;
	cursor: not-allowed;
	filter: none;
}

.aisc-chat-widget .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/**
 * Animations.
 */

@keyframes aisc-panel-pop {
	0% {
		opacity: 0;
		transform: translateY(10px) scale(0.98);
	}

	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Sophie launcher float */
@keyframes aisc-launcher-float {
	0%, 100% {
		transform: translateX(-50%) translateY(0);
	}
	50% {
		transform: translateX(-50%) translateY(-6px);
	}
}

/* Wave animation — rotates around bottom-centre */
@keyframes aisc-wave {
	0%   { transform: translateX(-50%) rotate(0deg); }
	25%  { transform: translateX(-50%) rotate(8deg); }
	75%  { transform: translateX(-50%) rotate(-5deg); }
	100% { transform: translateX(-50%) rotate(0deg); }
}

/* Bubble pop-in */
@keyframes aisc-bubble-appear {
	0% {
		opacity: 0;
		transform: translateY(6px) scale(0.95);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes aisc-character-idle {
	0%, 100% {
		transform: translateX(-50%) translateY(0) rotate(0deg) scale(1);
	}
	50% {
		transform: translateX(-50%) translateY(-3px) rotate(-0.25deg) scale(1.001);
	}
}

@keyframes aisc-mouth-closed-frame {
	0%, 44% {
		opacity: 1;
	}
	45%, 100% {
		opacity: 0;
	}
}

@keyframes aisc-mouth-open-frame {
	0%, 44% {
		opacity: 0;
	}
	45%, 100% {
		opacity: 1;
	}
}

@keyframes aisc-speaking-dot {
	0%, 100% {
		transform: translateY(0);
		opacity: 0.45;
	}
	50% {
		transform: translateY(-5px);
		opacity: 1;
	}
}

@keyframes aisc-message-in {
	0% {
		opacity: 0;
		transform: translateY(7px) scale(0.98);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/**
 * Responsive.
 */

@media (max-width: 760px) {
	.aisc-chat-widget {
		right: 12px;
		bottom: 0;
		left: auto;
	}

	.aisc-chat-widget.aisc-chat-open .aisc-launcher {
		display: none;
	}

	.aisc-launcher-character {
		width: 120px;
		height: 210px;
	}

	.aisc-launcher-character-wrap {
		width: 120px;
		height: 210px;
	}

	.aisc-launcher-bubble {
		bottom: 244px;
		right: -4px;
		width: 300px;
		max-width: min(300px, calc(100vw - 32px));
		font-size: 12px;
	}

	.aisc-chat-panel {
		position: fixed;
		right: 8px;
		left: 8px;
		bottom: max(8px, env(safe-area-inset-bottom));
		width: auto;
		height: calc(100vh - 16px);
		height: calc(100dvh - 16px);
		max-width: none;
		max-height: none;
		border-radius: 24px;
	}

	.aisc-chat-scene-body {
		grid-template-columns: 200px minmax(0, 1fr);
		gap: 12px;
		min-height: 0;
		padding: 14px;
	}

	.aisc-chat-bubbles-side,
	.aisc-chat-assistant-bubble-wrap {
		height: 100%;
		min-height: 0;
	}

	.aisc-character {
		width: 184px;
		height: 342px;
	}

	.aisc-character-image-wrap {
		width: 184px;
		height: 342px;
	}

	.aisc-chat-character-label {
		width: 132px;
		padding: 8px;
	}

	.aisc-chat-assistant-bubble {
		height: 100%;
		min-height: 0;
		max-height: none;
	}

	.aisc-chat-messages {
		padding: 14px;
	}

	.aisc-chat-message {
		font-size: 13px;
	}

	.aisc-chat-customer-bubble {
		padding: 11px;
	}

	.aisc-chat-input {
		min-height: 46px;
		max-height: 96px;
	}
}

@media (max-width: 520px) {
	.aisc-chat-panel {
		right: 6px;
		left: 6px;
		bottom: max(6px, env(safe-area-inset-bottom));
		height: calc(100vh - 12px);
		height: calc(100dvh - 12px);
		border-radius: 20px;
	}

	.aisc-chat-header {
		padding: 12px 14px;
	}

	.aisc-chat-scene-body {
		grid-template-columns: 1fr;
		grid-template-rows: minmax(0, 1fr);
		gap: 10px;
		padding: 10px;
	}

	.aisc-chat-character-side {
		display: none;
	}

	.aisc-chat-assistant-pointer {
		display: none;
	}

	.aisc-chat-assistant-bubble {
		height: 100%;
		min-height: 0;
		max-height: none;
	}

	.aisc-launcher-bubble {
		right: 0;
		left: auto;
		width: min(280px, calc(100vw - 24px));
		max-width: min(280px, calc(100vw - 24px));
		white-space: pre-line;
		text-align: left;
	}
}



@media (max-height: 560px) and (max-width: 960px) {
	.aisc-chat-widget {
		right: 0;
		bottom: 0;
		left: 0;
		align-items: stretch;
	}

	.aisc-chat-widget.aisc-chat-open .aisc-launcher {
		display: none;
	}

	.aisc-chat-panel {
		position: fixed;
		top: max(6px, env(safe-area-inset-top));
		right: 6px;
		bottom: max(6px, env(safe-area-inset-bottom));
		left: 6px;
		width: auto;
		height: auto;
		max-width: none;
		max-height: none;
		border-radius: 18px;
	}

	.aisc-chat-header {
		padding: 9px 12px;
	}

	.aisc-chat-title {
		font-size: 15px;
	}

	.aisc-chat-role {
		font-size: 11px;
	}

	.aisc-chat-close {
		width: 34px;
		height: 34px;
	}

	.aisc-chat-scene-body {
		grid-template-columns: 1fr;
		grid-template-rows: minmax(0, 1fr);
		gap: 8px;
		min-height: 0;
		padding: 8px;
	}

	.aisc-chat-character-side,
	.aisc-chat-assistant-pointer,
	.aisc-chat-customer-pointer {
		display: none;
	}

	.aisc-chat-bubbles-side,
	.aisc-chat-assistant-bubble-wrap {
		height: 100%;
		min-height: 0;
	}

	.aisc-chat-assistant-bubble {
		height: 100%;
		min-height: 0;
		max-height: none;
		border-radius: 18px;
	}

	.aisc-chat-messages {
		gap: 8px;
		padding: 10px;
	}

	.aisc-chat-message {
		padding: 9px 11px;
		font-size: 13px;
		line-height: 1.42;
	}

	.aisc-chat-customer-bubble {
		padding: 8px;
		border-radius: 18px;
	}

	.aisc-chat-customer-heading {
		margin-bottom: 5px;
	}

	.aisc-chat-input {
		min-height: 38px;
		max-height: 72px;
		padding: 8px 10px;
		font-size: 13px;
	}

	.aisc-chat-form-actions {
		margin-top: 6px;
	}

	.aisc-chat-send {
		min-height: 32px;
		padding: 8px 12px;
		font-size: 12px;
	}

	.aisc-chat-quick-actions {
		gap: 5px;
		margin-top: 6px;
	}

	.aisc-chat-quick-action {
		min-height: 28px;
		padding: 5px 8px;
		font-size: 10.5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aisc-chat-close,
	.aisc-chat-send,
	.aisc-chat-customer-bubble,
	.aisc-chat-assistant-bubble,
	.aisc-character-image,
	.aisc-launcher-cta {
		transition: none;
	}

	.aisc-launcher-character-wrap,
	.aisc-character-image-wrap,
	.aisc-character-speaking-dots span,
	.aisc-chat-message-new,
	.aisc-chat-panel-opening .aisc-chat-panel,
	.aisc-chat-speaking .aisc-character-image-idle,
	.aisc-chat-speaking .aisc-character-image-talking,
	.aisc-launcher-bubble {
		animation: none;
		opacity: 1;
	}

	.aisc-chat-messages {
		scroll-behavior: auto;
	}
}

/**
 * Firefox layout correction.
 */
@-moz-document url-prefix() {
	.aisc-chat-panel {
		height: 590px;
		max-height: calc(100vh - 128px);
	}

	.aisc-chat-scene-body {
		grid-template-columns: 250px minmax(0, 1fr);
		gap: 14px;
		padding: 16px;
	}

	.aisc-chat-character-side {
		padding-top: 34px;
	}

	.aisc-character {
		width: 218px;
		height: 382px;
	}

	.aisc-character-image-wrap {
		width: 218px;
		height: 382px;
	}

	.aisc-character-glow {
		width: 178px;
		height: 272px;
	}

	.aisc-chat-character-label {
		margin-top: 0;
	}

	.aisc-chat-assistant-bubble {
		max-height: 382px;
	}

	.aisc-chat-messages {
		scrollbar-gutter: stable;
	}
}

/**
 * Quick action buttons inside Sophie message area.
 */
.aisc-chat-quick-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 8px;
	max-width: 100%;
	margin-top: 8px;
	padding-bottom: 2px;
}

.aisc-chat-quick-action {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	max-width: 100%;
	padding: 8px 12px;
	border: 1px solid rgba(37, 99, 235, 0.26);
	border-radius: 999px;
	background: linear-gradient(135deg, #183572 0%, #2451d8 100%);
	box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
	color: #ffffff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 900;
	line-height: 1.2;
	text-align: center;
	text-transform: none;
	white-space: normal;
	cursor: pointer;
	transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.aisc-chat-quick-action:hover,
.aisc-chat-quick-action:focus {
	box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
	filter: brightness(1.04);
	outline: none;
	transform: translateY(-1px);
}

.aisc-chat-quick-action:active {
	box-shadow: 0 5px 14px rgba(37, 99, 235, 0.2);
	transform: translateY(0);
}

.aisc-chat-form-busy ~ .aisc-chat-quick-actions,
.aisc-chat-quick-action:disabled {
	cursor: not-allowed;
	opacity: 0.68;
}

@media (max-width: 640px) {
	.aisc-chat-quick-actions {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 6px;
	}

	.aisc-chat-quick-action {
		min-height: 32px;
		padding: 7px 10px;
		font-size: 11px;
	}
}


/* =============================================
   SOPHIE LAUNCHER ENTRANCE V4 — raised position hotfix
   Keep this block last so theme/WooCommerce image CSS cannot override Sophie.
   ============================================= */
.aisc-chat-widget {
	right: 22px;
	bottom: max(14px, env(safe-area-inset-bottom));
}

.aisc-chat-widget:not(.aisc-chat-open) {
	bottom: calc(86px + env(safe-area-inset-bottom));
}

.aisc-chat-widget.aisc-chat-open {
	bottom: max(14px, env(safe-area-inset-bottom));
}

.aisc-chat-widget .aisc-launcher {
	z-index: 2;
	transform-origin: 50% 100%;
}

.aisc-chat-widget .aisc-launcher-character {
	width: 150px !important;
	height: 270px !important;
	max-width: 150px !important;
	max-height: 270px !important;
}

.aisc-chat-widget .aisc-launcher-character-wrap {
	width: 150px !important;
	height: 270px !important;
	max-width: 150px !important;
	max-height: 270px !important;
	transition: transform 0.22s ease, filter 0.22s ease;
}

.aisc-chat-widget .aisc-launcher-img {
	display: block !important;
	width: auto !important;
	height: 100% !important;
	max-width: none !important;
	max-height: 100% !important;
	object-fit: contain !important;
	transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.aisc-chat-widget .aisc-sophie-frame-pop {
	transform: translateX(-50%) translateY(-5px) scale(1.035) !important;
	filter: drop-shadow(0 18px 24px rgba(15, 23, 42, 0.27));
}

.aisc-chat-widget .aisc-launcher-waving .aisc-launcher-character-wrap {
	animation: aisc-launcher-float 4s ease-in-out infinite;
}

.aisc-chat-widget .aisc-launcher-entrance-v3 .aisc-launcher-character-wrap {
	animation: aisc-sophie-arrive-v3 0.9s cubic-bezier(0.2, 0.95, 0.22, 1.12) both, aisc-launcher-float 4s ease-in-out 0.9s infinite;
}

.aisc-chat-widget .aisc-launcher-bubble {
	bottom: 320px;
	right: 4px;
	width: 326px;
	max-width: min(326px, calc(100vw - 44px));
	padding: 12px 15px;
	border-radius: 22px 22px 6px 22px;
	font-size: 12.5px;
	line-height: 1.42;
	box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
	animation: aisc-sophie-bubble-v3 0.42s ease-out 0.82s both;
}

.aisc-chat-widget .aisc-launcher-bubble::after {
	right: 44px;
}

.aisc-chat-widget .aisc-launcher-cta {
	position: relative;
	z-index: 5;
	min-height: 36px;
	margin-top: 2px;
	padding: 10px 18px;
	font-size: 13px;
	font-weight: 900;
	box-shadow: 0 12px 28px rgba(17, 24, 39, 0.27), 0 0 0 1px rgba(255, 255, 255, 0.24) inset;
}

.aisc-chat-widget .aisc-launcher-presenting .aisc-launcher-cta,
.aisc-chat-widget .aisc-launcher-cta:hover,
.aisc-chat-widget .aisc-launcher-cta:focus {
	animation: aisc-sophie-cta-pulse-v3 0.72s ease-out both;
}

.aisc-chat-widget .aisc-launcher-shadow {
	width: 92px;
	height: 13px;
	margin-top: -3px;
}

@keyframes aisc-sophie-arrive-v3 {
	0% {
		opacity: 0;
		transform: translateX(-50%) translateY(28px) scale(0.86);
	}
	58% {
		opacity: 1;
		transform: translateX(-50%) translateY(-8px) scale(1.045);
	}
	100% {
		opacity: 1;
		transform: translateX(-50%) translateY(0) scale(1);
	}
}

@keyframes aisc-sophie-bubble-v3 {
	0% {
		opacity: 0;
		transform: translateY(10px) scale(0.92);
	}
	70% {
		opacity: 1;
		transform: translateY(-2px) scale(1.015);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes aisc-sophie-cta-pulse-v3 {
	0% {
		transform: translateY(0) scale(1);
		box-shadow: 0 12px 28px rgba(17, 24, 39, 0.27), 0 0 0 0 rgba(37, 99, 235, 0.38);
	}
	45% {
		transform: translateY(-2px) scale(1.06);
		box-shadow: 0 18px 38px rgba(17, 24, 39, 0.32), 0 0 0 10px rgba(37, 99, 235, 0);
	}
	100% {
		transform: translateY(0) scale(1);
		box-shadow: 0 12px 28px rgba(17, 24, 39, 0.27), 0 0 0 0 rgba(37, 99, 235, 0);
	}
}

@media (max-width: 760px) {
	.aisc-chat-widget {
		right: 10px;
		bottom: max(10px, env(safe-area-inset-bottom));
	}

	.aisc-chat-widget:not(.aisc-chat-open) {
		bottom: calc(74px + env(safe-area-inset-bottom));
	}

	.aisc-chat-widget.aisc-chat-open {
		bottom: max(10px, env(safe-area-inset-bottom));
	}

	.aisc-chat-widget .aisc-launcher-character {
		width: 116px !important;
		height: 205px !important;
		max-width: 116px !important;
		max-height: 205px !important;
	}

	.aisc-chat-widget .aisc-launcher-character-wrap {
		width: 116px !important;
		height: 205px !important;
		max-width: 116px !important;
		max-height: 205px !important;
	}

	.aisc-chat-widget .aisc-launcher-bubble {
		bottom: 250px;
		right: 0;
		width: min(282px, calc(100vw - 24px));
		max-width: min(282px, calc(100vw - 24px));
		font-size: 12px;
		padding: 10px 13px;
	}

	.aisc-chat-widget .aisc-launcher-cta {
		min-height: 34px;
		padding: 9px 16px;
		font-size: 12px;
	}
}

@media (max-height: 560px) and (max-width: 960px) {
	.aisc-chat-widget:not(.aisc-chat-open) {
		right: 10px;
		bottom: calc(48px + env(safe-area-inset-bottom));
		left: auto;
		align-items: center;
	}

	.aisc-chat-widget:not(.aisc-chat-open) .aisc-launcher-character {
		width: 86px !important;
		height: 152px !important;
		max-width: 86px !important;
		max-height: 152px !important;
	}

	.aisc-chat-widget:not(.aisc-chat-open) .aisc-launcher-character-wrap {
		width: 86px !important;
		height: 152px !important;
		max-width: 86px !important;
		max-height: 152px !important;
	}

	.aisc-chat-widget:not(.aisc-chat-open) .aisc-launcher-bubble {
		display: none;
	}

	.aisc-chat-widget:not(.aisc-chat-open) .aisc-launcher-cta {
		min-height: 32px;
		padding: 8px 13px;
		font-size: 11px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aisc-chat-widget .aisc-launcher-entrance-v3 .aisc-launcher-character-wrap,
	.aisc-chat-widget .aisc-launcher-presenting .aisc-launcher-cta {
		animation: none;
	}
}

/* =============================================
   Widget Designer wired desktop settings
   ============================================= */
.aisc-chat-widget {
	--aisc-primary-color: #2563eb;
	--aisc-accent-color: #111827;
}

.aisc-chat-delay-hidden {
	opacity: 0;
	pointer-events: none;
	visibility: hidden;
}

.aisc-chat-delay-revealed {
	opacity: 1;
	visibility: visible;
}

.aisc-chat-widget .aisc-launcher-cta,
.aisc-chat-widget .aisc-restore-btn,
.aisc-chat-widget .aisc-chat-header {
	background: linear-gradient(135deg, var(--aisc-accent-color) 0%, var(--aisc-primary-color) 100%);
}

.aisc-chat-widget .aisc-chat-send {
	background: linear-gradient(135deg, var(--aisc-primary-color) 0%, var(--aisc-accent-color) 100%);
	box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
}

.aisc-chat-widget .aisc-character-speaking-dots span {
	background-color: var(--aisc-primary-color);
}

.aisc-chat-widget .aisc-chat-character-status {
	color: var(--aisc-primary-color);
}

@media (min-width: 769px) {
	.aisc-chat-widget.aisc-chat-position-bottom-right {
		top: auto;
		right: 22px;
		bottom: max(14px, env(safe-area-inset-bottom));
		left: auto;
		align-items: center;
	}

	.aisc-chat-widget.aisc-chat-position-bottom-right:not(.aisc-chat-open) {
		bottom: calc(86px + env(safe-area-inset-bottom));
	}

	.aisc-chat-widget.aisc-chat-position-bottom-left {
		top: auto;
		right: auto;
		bottom: max(14px, env(safe-area-inset-bottom));
		left: 22px;
		align-items: center;
	}

	.aisc-chat-widget.aisc-chat-position-bottom-left:not(.aisc-chat-open) {
		bottom: calc(86px + env(safe-area-inset-bottom));
	}

	.aisc-chat-widget.aisc-chat-position-top-right {
		top: 22px;
		right: 22px;
		bottom: auto;
		left: auto;
		align-items: center;
	}

	.aisc-chat-widget.aisc-chat-position-top-left {
		top: 22px;
		right: auto;
		bottom: auto;
		left: 22px;
		align-items: center;
	}

	.aisc-chat-widget.aisc-chat-position-bottom-left .aisc-chat-panel,
	.aisc-chat-widget.aisc-chat-position-top-left .aisc-chat-panel {
		right: auto;
		left: 0;
	}

	.aisc-chat-widget.aisc-chat-position-bottom-right .aisc-chat-panel,
	.aisc-chat-widget.aisc-chat-position-top-right .aisc-chat-panel {
		right: 0;
		left: auto;
	}

	.aisc-chat-widget.aisc-chat-position-top-left .aisc-chat-panel,
	.aisc-chat-widget.aisc-chat-position-top-right .aisc-chat-panel {
		top: 72px;
		bottom: auto;
	}
}

/* SiteSellerAI future-console presentation skin. Widget logic and configured colours remain unchanged. */
.aisc-chat-widget {
	color: #eaf5ff;
}

.aisc-launcher-bubble {
	border-color: rgba(96, 193, 255, 0.48);
	background: linear-gradient(135deg, rgba(37, 43, 101, 0.97), rgba(13, 48, 83, 0.97));
	box-shadow: 0 16px 42px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.13), 0 0 22px rgba(68, 142, 255, 0.16);
	color: #eff8ff;
}

.aisc-launcher-bubble::after {
	border-right-color: rgba(96, 193, 255, 0.48);
	border-bottom-color: rgba(96, 193, 255, 0.48);
	background: #203c75;
}

.aisc-launcher-cta,
.aisc-restore-btn {
	border: 1px solid rgba(89, 210, 255, 0.56);
	background: linear-gradient(110deg, #623ee7 0%, #176fb7 58%, #16bceb 100%);
	box-shadow: 0 10px 28px rgba(35, 94, 226, 0.36), inset 0 1px 0 rgba(255,255,255,0.22);
}

.aisc-launcher-minimize {
	border-color: rgba(172, 228, 255, 0.92);
	background: #213d72;
	box-shadow: 0 5px 13px rgba(0,0,0,0.3);
}

.aisc-launcher-minimize:hover,
.aisc-launcher-minimize:focus {
	background: #5040bb;
}

.aisc-launcher-shadow {
	background: rgba(76, 137, 255, 0.27);
}

.aisc-chat-panel {
	border-color: rgba(86, 202, 255, 0.44);
	background: #061426;
	box-shadow: 0 34px 95px rgba(0,0,0,0.56), 0 0 0 1px rgba(129, 76, 255, 0.16);
}

.aisc-chat-header {
	border-bottom-color: rgba(90, 190, 255, 0.24);
	background:
		radial-gradient(circle at 88% 0%, rgba(53, 223, 255, 0.26), transparent 31%),
		linear-gradient(120deg, #0b1c38 0%, #39247a 52%, #0b5d86 100%);
}

.aisc-chat-header-text,
.aisc-chat-title,
.aisc-chat-role,
.aisc-chat-close {
	color: #f4fbff !important;
}

.aisc-chat-close {
	border-color: rgba(205, 241, 255, 0.38);
	background: rgba(255,255,255,0.12);
}

.aisc-chat-close:hover,
.aisc-chat-close:focus {
	background: rgba(255,255,255,0.22);
}

.aisc-chat-scene-body {
	background:
		radial-gradient(circle at 15% 24%, rgba(56, 204, 255, 0.14), transparent 27%),
		radial-gradient(circle at 87% 8%, rgba(136, 83, 255, 0.16), transparent 25%),
		linear-gradient(180deg, #091a30 0%, #040e1d 100%);
}

.aisc-chat-messages {
	border-color: rgba(112, 190, 247, 0.22);
	background: rgba(3, 15, 30, 0.56);
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.aisc-chat-message-name,
.aisc-chat-character-label,
.aisc-chat-character-status,
.aisc-chat-customer-heading {
	color: #a9c4df !important;
}

.aisc-chat-message-assistant,
.aisc-chat-assistant-bubble {
	border-color: rgba(90, 186, 255, 0.3) !important;
	background: linear-gradient(145deg, rgba(23, 61, 103, 0.9), rgba(13, 31, 62, 0.95)) !important;
	box-shadow: 0 8px 20px rgba(0,0,0,0.2);
	color: #e9f7ff !important;
}

.aisc-chat-customer-bubble,
.aisc-chat-message-user {
	border-color: rgba(161, 111, 255, 0.38) !important;
	background: linear-gradient(115deg, #5c3ed0, #177fb6) !important;
	box-shadow: 0 8px 20px rgba(0,0,0,0.22);
	color: #ffffff !important;
}

.aisc-chat-assistant-pointer { border-top-color: rgba(13, 31, 62, 0.95) !important; }
.aisc-chat-customer-pointer { border-top-color: #2674bc !important; }

.aisc-chat-quick-action {
	border-color: rgba(105, 191, 255, 0.32) !important;
	background: rgba(18, 48, 82, 0.78) !important;
	color: #dff2ff !important;
}

.aisc-chat-quick-action:hover,
.aisc-chat-quick-action:focus {
	border-color: rgba(73, 218, 255, 0.7) !important;
	background: rgba(45, 86, 135, 0.93) !important;
}

.aisc-chat-input {
	border-color: rgba(110, 190, 248, 0.38) !important;
	background: rgba(3, 14, 28, 0.88) !important;
	color: #eef8ff !important;
}

.aisc-chat-input::placeholder { color: #7895b7 !important; }

.aisc-chat-send {
	border: 1px solid rgba(101, 211, 255, 0.5) !important;
	background: linear-gradient(110deg, #633de7, #17aee5) !important;
	box-shadow: 0 9px 22px rgba(41, 102, 239, 0.3);
}

.aisc-character-glow {
	background: radial-gradient(circle, rgba(123, 77, 255, 0.34) 0, rgba(44, 209, 255, 0) 67%);
}

.aisc-character-shadow {
	background: rgba(59, 121, 255, 0.28);
}
