.hikit-chat {
	--hikit-ink: #2a2118;
	--hikit-white: #fff;
	--hikit-line: rgba(42, 33, 24, .1);
	--hikit-line-strong: rgba(42, 33, 24, .16);
	--hikit-radius: 32px;
	--hikit-shadow: 0 2px 8px rgba(42, 33, 24, .06), 0 8px 22px rgba(42, 33, 24, .05);
	--hikit-accent-deep: color-mix(in srgb, var(--hikit-accent, #4f46e5) 78%, #000);
	position: fixed;
	right: clamp(16px, 3vw, 28px);
	bottom: clamp(16px, 3vw, 28px);
	z-index: 99999;
	font-family: inherit;
	line-height: 1.4;
}

.hikit-chat__toggle {
	position: relative;
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--hikit-accent, #4f46e5);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 12px 28px color-mix(in srgb, var(--hikit-accent, #4f46e5) 42%, transparent);
	transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background .25s;
}

.hikit-chat__toggle:hover {
	background: var(--hikit-accent-deep);
	transform: translateY(-3px) scale(1.04);
}

.hikit-chat i {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.hikit-chat__toggle-open,
.hikit-chat__toggle-close {
	grid-area: 1 / 1;
	display: grid;
	place-items: center;
	font-size: 26px;
	line-height: 0;
	transition: opacity .25s, transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.hikit-chat__toggle-close {
	opacity: 0;
	transform: rotate(-90deg) scale(.6);
}

.hikit-chat.is-open .hikit-chat__toggle-open {
	opacity: 0;
	transform: rotate(90deg) scale(.6);
}

.hikit-chat.is-open .hikit-chat__toggle-close {
	opacity: 1;
	transform: none;
}

.hikit-chat__panel {
	position: absolute;
	right: 0;
	bottom: 78px;
	display: flex;
	flex-direction: column;
	width: min(92vw, 380px);
	height: min(72vh, 560px);
	overflow: hidden;
	overscroll-behavior: contain;
	background: var(--hikit-white);
	border-radius: var(--hikit-radius);
	box-shadow: 0 30px 70px rgba(42, 33, 24, .28);
	transform-origin: bottom right;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(20px) scale(.92);
	transition: opacity .25s, transform .4s cubic-bezier(.34, 1.56, .64, 1), visibility .25s;
}

.hikit-chat.is-open .hikit-chat__panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: none;
}

.hikit-chat__header {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: linear-gradient(135deg, var(--hikit-accent, #4f46e5), var(--hikit-secondary, #0ea5e9));
	color: #fff;
}

.hikit-chat__avatar {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 42px;
	height: 42px;
	overflow: hidden;
	border-radius: 50%;
	background: #fff;
	box-shadow: var(--hikit-shadow);
}

.hikit-chat__avatar img {
	width: 34px;
	height: 34px;
	object-fit: contain;
}

.hikit-chat__title {
	min-width: 0;
}

.hikit-chat__title strong {
	display: block;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
}

.hikit-chat__title small {
	display: flex;
	align-items: center;
	gap: 6px;
	color: rgba(255, 255, 255, .85);
	font-size: 12px;
}

.hikit-chat__status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #9cf06a;
	box-shadow: 0 0 0 0 rgba(156, 240, 106, .6);
	animation: hikit-chat-pulse 2s infinite;
}

@keyframes hikit-chat-pulse {
	70% { box-shadow: 0 0 0 7px rgba(156, 240, 106, 0); }
	100% { box-shadow: 0 0 0 0 rgba(156, 240, 106, 0); }
}

.hikit-chat__close {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 34px;
	height: 34px;
	font-size: 18px;
	margin-left: auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	color: #fff;
	cursor: pointer;
}

.hikit-chat__close:hover {
	background: rgba(255, 255, 255, .32);
}

.hikit-chat__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	min-height: 0;
	padding: 18px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--hikit-bg, #fffaf1);
	scroll-behavior: smooth;
}

.hikit-chat__msg {
	max-width: 84%;
	padding: 11px 15px;
	border-radius: 18px;
	font-size: 14.5px;
	line-height: 1.5;
	white-space: pre-wrap;
	animation: hikit-chat-in .35s cubic-bezier(.22, 1, .36, 1);
}

@keyframes hikit-chat-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

.hikit-chat__msg--bot {
	align-self: flex-start;
	border: 1px solid var(--hikit-line);
	border-bottom-left-radius: 6px;
	background: var(--hikit-white);
	color: var(--hikit-ink);
	box-shadow: var(--hikit-shadow);
}

.hikit-chat__msg--user {
	align-self: flex-end;
	border-bottom-right-radius: 6px;
	background: var(--hikit-accent, #4f46e5);
	color: #fff;
}

.hikit-chat__msg--human {
	align-self: flex-start;
	border: 1px solid color-mix(in srgb, var(--hikit-accent, #4f46e5) 45%, transparent);
	border-bottom-left-radius: 6px;
	background: #fff;
	color: var(--hikit-ink);
}

.hikit-chat__msg-name {
	display: block;
	margin-bottom: 4px;
	color: var(--hikit-accent, #4f46e5);
	font-size: 12px;
	font-weight: 700;
}

.hikit-chat__msg--human p {
	margin: 0;
}

.hikit-chat__typing {
	padding: 0 18px 8px;
	color: var(--hikit-accent, #4f46e5);
	font-size: 12px;
	font-weight: 600;
}

.hikit-chat__msg p:first-child { margin-top: 0; }
.hikit-chat__msg p:last-child { margin-bottom: 0; }

.hikit-chat__msg a {
	color: var(--hikit-secondary, #0ea5e9);
	font-weight: 700;
	text-decoration: underline;
}

.hikit-chat__msg--user a { color: #fff; }

.hikit-chat__msg-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.hikit-chat__msg-actions a,
.hikit-chat__cookie-accept,
.hikit-chat__history {
	padding: 7px 13px;
	border: 1.5px solid color-mix(in srgb, var(--hikit-accent, #4f46e5) 30%, transparent);
	border-radius: 999px;
	background: color-mix(in srgb, var(--hikit-accent, #4f46e5) 10%, transparent);
	color: var(--hikit-ink);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.hikit-chat__msg-actions a:hover,
.hikit-chat__cookie-accept:hover,
.hikit-chat__history:hover {
	border-color: var(--hikit-accent, #4f46e5);
	background: var(--hikit-accent, #4f46e5);
	color: #fff;
}

.hikit-chat.is-cookie-locked .hikit-chat__msg:not(.hikit-chat__msg--cookie) {
	pointer-events: none;
}

.hikit-chat.is-cookie-locked .hikit-chat__msg--history,
.hikit-chat.is-cookie-locked .hikit-chat__msg--history * {
	pointer-events: auto;
}

.hikit-chat.is-cookie-locked .hikit-chat__quick,
.hikit-chat.is-cookie-locked .hikit-chat__input {
	opacity: .45;
}

.hikit-chat__quick {
	display: flex;
	flex-shrink: 0;
	gap: 8px;
	padding: 10px 14px;
	overflow-x: auto;
	border-top: 1px solid var(--hikit-line);
	background: var(--hikit-white);
	scrollbar-width: none;
}

.hikit-chat__quick::-webkit-scrollbar { display: none; }

.hikit-chat__chip {
	flex-shrink: 0;
	padding: 8px 14px;
	border: 1.5px solid var(--hikit-line);
	border-radius: 999px;
	background: color-mix(in srgb, var(--hikit-bg, #fffaf1) 82%, var(--hikit-accent, #4f46e5));
	color: var(--hikit-ink);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
}

.hikit-chat__chip:hover {
	border-color: var(--hikit-accent, #4f46e5);
	background: var(--hikit-accent, #4f46e5);
	color: #fff;
}

.hikit-chat__input {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid var(--hikit-line);
	background: var(--hikit-white);
}

.hikit-chat__input input {
	flex: 1;
	min-width: 0;
	padding: 12px 16px;
	border: 2px solid var(--hikit-line-strong);
	border-radius: 999px;
	outline: none;
	background: var(--hikit-bg, #fffaf1);
	color: var(--hikit-ink);
	font: inherit;
	font-size: 14.5px;
}

.hikit-chat__input input:focus {
	border-color: var(--hikit-accent, #4f46e5);
	background: #fff;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--hikit-accent, #4f46e5) 22%, transparent);
}

.hikit-chat__input button {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 46px;
	height: 46px;
	font-size: 18px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--hikit-accent, #4f46e5);
	color: #fff;
	cursor: pointer;
	transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background .25s;
}

.hikit-chat__input button:hover {
	background: var(--hikit-accent-deep);
	transform: scale(1.06);
}

@media (max-width: 480px) {
	.hikit-chat__panel { height: min(80vh, 560px); }
}
