.tsc-root {
	--tsc-color: #16264a;
	--tsc-dark: color-mix(in srgb, var(--tsc-color) 45%, #05080f);
	position: fixed;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 12px;
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: #101828;
}
.tsc-root.tsc-right { right: 20px; align-items: flex-end; }
.tsc-root.tsc-left  { left: 20px; align-items: flex-start; }
.tsc-root *, .tsc-root *::before, .tsc-root *::after { box-sizing: border-box; }

/* Launcher */
.tsc-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 18px;
	background: linear-gradient(135deg, var(--tsc-dark), var(--tsc-color));
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(8, 16, 40, .35);
	transition: transform .15s ease;
}
.tsc-launcher:hover { transform: translateY(-2px); }
.tsc-launcher svg { position: absolute; transition: opacity .15s ease, transform .2s ease; }
.tsc-launcher .tsc-ico-close { opacity: 0; transform: rotate(-90deg); }
.tsc-open .tsc-launcher .tsc-ico-chat { opacity: 0; transform: rotate(90deg); }
.tsc-open .tsc-launcher .tsc-ico-close { opacity: 1; transform: none; }
.tsc-launcher:focus-visible, .tsc-chip:focus-visible, .tsc-close:focus-visible, .tsc-send:focus-visible {
	outline: 3px solid rgba(80, 130, 255, .55);
	outline-offset: 2px;
}

/* Panel */
.tsc-panel {
	display: flex;
	flex-direction: column;
	width: 400px;
	max-width: calc(100vw - 24px);
	height: 600px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border-radius: 22px;
	overflow: hidden;
	box-shadow: 0 18px 50px rgba(8, 16, 40, .3);
}
.tsc-panel[hidden] { display: none; }

.tsc-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(120deg, var(--tsc-dark), var(--tsc-color));
	color: #fff;
}
.tsc-avatar {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-weight: 800;
	font-size: 17px;
}
.tsc-head .tsc-avatar { width: 46px; height: 46px; font-size: 20px; border-radius: 14px; }
.tsc-head-text { flex: 1; min-width: 0; }
.tsc-title { font-weight: 700; font-size: 17px; line-height: 1.25; }
.tsc-subtitle { display: flex; align-items: center; gap: 7px; font-size: 13px; opacity: .85; margin-top: 3px; }
.tsc-subtitle::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #2fd18c; }
.tsc-close {
	flex: none;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
.tsc-close:hover { background: rgba(255, 255, 255, .24); }

/* Conversation */
.tsc-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	background: #f6f9fd;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.tsc-row { display: flex; align-items: flex-start; gap: 8px; max-width: 94%; align-self: flex-start; }
.tsc-row .tsc-avatar {
	width: 30px;
	height: 30px;
	border-radius: 10px;
	font-size: 13px;
	background: linear-gradient(135deg, var(--tsc-dark), var(--tsc-color));
}
.tsc-msg {
	padding: 12px 15px;
	border-radius: 16px;
	white-space: pre-line;
	overflow-wrap: anywhere;
}
.tsc-msg a { color: inherit; text-decoration: underline; }
.tsc-msg strong { font-weight: 700; }
.tsc-bot { background: #fff; border: 1px solid #e1e8f2; border-top-left-radius: 6px; }
.tsc-bot a { color: #1d4fd8; }
.tsc-user {
	align-self: flex-end;
	max-width: 85%;
	background: linear-gradient(135deg, var(--tsc-dark), var(--tsc-color));
	color: #fff;
	border-top-right-radius: 6px;
}

.tsc-typing { display: flex; gap: 4px; padding: 14px 16px; }
.tsc-typing span {
	width: 7px; height: 7px; border-radius: 50%; background: #9aa7ba;
	animation: tsc-bounce 1s infinite ease-in-out;
}
.tsc-typing span:nth-child(2) { animation-delay: .15s; }
.tsc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tsc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.tsc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tsc-chip {
	margin: 0;
	padding: 9px 14px;
	border: 1px solid #dbe4f0;
	border-radius: 999px;
	background: #fff;
	color: #101828;
	font: inherit;
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
	transition: background .12s ease, border-color .12s ease;
}
.tsc-chip:hover { background: #eef3fb; border-color: #b9c9e2; }

/* Input */
.tsc-input-wrap { padding: 12px 14px 4px; background: #fff; border-top: 1px solid #e6ecf4; }
.tsc-input {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 5px 5px 14px;
	border: 1.5px solid #dbe4f0;
	border-radius: 16px;
	background: #f6f9fd;
}
.tsc-input:focus-within { border-color: #6f93e6; background: #fff; }
.tsc-input input {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 8px 0;
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	font: inherit;
	color: inherit;
}
.tsc-input input::placeholder { color: #7b8798; }
.tsc-send {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: #dfe6f1;
	color: #fff;
	cursor: default;
	transition: background .15s ease;
}
.tsc-input.tsc-ready .tsc-send { background: linear-gradient(135deg, var(--tsc-dark), var(--tsc-color)); cursor: pointer; }
.tsc-footer { padding: 6px 14px 12px; background: #fff; text-align: center; font-size: 12px; color: #8b97a8; }

/* Lead form */
.tsc-form {
	align-self: stretch;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px;
	background: #fff;
	border: 1px solid #e1e8f2;
	border-radius: 16px;
}
.tsc-form input, .tsc-form select, .tsc-form textarea {
	width: 100%;
	margin: 0;
	padding: 10px 12px;
	border: 1.5px solid #dbe4f0;
	border-radius: 12px;
	font: inherit;
	font-size: 14px;
	color: inherit;
	background: #f6f9fd;
}
.tsc-form input:focus, .tsc-form select:focus, .tsc-form textarea:focus { outline: 0; border-color: #6f93e6; background: #fff; }
.tsc-form textarea { resize: vertical; }
.tsc-submit {
	margin: 0;
	padding: 11px 14px;
	border: 0;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--tsc-dark), var(--tsc-color));
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.tsc-submit[disabled] { opacity: .6; cursor: default; }
.tsc-note { font-size: 13px; color: #55606d; min-height: 1em; }
.tsc-note.tsc-error { color: #b3261e; }
.tsc-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

@media (max-width: 480px) {
	.tsc-root { bottom: 12px; }
	.tsc-root.tsc-right { right: 12px; }
	.tsc-root.tsc-left { left: 12px; }
	.tsc-panel { width: calc(100vw - 24px); height: 78vh; max-height: calc(100vh - 90px); }
}

@media (prefers-reduced-motion: reduce) {
	.tsc-launcher, .tsc-launcher svg, .tsc-typing span, .tsc-chip { transition: none; animation: none; }
}
