/* KREN Help Chat — guided support widget */
:root {
	--kren-hc-accent: #5a4fcf;
	--kren-hc-accent-2: #7b5cff;
	--kren-hc-text: #1f2430;
	--kren-hc-muted: #6b7280;
	--kren-hc-bg: #ffffff;
	--kren-hc-bubble-bot: #f1f0fb;
	--kren-hc-bubble-user: #5a4fcf;
	--kren-hc-radius: 16px;
	--kren-hc-shadow: 0 18px 50px rgba(31, 36, 48, 0.22);
}

#kren-hc-root * {
	box-sizing: border-box;
	font-family: inherit;
}

/* Launcher button */
#kren-hc-launcher {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99998;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 13px 18px;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	background: linear-gradient(135deg, var(--kren-hc-accent), var(--kren-hc-accent-2));
	box-shadow: var(--kren-hc-shadow);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#kren-hc-launcher.kren-hc-away { opacity: 0; transform: translateY(24px) scale(.9); pointer-events: none; }
#kren-hc-launcher { transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.18s ease; }
#kren-hc-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 22px 55px rgba(90, 79, 207, 0.4);
}
#kren-hc-launcher svg {
	width: 20px;
	height: 20px;
	flex: none;
}
#kren-hc-launcher .kren-hc-dot {
	position: absolute;
	top: -3px;
	right: -3px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid #fff;
}

/* Panel */
#kren-hc-panel {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99999;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 44px);
	display: none;
	flex-direction: column;
	background: var(--kren-hc-bg);
	border-radius: var(--kren-hc-radius);
	box-shadow: var(--kren-hc-shadow);
	overflow: hidden;
	animation: kren-hc-in 0.22s ease;
}
#kren-hc-panel.kren-hc-open {
	display: flex;
}
@keyframes kren-hc-in {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.kren-hc-header {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 16px 18px;
	color: #fff;
	background: linear-gradient(135deg, var(--kren-hc-accent), var(--kren-hc-accent-2));
}
.kren-hc-header .kren-hc-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: grid;
	place-items: center;
	flex: none;
}
.kren-hc-header .kren-hc-avatar svg { width: 20px; height: 20px; }
.kren-hc-header h4 { margin: 0; font-size: 15px; font-weight: 700; }
.kren-hc-header p { margin: 2px 0 0; font-size: 12px; opacity: 0.9; }
.kren-hc-restart {
	margin-left: auto;
	background: rgba(255, 255, 255, 0.16);
	border: 0;
	color: #fff;
	cursor: pointer;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	transition: background 0.15s ease, transform 0.3s ease;
}
.kren-hc-restart:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(-90deg); }
.kren-hc-restart svg { width: 16px; height: 16px; }
.kren-hc-close {
	margin-left: 6px;
	background: rgba(255, 255, 255, 0.16);
	border: 0;
	color: #fff;
	cursor: pointer;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	flex: none;
	transition: background 0.15s ease;
}
.kren-hc-close:hover, .kren-hc-close:focus-visible { background: rgba(255, 255, 255, 0.3); }
.kren-hc-close svg { width: 20px; height: 20px; }
.kren-hc-restart { width: 40px; height: 40px; flex: none; }

/* Body */
.kren-hc-body {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
	background: #fbfbfe;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.kren-hc-msg {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--kren-hc-text);
	animation: kren-hc-in 0.2s ease;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.kren-hc-msg.bot {
	background: var(--kren-hc-bubble-bot);
	border-bottom-left-radius: 4px;
	align-self: flex-start;
}
.kren-hc-msg.user {
	background: var(--kren-hc-bubble-user);
	color: #fff;
	border-bottom-right-radius: 4px;
	align-self: flex-end;
}

/* Quick-reply chips */
.kren-hc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 2px;
}
.kren-hc-chip {
	border: 1px solid var(--kren-hc-accent);
	background: #fff;
	color: var(--kren-hc-accent);
	border-radius: 999px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.kren-hc-chip:hover { background: var(--kren-hc-accent); color: #fff; }

/* Footer input */
.kren-hc-footer {
	border-top: 1px solid #ececf5;
	padding: 10px;
	background: #fff;
}
.kren-hc-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.kren-hc-input {
	flex: 1;
	border: 1px solid #d9d9ea;
	border-radius: 12px;
	padding: 11px 13px;
	font-size: 14px;
	resize: none;
	max-height: 110px;
	outline: none;
	color: var(--kren-hc-text);
	font-family: inherit;
}
.kren-hc-input:focus { border-color: var(--kren-hc-accent); }
.kren-hc-send {
	border: 0;
	border-radius: 12px;
	width: 44px;
	height: 44px;
	flex: none;
	cursor: pointer;
	color: #fff;
	background: linear-gradient(135deg, var(--kren-hc-accent), var(--kren-hc-accent-2));
	display: grid;
	place-items: center;
}
.kren-hc-send:disabled { opacity: 0.5; cursor: not-allowed; }
.kren-hc-send svg { width: 19px; height: 19px; }

.kren-hc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.kren-hc-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.kren-hc-typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #b9b6d4; animation: kren-hc-blink 1.2s infinite both;
}
.kren-hc-typing span:nth-child(2) { animation-delay: 0.2s; }
.kren-hc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes kren-hc-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

@media (max-width: 600px) {
	#kren-hc-panel {
		top: 0; left: 0; right: 0; bottom: 0;
		width: 100%; max-width: 100%;
		height: 100vh; height: 100dvh;
		max-height: none;
		border-radius: 0;
		z-index: 2147483000;
	}
	.kren-hc-header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
	.kren-hc-footer { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
	.kren-hc-input { font-size: 16px; } /* prevents iOS zoom on focus */
	#kren-hc-launcher span.kren-hc-label { display: none; }
	#kren-hc-launcher { padding: 15px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
html.kren-hc-lock, html.kren-hc-lock body { overflow: hidden !important; }
