.ns-ia-chat {
	position: fixed;
	z-index: 100000; /* above CookieAdmin reconsent (99999) */
	top: auto;
	right: auto;
	bottom: max(0.75rem, env(safe-area-inset-bottom));
	left: max(0.75rem, env(safe-area-inset-left));
	display: flex;
	flex-direction: column-reverse;
	align-items: flex-start;
	font-family: Montserrat, sans-serif;
	pointer-events: none;
}

.ns-ia-chat-launch {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	pointer-events: auto;
}

.ns-ia-chat-avatar {
	position: relative;
	z-index: 1;
	display: block;
	width: 72px;
	height: 72px;
	margin-bottom: -5px;
	object-fit: cover;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	background: #e8eef2;
	opacity: 0.6;
	transition: opacity 1.2s ease;
	pointer-events: none;
}

.ns-ia-chat-launch:hover .ns-ia-chat-avatar,
.ns-ia-chat-launch:focus-visible .ns-ia-chat-avatar {
	opacity: 1;
}

.ns-ia-chat-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 0;
	min-height: 32px;
	padding: 0 12px;
	border: 1px solid #1c1c1c;
	border-radius: 2px;
	background: #1c1c1c;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	pointer-events: none;
}

.ns-ia-chat-icon {
	display: block;
	flex: 0 0 auto;
}

.ns-ia-chat-launch:hover .ns-ia-chat-toggle,
.ns-ia-chat-launch:focus-visible .ns-ia-chat-toggle {
	background: #333;
}

.ns-ia-chat-launch:focus-visible {
	outline: 2px solid #1c1c1c;
	outline-offset: 3px;
}

.ns-ia-chat-panel,
html[data-theme="dark"] .ns-ia-chat-panel {
	display: none;
	flex-direction: column;
	width: min(360px, calc(100vw - 2rem));
	height: min(480px, calc(100svh - 9rem));
	margin: 0 0 0.75rem;
	border: 1px solid #d8d8d8;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
	color: #000;
	pointer-events: auto;
}

.ns-ia-chat.is-open .ns-ia-chat-panel {
	display: flex;
}

.ns-ia-chat-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	box-sizing: border-box;
	min-height: 30px;
	height: 30px;
	padding: 0 2rem;
	border-bottom: 1px solid #cfcfcf;
	background-color: #cfcfcf;
}

.ns-ia-chat-heading {
	min-width: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	text-align: center;
}

.ns-ia-chat-header strong {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #000;
}

.ns-ia-chat-disclaimer,
.ns-ia-chat-panel .ns-ia-chat-disclaimer,
.ns-ia-chat-heading .ns-ia-chat-disclaimer,
html[data-theme="dark"] .ns-ia-chat-disclaimer,
html[data-theme="dark"] .ns-ia-chat-heading p,
html[data-theme="dark"] .ns-ia-chat-panel p.ns-ia-chat-disclaimer {
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 0;
	font-size: 11px;
	line-height: 1.25;
	font-weight: 400;
	letter-spacing: 0;
	text-align: center;
	text-transform: none;
	color: #555 !important;
	background-color: transparent !important;
	background-image: none !important;
}

.ns-ia-chat-close {
	position: absolute;
	top: 50%;
	right: 0.45rem;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: #666;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.ns-ia-chat-messages {
	flex: 1;
	overflow: auto;
	padding: 0 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	background: #fafafa;
}

.ns-ia-chat-bubble {
	max-width: 92%;
	padding: 0.7rem 0.85rem;
	border-radius: 2px;
	font-size: 13px;
	line-height: 1.5;
	color: #000;
	white-space: pre-wrap;
}

.ns-ia-chat-bubble.is-user {
	align-self: flex-end;
	background: #1c1c1c;
	color: #fff;
}

.ns-ia-chat-bubble.is-bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e5e5e5;
}

.ns-ia-chat-link {
	color: #c00;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.ns-ia-chat-link:hover,
.ns-ia-chat-link:focus-visible {
	color: #000;
}

html[data-theme="dark"] .ns-ia-chat-link {
	color: #c00 !important;
}

html[data-theme="dark"] .ns-ia-chat-link:hover,
html[data-theme="dark"] .ns-ia-chat-link:focus-visible {
	color: #000 !important;
}

.ns-ia-chat-bubble.is-typing::after {
	content: "|";
	display: inline-block;
	margin-left: 1px;
	font-weight: 600;
	animation: ns-ia-caret 0.9s steps(1, end) infinite;
}

@keyframes ns-ia-caret {
	0%,
	49% {
		opacity: 1;
	}
	50%,
	100% {
		opacity: 0;
	}
}

.ns-ia-chat-bubble.is-error {
	border-color: #c9a0a0;
	color: #7a2e2e;
}

.ns-ia-chat-form {
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem;
	border-top: 1px solid #ececec;
	background: #fff;
}

.ns-ia-chat-form input {
	flex: 1;
	min-width: 0;
	min-height: 44px;
	padding: 0.55rem 0.7rem;
	border: 1px solid #ccc;
	border-radius: 2px;
	font: inherit;
	font-size: 13px;
	color: #000;
}

.ns-ia-chat-form button {
	min-height: 44px;
	padding: 0 0.9rem;
	border: 1px solid #1c1c1c;
	border-radius: 2px;
	background: #1c1c1c;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
}

.ns-ia-chat-form button:disabled {
	opacity: 0.55;
	cursor: wait;
}

@media (max-width: 560px) {
	.ns-ia-chat {
		bottom: max(0.75rem, env(safe-area-inset-bottom));
		left: max(0.75rem, env(safe-area-inset-left));
		right: auto;
		align-items: flex-start;
	}

	.ns-ia-chat.is-open {
		right: max(0.75rem, env(safe-area-inset-right));
		align-items: stretch;
	}

	.ns-ia-chat-panel {
		width: 100%;
		height: min(480px, calc(100svh - 8.5rem));
	}

	.ns-ia-chat-launch {
		align-self: flex-start;
	}
}
