.sras-chat {
	--sras-accent: #4b3cf0;
	--sras-accent-text: #fff;
	--sras-bg: #fff;
	--sras-text: #1d2327;
	--sras-muted: #50575e;
	--sras-border: #c3c4c7;
	--sras-user-bg: #e7f0fa;
	--sras-agent-bg: #f0f0f1;
	--sras-error: #b32d2e;
	--sras-success: #00703c;
	position: fixed;
	inset-block-end: 16px;
	inset-inline-end: 16px;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--sras-text);
}

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

.sras-chat [hidden] {
	display: none !important;
}

.sras-sr-only,
.sras-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sras-chat button,
.sras-chat input,
.sras-chat select,
.sras-chat textarea {
	font: inherit;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
}

.sras-chat button {
	cursor: pointer;
}

.sras-chat :focus-visible {
	outline: 3px solid #f0b849;
	outline-offset: 2px;
}

.sras-chat .sras-chat__toggle,
.sras-chat .sras-chat__send {
	border: 0;
	border-radius: 999px;
	background: var(--sras-accent);
	color: var(--sras-accent-text);
	font-weight: 600;
}

.sras-chat__toggle {
	padding: 12px 18px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.sras-chat__panel {
	display: flex;
	flex-direction: column;
	width: min(440px, calc(100vw - 32px));
	height: min(680px, calc(100dvh - 100px));
	margin-block-end: 10px;
	background: var(--sras-bg);
	border: 1px solid var(--sras-border);
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

.sras-chat .sras-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 14px;
	background: var(--sras-accent);
	color: var(--sras-accent-text);
}

.sras-chat__close {
	min-width: 32px;
	min-height: 32px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit !important;
	font-size: 22px !important;
	line-height: 1;
}

.sras-chat__view {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.sras-chat__log {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	overflow-y: auto;
}

.sras-chat__msg {
	max-width: 88%;
	padding: 8px 12px;
	border-radius: 12px;
	background: var(--sras-agent-bg);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	align-self: flex-start;
}

.sras-chat__msg--user {
	align-self: flex-end;
	background: var(--sras-user-bg);
}

.sras-chat__msg--pending {
	color: var(--sras-muted);
	font-style: italic;
}

.sras-chat__msg--error {
	border: 1px solid var(--sras-error);
	background: #fcf0f1;
}

.sras-chat__msg--success {
	border: 1px solid var(--sras-success);
	background: #edfaef;
}

.sras-chat__source {
	margin-block-start: 6px;
	font-size: 13px;
	color: var(--sras-muted);
	white-space: normal;
}

.sras-chat__source a {
	color: var(--sras-accent);
}

.sras-chat__action,
.sras-form__cancel {
	align-self: flex-start;
	margin-block-start: 4px;
	padding: 4px 10px;
	border: 1px solid var(--sras-accent);
	border-radius: 999px;
	background: transparent;
	color: var(--sras-accent) !important;
	font-size: 13px !important;
	font-weight: 600;
}

/* Actions and chat form */

.sras-chat__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 12px 0;
	border-block-start: 1px solid var(--sras-border);
}

.sras-chat__actions .sras-chat__action {
	margin: 0;
}

.sras-chat__form {
	padding: 10px 12px 12px;
}

.sras-chat__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-block-end: 8px;
	font-size: 13px;
	color: var(--sras-muted);
}

.sras-chat__consent input {
	margin-block-start: 3px;
	flex: none;
}

.sras-chat__row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.sras-chat__input,
.sras-form input[type="text"],
.sras-form input[type="email"],
.sras-form input[type="tel"],
.sras-form input[type="number"],
.sras-form input[type="date"],
.sras-form input[type="time"],
.sras-form select,
.sras-form textarea {
	width: 100%;
	min-width: 0;
	padding: 8px 10px;
	border: 1px solid #8c8f94;
	border-radius: 8px;
	background: #fff;
	color: var(--sras-text);
}

.sras-chat__input {
	flex: 1;
	resize: none;
}

.sras-chat__send {
	padding: 10px 16px;
}

.sras-chat__send:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Enquiry and viewing forms */

.sras-form {
	gap: 10px;
	padding: 12px 14px 14px;
	overflow-y: auto;
}

.sras-form__title {
	margin: 0;
	font-size: 17px;
	line-height: 1.3;
	color: inherit;
}

.sras-form__listing {
	margin: 0;
	font-weight: 600;
}

.sras-form__field,
.sras-form__check,
.sras-form__hint {
	margin: 0;
}

.sras-form__field label {
	display: block;
	margin-block-end: 3px;
	font-size: 14px;
	font-weight: 600;
}

.sras-form__check label {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-size: 13px;
}

.sras-form__check input {
	margin-block-start: 3px;
	flex: none;
}

.sras-form__hint {
	font-size: 13px;
	color: var(--sras-muted);
}

.sras-form__pair {
	display: flex;
	gap: 10px;
}

.sras-form__pair > * {
	flex: 1;
}

.sras-form [aria-invalid="true"] {
	border-color: var(--sras-error) !important;
	box-shadow: 0 0 0 1px var(--sras-error);
}

.sras-form__status:empty {
	display: none;
}

.sras-form__status {
	padding: 8px 10px;
	border-radius: 8px;
	background: var(--sras-agent-bg);
	font-size: 14px;
}

.sras-form__status--error {
	border: 1px solid var(--sras-error);
	background: #fcf0f1;
}

.sras-form__buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.sras-form__buttons .sras-form__cancel {
	margin: 0;
}

@media (max-width: 480px) {
	.sras-chat {
		inset-inline-end: 8px;
		inset-block-end: 8px;
	}
}

/* ===================================================================
   Premium unified assistant (v0.3.3)
   SMASHRE design system: purple / navy / white. Floating ~420px panel,
   fixed header with slide-out drawer, compact auto-growing composer.
   =================================================================== */

.sras-chat {
	--sras-navy: #1b1740;
	--sras-accent2: #7c5cff;
	--sras-radius: 16px;
	--sras-shadow: 0 18px 50px rgba(27, 23, 64, 0.28);
}

/* Launcher */
.sras-chat .sras-chat__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	background: linear-gradient(135deg, var(--sras-accent), var(--sras-accent2));
	box-shadow: var(--sras-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sras-chat .sras-chat__toggle:hover {
	transform: translateY(-1px);
}

.sras-chat__toggle-ico {
	width: 20px;
	height: 20px;
}

.sras-chat--open .sras-chat__toggle {
	display: none;
}

/* Panel */
.sras-chat .sras-chat__panel {
	position: relative;
	width: min(420px, calc(100vw - 32px));
	height: min(860px, calc(100dvh - 48px));
	border: 1px solid rgba(27, 23, 64, 0.12);
	border-radius: var(--sras-radius);
	box-shadow: var(--sras-shadow);
}

.sras-chat__main {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

/* Header */
.sras-chat .sras-chat__header {
	gap: 10px;
	padding: 12px;
	background: linear-gradient(135deg, var(--sras-navy), var(--sras-accent));
}

.sras-chat__brand {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.sras-chat__brandmark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	font-weight: 800;
	font-size: 16px;
	flex: none;
}

.sras-chat__brand-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.sras-chat__brand-text strong {
	overflow: hidden;
	font-size: 15px;
	line-height: 1.2;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.sras-chat__status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	opacity: 0.9;
}

.sras-chat__status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #35d07f;
	animation: sras-pulse 2s infinite;
}

@keyframes sras-pulse {
	0% { box-shadow: 0 0 0 0 rgba(53, 208, 127, 0.5); }
	70% { box-shadow: 0 0 0 6px rgba(53, 208, 127, 0); }
	100% { box-shadow: 0 0 0 0 rgba(53, 208, 127, 0); }
}

.sras-chat__header-actions {
	display: flex;
	align-items: center;
	gap: 2px;
	flex: none;
}

.sras-chat__icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: inherit;
}

.sras-chat__icon-btn:hover {
	background: rgba(255, 255, 255, 0.16);
}

.sras-ico {
	display: block;
	width: 20px;
	height: 20px;
}

/* Slide-out drawer */
.sras-chat__drawer {
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	width: min(78%, 282px);
	background: #fff;
	border-inline-end: 1px solid rgba(27, 23, 64, 0.1);
	box-shadow: 8px 0 30px rgba(27, 23, 64, 0.12);
	transform: translateX(-104%);
	transition: transform 0.22s ease;
}

.sras-chat[dir="rtl"] .sras-chat__drawer {
	inset-inline-start: auto;
	inset-inline-end: 0;
	transform: translateX(104%);
}

.sras-chat--drawer .sras-chat__drawer {
	transform: translateX(0);
}

.sras-chat__drawer-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px;
	border-block-end: 1px solid rgba(27, 23, 64, 0.08);
}

.sras-chat__drawer-head .sras-chat__brandmark {
	background: var(--sras-accent);
}

.sras-chat__drawer-title {
	flex: 1;
	font-weight: 700;
}

.sras-chat__drawer-head .sras-chat__icon-btn {
	color: var(--sras-muted);
	font-size: 22px;
	line-height: 1;
}

.sras-chat__menu {
	flex: 1;
	margin: 0;
	padding: 8px;
	overflow-y: auto;
	list-style: none;
}

.sras-chat__menu li {
	margin: 0;
}

.sras-chat__menu-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 11px 12px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--sras-text);
	font-size: 14.5px;
	font-weight: 500;
	text-align: start;
	text-decoration: none;
}

.sras-chat__menu-item:hover {
	background: #f3f2fb;
	color: var(--sras-accent);
}

.sras-chat__menu-item .sras-ico {
	flex: none;
	color: var(--sras-accent);
}

.sras-chat__drawer-foot {
	margin: 0;
	padding: 12px 14px;
	border-block-start: 1px solid rgba(27, 23, 64, 0.08);
	font-size: 12px;
	color: var(--sras-muted);
}

.sras-chat__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: rgba(27, 23, 64, 0.35);
}

/* Conversation + bubbles */
.sras-chat .sras-chat__log {
	gap: 10px;
	padding: 16px;
	background: #faf9ff;
	scroll-behavior: smooth;
}

.sras-chat .sras-chat__msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14.5px;
	line-height: 1.5;
	box-shadow: 0 1px 2px rgba(27, 23, 64, 0.06);
}

.sras-chat .sras-chat__msg--user {
	background: var(--sras-accent);
	color: #fff;
	border-end-end-radius: 4px;
}

.sras-chat .sras-chat__msg:not(.sras-chat__msg--user) {
	background: #fff;
	border-end-start-radius: 4px;
}

.sras-chat__typing {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}

.sras-chat__typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--sras-muted);
	animation: sras-bounce 1.2s infinite ease-in-out;
}

.sras-chat__typing i:nth-child(2) { animation-delay: 0.15s; }
.sras-chat__typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes sras-bounce {
	0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
	40% { transform: scale(1); opacity: 1; }
}

/* Composer */
.sras-chat .sras-chat__form {
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
	border-block-start: 1px solid rgba(27, 23, 64, 0.08);
	background: #fff;
}

.sras-chat .sras-chat__input {
	min-height: 44px;
	max-height: 140px;
	padding: 10px 14px;
	border: 1px solid rgba(27, 23, 64, 0.18);
	border-radius: 14px;
	line-height: 1.4;
}

.sras-chat .sras-chat__input:focus {
	border-color: var(--sras-accent);
	box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
	outline: none;
}

.sras-chat .sras-chat__send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 50%;
}

.sras-chat__hint {
	margin: 6px 2px 0;
	font-size: 11.5px;
	color: var(--sras-muted);
}

/* Full screen */
.sras-chat--full {
	inset: 0;
	align-items: stretch;
}

.sras-chat--full .sras-chat__panel {
	width: 100vw;
	height: 100dvh;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
}

.sras-chat--full .sras-chat__toggle {
	display: none;
}

/* Mobile: near-full-screen when open */
@media (max-width: 480px) {
	.sras-chat--open {
		inset: 0;
	}

	.sras-chat--open .sras-chat__panel {
		width: 100vw;
		height: 100dvh;
		margin: 0;
		border: 0;
		border-radius: 0;
	}

	.sras-chat--open .sras-chat__toggle {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sras-chat .sras-chat__toggle,
	.sras-chat__drawer,
	.sras-chat .sras-chat__log {
		transition: none;
		scroll-behavior: auto;
	}

	.sras-chat__status-dot,
	.sras-chat__typing i {
		animation: none;
	}
}
