.ztchat-widget {
	--ztchat-primary: #0b7ad1;
	--ztchat-header-bg: #0c2d4d;
	--ztchat-header-text: #ffffff;
	--ztchat-panel-bg: #ffffff;
	--ztchat-prechat-bg: #eef6ff;
	--ztchat-messages-bg: #f6f9fc;
	--ztchat-composer-bg: #ffffff;
	--ztchat-assistant-bubble-bg: #ffffff;
	--ztchat-assistant-bubble-text: #0d2134;
	--ztchat-user-bubble-bg: var(--ztchat-primary);
	--ztchat-panel-border: rgba(11, 122, 209, 0.15);
	--ztchat-user-bubble-text: #fff;
	--ztchat-focus-ring: rgba(11, 122, 209, 0.25);
	--ztchat-brandmark-strength: 78;
	--ztchat-text-main: #10263c;
	--ztchat-text-muted: #51657a;
	--ztchat-surface: #ffffff;
	--ztchat-surface-soft: #f4f8fd;
	--ztchat-panel-radius: 20px;
	--ztchat-font-family: "Poppins", "Segoe UI", Tahoma, sans-serif;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 2147483000;
	overflow: visible;
	pointer-events: auto;
	isolation: isolate;
	font-family: var(--ztchat-font-family);
}

.ztchat-widget.ztchat-widget--safe-attach {
	position: fixed !important;
	right: 20px !important;
	bottom: 20px !important;
	left: auto !important;
	transform: none !important;
	will-change: auto;
}

.ztchat-widget.ztchat-widget--safe-attach.ztchat-widget--position-left {
	left: 20px !important;
	right: auto !important;
}

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

/* Keep UI states reliable even if active theme overrides [hidden]. */
.ztchat-widget [hidden] {
	display: none !important;
}

.ztchat-widget.ztchat-widget--preset-clean {
	--ztchat-surface: #ffffff;
	--ztchat-surface-soft: #f4f8fd;
	--ztchat-text-main: #10263c;
	--ztchat-text-muted: #51657a;
	--ztchat-prechat-bg: #eef6ff;
	--ztchat-messages-bg: #f6f9fc;
}

.ztchat-widget.ztchat-widget--preset-corporate {
	--ztchat-panel-border: rgba(16, 53, 88, 0.2);
	--ztchat-focus-ring: rgba(19, 89, 153, 0.22);
	--ztchat-surface: #ffffff;
	--ztchat-surface-soft: #f1f6fb;
	--ztchat-text-main: #12273b;
	--ztchat-text-muted: #44596f;
	--ztchat-prechat-bg: #edf4fb;
	--ztchat-messages-bg: #f2f6fb;
}

.ztchat-widget.ztchat-widget--preset-bold {
	--ztchat-panel-border: rgba(8, 67, 122, 0.24);
	--ztchat-focus-ring: rgba(7, 120, 209, 0.3);
	--ztchat-surface: #ffffff;
	--ztchat-surface-soft: #edf6ff;
	--ztchat-text-main: #0f2337;
	--ztchat-text-muted: #3b5269;
	--ztchat-prechat-bg: #e7f2ff;
	--ztchat-messages-bg: #eef5ff;
}

.ztchat-widget.ztchat-widget--preset-soft {
	--ztchat-panel-border: rgba(145, 115, 255, 0.2);
	--ztchat-focus-ring: rgba(131, 104, 255, 0.24);
	--ztchat-surface: #ffffff;
	--ztchat-surface-soft: #f7f4ff;
	--ztchat-text-main: #2a2440;
	--ztchat-text-muted: #615a79;
	--ztchat-prechat-bg: #f4efff;
	--ztchat-messages-bg: #f8f4ff;
}

.ztchat-widget.ztchat-widget--preset-contrast {
	--ztchat-panel-border: rgba(0, 0, 0, 0.42);
	--ztchat-focus-ring: rgba(0, 0, 0, 0.26);
	--ztchat-surface: #ffffff;
	--ztchat-surface-soft: #f2f2f2;
	--ztchat-text-main: #111111;
	--ztchat-text-muted: #3f3f3f;
	--ztchat-prechat-bg: #ededed;
	--ztchat-messages-bg: #f3f3f3;
}

.ztchat-widget.ztchat-widget--position-left {
	left: 20px;
	right: auto;
}

.ztchat-widget__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--ztchat-primary), #11b8b8);
	color: #fff;
	font-size: 24px;
	box-shadow: 0 12px 30px rgba(4, 42, 71, 0.35);
	cursor: pointer;
	pointer-events: auto;
	position: relative;
	z-index: 2147483002;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ztchat-widget__toggle:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 34px rgba(4, 42, 71, 0.4);
}

.ztchat-widget__toggle-label {
	display: none;
}

.ztchat-widget__toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	overflow: hidden;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.02em;
	position: relative;
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.26);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.ztchat-widget__toggle-icon--initials {
	font-size: 15px;
	text-transform: uppercase;
}

.ztchat-widget__toggle-icon--logo {
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(243, 249, 255, 0.9));
	border-color: rgba(255, 255, 255, 0.75);
	box-shadow: 0 5px 14px rgba(2, 29, 54, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.ztchat-widget__toggle-icon--logo::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(150deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 52%);
}

.ztchat-widget__toggle-logo {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	padding: 6px;
	border-radius: 10px;
	background: transparent;
}

.ztchat-widget.ztchat-widget--launcher-premium .ztchat-widget__toggle {
	background: linear-gradient(135deg, var(--ztchat-primary), #11b8b8);
	box-shadow: 0 12px 30px rgba(4, 42, 71, 0.35);
}

.ztchat-widget.ztchat-widget--launcher-minimal .ztchat-widget__toggle {
	background: var(--ztchat-primary);
	box-shadow: 0 8px 18px rgba(4, 42, 71, 0.22);
}

.ztchat-widget.ztchat-widget--launcher-minimal .ztchat-widget__toggle-icon,
.ztchat-widget.ztchat-widget--launcher-minimal .ztchat-widget__toggle-icon--logo {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: transparent;
	border: 0;
	box-shadow: none;
}

.ztchat-widget.ztchat-widget--launcher-minimal .ztchat-widget__toggle-logo {
	padding: 0;
	border-radius: 50%;
	object-fit: contain;
}

.ztchat-widget.ztchat-widget--launcher-brandmark .ztchat-widget__toggle {
	background: #ffffff;
	border: 1px solid #d6dde7;
	box-shadow: 0 8px 16px rgba(10, 28, 45, 0.16);
	color: #1f3348;
}

.ztchat-widget.ztchat-widget--launcher-brandmark .ztchat-widget__toggle-icon,
.ztchat-widget.ztchat-widget--launcher-brandmark .ztchat-widget__toggle-icon--logo {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: transparent;
	border: 0;
	box-shadow: none;
}

.ztchat-widget.ztchat-widget--launcher-brandmark .ztchat-widget__toggle-logo {
	padding: 0;
	border-radius: 50%;
	object-fit: contain;
	filter: grayscale(calc(var(--ztchat-brandmark-strength, 78) / 100)) contrast(calc(1 + (var(--ztchat-brandmark-strength, 78) / 400))) brightness(calc(1 - (var(--ztchat-brandmark-strength, 78) / 350)));
}

.ztchat-widget.ztchat-widget--launcher-brandmark .ztchat-widget__toggle-icon--initials {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: #1f3348;
}

.ztchat-widget__teaser {
	position: absolute;
	right: 68px;
	bottom: 14px;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid rgba(9, 45, 82, 0.15);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	color: #1b2d40;
	white-space: nowrap;
	box-shadow: 0 8px 20px rgba(3, 26, 49, 0.12);
	pointer-events: none;
}

.ztchat-widget.ztchat-widget--preset-corporate .ztchat-widget__teaser {
	border-color: rgba(10, 45, 80, 0.18);
	color: #163654;
}

.ztchat-widget.ztchat-widget--preset-bold .ztchat-widget__teaser {
	border-width: 2px;
	font-weight: 700;
	box-shadow: 0 10px 22px rgba(2, 46, 86, 0.16);
}

.ztchat-widget.ztchat-widget--position-left .ztchat-widget__teaser {
	left: 68px;
	right: auto;
}

.ztchat-widget.is-open .ztchat-widget__teaser {
	display: none;
}

.ztchat-widget__panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: min(380px, calc(100vw - 30px));
	height: min(640px, calc(100vh - 110px));
	background: var(--ztchat-panel-bg);
	border-radius: var(--ztchat-panel-radius);
	box-shadow: 0 25px 55px rgba(3, 26, 49, 0.24);
	border: 1px solid var(--ztchat-panel-border);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	pointer-events: auto;
	z-index: 2147483001;
	overscroll-behavior: contain;
}

.ztchat-widget.ztchat-widget--position-left .ztchat-widget__panel {
	left: 0;
	right: auto;
}

.ztchat-widget__header {
	padding: 16px 18px;
	background: var(--ztchat-header-bg);
	color: var(--ztchat-header-text);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.ztchat-widget.ztchat-widget--preset-corporate .ztchat-widget__header {
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ztchat-widget__brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ztchat-widget__logo {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
}

.ztchat-widget__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ztchat-header-text) !important;
}

.ztchat-widget__close {
	border: 0;
	background: transparent;
	color: var(--ztchat-header-text);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 4px;
}

.ztchat-widget__prechat,
.ztchat-widget__chatroom {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.ztchat-widget__prechat {
	padding: 18px;
	background: var(--ztchat-prechat-bg);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.ztchat-widget__intro {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ztchat-text-main);
}

.ztchat-widget__prechat-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ztchat-widget__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ztchat-widget__prechat-form label {
	display: block !important;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	color: #1c3a57;
	margin: 0 !important;
}

.ztchat-widget__prechat-form input {
	display: block !important;
	width: 100% !important;
	min-height: 44px;
	border: 1px solid #c8dced !important;
	border-radius: 10px;
	padding: 11px 12px;
	font-size: 14px;
	line-height: 1.4;
	background: #fff !important;
	margin: 0 !important;
	color: var(--ztchat-text-main) !important;
}

.ztchat-widget__prechat-form input:focus,
.ztchat-widget__input:focus {
	outline: 0;
	border-color: var(--ztchat-primary);
	box-shadow: 0 0 0 3px var(--ztchat-focus-ring);
}

.ztchat-widget__prechat-submit {
	margin-top: 6px;
	border: 0;
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 14px;
	font-weight: 700;
	background: var(--ztchat-primary);
	color: #fff;
	cursor: pointer;
}

.ztchat-widget__prechat-submit[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

.ztchat-widget__error {
	min-height: 20px;
	margin: 2px 0 0;
	font-size: 12px;
	color: #ca2230;
}

.ztchat-widget__hp-wrap {
	display: none;
}

.ztchat-widget__fade-out {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.ztchat-widget__messages {
	flex: 1;
	min-height: 0;
	padding: 14px;
	background: var(--ztchat-messages-bg);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.ztchat-widget__bubble {
	max-width: 90%;
	padding: 10px 12px;
	border-radius: 12px;
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
}

.ztchat-widget__bubble--user {
	margin-left: auto;
	background: var(--ztchat-user-bubble-bg);
	color: var(--ztchat-user-bubble-text);
}

.ztchat-widget__bubble--assistant {
	margin-right: auto;
	background: var(--ztchat-assistant-bubble-bg);
	border: 1px solid #d9e7f5;
	color: var(--ztchat-assistant-bubble-text);
}

.ztchat-widget.ztchat-widget--preset-corporate .ztchat-widget__bubble--assistant {
	border-color: #ccddec;
	box-shadow: 0 2px 8px rgba(10, 36, 61, 0.06);
}

.ztchat-widget.ztchat-widget--preset-bold .ztchat-widget__bubble {
	border-radius: 14px;
}

.ztchat-widget.ztchat-widget--preset-bold .ztchat-widget__bubble--assistant {
	border-color: #c9dff4;
}

.ztchat-widget__form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e0ebf5;
	background: var(--ztchat-composer-bg);
	align-items: flex-end;
}

.ztchat-widget__input {
	flex: 1;
	resize: none;
	border: 1px solid #c8dced;
	border-radius: 14px;
	min-height: 44px;
	max-height: 132px;
	padding: 10px;
	font-size: 14px;
	line-height: 1.4;
	background: #fbfdff;
}

.ztchat-widget__send {
	border: 0;
	border-radius: 14px;
	padding: 11px 16px;
	min-height: 44px;
	font-size: 14px;
	font-weight: 700;
	background: var(--ztchat-primary);
	color: #fff;
	cursor: pointer;
	white-space: nowrap;
}

.ztchat-widget__send[disabled] {
	opacity: 0.65;
	cursor: wait;
}

.ztchat-widget__toggle:focus-visible,
.ztchat-widget__close:focus-visible,
.ztchat-widget__prechat-submit:focus-visible,
.ztchat-widget__send:focus-visible {
	outline: 0;
	box-shadow: 0 0 0 3px var(--ztchat-focus-ring);
}

@media (prefers-reduced-motion: reduce) {
	.ztchat-widget__toggle,
	.ztchat-widget__fade-out {
		transition: none;
	}
}

@media (max-width: 640px) {
	.ztchat-widget {
		right: max(12px, env(safe-area-inset-right));
		bottom: max(12px, env(safe-area-inset-bottom));
	}

	.ztchat-widget.ztchat-widget--position-left {
		left: 12px;
		right: auto;
	}

	.ztchat-widget__panel {
		width: calc(100vw - 24px);
		height: min(86vh, 640px);
		max-height: calc(100vh - 24px - env(safe-area-inset-bottom));
		border-radius: 16px;
	}

	.ztchat-widget__teaser {
		right: 0;
		bottom: 70px;
	}

	.ztchat-widget.ztchat-widget--position-left .ztchat-widget__teaser {
		left: 0;
		right: auto;
	}

	.ztchat-widget__form {
		gap: 6px;
		padding: 10px;
	}

	.ztchat-widget__send {
		padding: 10px 14px;
	}

	.ztchat-widget.ztchat-widget--hide-mobile {
		display: none;
	}
}

@media (max-width: 420px) {
	.ztchat-widget__toggle {
		width: 54px;
		height: 54px;
		font-size: 22px;
	}

	.ztchat-widget__teaser {
		max-width: 190px;
		white-space: normal;
		line-height: 1.3;
	}

	.ztchat-widget__header,
	.ztchat-widget__prechat,
	.ztchat-widget__messages,
	.ztchat-widget__form {
		padding-left: 10px;
		padding-right: 10px;
	}

	.ztchat-widget__input {
		min-height: 42px;
	}
}
