:root {
	--tsc-primary: #046bd2;
	--tsc-secondary: #ffffff;
}

#techsky-chat-root, #techsky-chat-root * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tsc-bubble {
	position: fixed;
	bottom: 24px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--tsc-primary);
	box-shadow: 0 6px 24px rgba(0,0,0,.2);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 999998;
	transition: transform .2s ease;
}
.tsc-bubble:hover { transform: scale(1.06); }
.tsc-bubble.right { right: 24px; }
.tsc-bubble.left { left: 24px; }
.tsc-bubble svg { width: 28px; height: 28px; fill: var(--tsc-secondary); }
.tsc-bubble .tsc-unread {
	position: absolute;
	top: -4px; right: -4px;
	background: #ff4757;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}

.tsc-window {
	position: fixed;
	bottom: 96px;
	width: 370px;
	max-width: 92vw;
	height: 560px;
	max-height: 78vh;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0,0,0,.22);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 999999;
	opacity: 0;
	transform: translateY(16px);
	transition: opacity .22s ease, transform .22s ease;
}
.tsc-window.right { right: 24px; }
.tsc-window.left { left: 24px; }
.tsc-window.open { display: flex; opacity: 1; transform: translateY(0); }

.tsc-header {
	background: var(--tsc-primary);
	color: var(--tsc-secondary);
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 10px;
}
.tsc-agent-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff; flex-shrink: 0; }
.tsc-avatar-fallback {
	display: flex; align-items: center; justify-content: center;
	background: rgba(255,255,255,.25);
	color: var(--tsc-secondary);
	font-weight: 700; font-size: 15px;
	border: 2px solid rgba(255,255,255,.5);
}
.tsc-header .tsc-title { font-weight: 600; font-size: 15px; }
.tsc-header .tsc-status { font-size: 12px; opacity: .85; display:flex; align-items:center; gap:5px;}
.tsc-header .tsc-dot { width:8px; height:8px; border-radius:50%; background:#2ed573; display:inline-block;}
.tsc-header .tsc-dot.offline { background:#a4b0be; }
.tsc-header .tsc-close { margin-left: auto; cursor: pointer; opacity: .85; font-size: 20px; line-height:1; }

.tsc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f4f6fb;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.tsc-msg-row { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.tsc-msg-row.visitor { align-self: flex-end; flex-direction: row-reverse; }
.tsc-msg-row.ai, .tsc-msg-row.agent { align-self: flex-start; }
.tsc-msg-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; font-size: 11px; background: var(--tsc-primary); }
.tsc-msg-avatar.tsc-avatar-fallback { border: none; color: #fff; background: var(--tsc-primary); }
.tsc-msg { max-width: 100%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; }
.tsc-msg.visitor { background: var(--tsc-primary); color: var(--tsc-secondary); border-bottom-right-radius: 4px; }
.tsc-msg.ai, .tsc-msg.agent { background: #fff; color: #1a1a1a; border: 1px solid #e6e9f0; border-bottom-left-radius: 4px; }
.tsc-msg .tsc-meta { font-size: 10px; opacity: .55; margin-top: 4px; }
.tsc-msg-image { max-width: 200px; max-height: 200px; border-radius: 10px; display: block; }
.tsc-msg-file { color: inherit; text-decoration: underline; word-break: break-all; }

.tsc-md-p { margin: 0 0 6px; }
.tsc-md-p:last-child { margin-bottom: 0; }
.tsc-md-gap { height: 6px; }
.tsc-md-list { margin: 2px 0 8px; padding-left: 20px; }
.tsc-md-list:last-child { margin-bottom: 0; }
.tsc-md-list li { margin-bottom: 4px; }
.tsc-md-link { color: var(--tsc-primary); font-weight: 600; text-decoration: underline; }
.tsc-msg.ai strong, .tsc-msg.agent strong { color: #111; }

.tsc-typing { align-self: flex-start; display:flex; gap:4px; padding: 8px 12px; }
.tsc-typing span { width:6px; height:6px; border-radius:50%; background:#b0b8c9; animation: tsc-bounce 1.2s 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%,60%,100%{ transform: translateY(0);} 30%{ transform: translateY(-5px);} }

.tsc-offline-form { padding: 16px; display: flex; flex-direction: column; gap: 8px; overflow-y:auto;}
.tsc-offline-form input, .tsc-offline-form textarea {
	border: 1px solid #dfe3ec; border-radius: 8px; padding: 9px 11px; font-size: 13px; width: 100%;
}
.tsc-offline-form button {
	background: var(--tsc-primary); color: var(--tsc-secondary); border: none; border-radius: 8px;
	padding: 10px; font-weight: 600; cursor: pointer; font-size: 13.5px;
}
.tsc-offline-note { font-size: 12px; color: #6b7280; margin: 0 0 4px; }

.tsc-input-bar { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid #eceff5; background: #fff; position: relative; }
.tsc-input-bar textarea {
	flex: 1; resize: none; border: 1px solid #e2e5ee; border-radius: 18px; padding: 9px 14px;
	font-size: 13.5px; max-height: 90px; outline: none;
}
.tsc-input-bar textarea:focus { border-color: var(--tsc-primary); }

.tsc-icon-btn {
	-webkit-appearance: none; appearance: none;
	width: 34px; height: 34px; min-width: 34px; min-height: 34px; max-width: 34px; max-height: 34px;
	flex: 0 0 34px;
	border: none; background: transparent; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	cursor: pointer; padding: 0; margin: 0;
	box-sizing: border-box;
}
.tsc-icon-btn:hover { background: #f0f2f8; }
.tsc-icon-btn svg { width: 19px; height: 19px; display: block; fill: #8891a5; pointer-events: none; }

.tsc-emoji-panel {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 4px;
	padding: 10px;
	border-top: 1px solid #eceff5;
	background: #fff;
	max-height: 130px;
	overflow-y: auto;
}
.tsc-emoji { font-size: 19px; text-align: center; cursor: pointer; border-radius: 6px; padding: 4px 0; user-select: none; }
.tsc-emoji:hover { background: #f0f2f8; }

.tsc-send-btn {
	-webkit-appearance: none;
	appearance: none;
	width: 36px; height: 36px;
	min-width: 36px; min-height: 36px;
	max-width: 36px; max-height: 36px;
	flex: 0 0 36px;
	margin: 0; padding: 0;
	border: none; outline: none;
	border-radius: 50%;
	background: var(--tsc-primary);
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	line-height: 0;
	box-sizing: border-box;
}
.tsc-send-btn:disabled { opacity: .55; cursor: default; }
.tsc-send-btn svg { width: 16px; height: 16px; display: block; fill: var(--tsc-secondary); pointer-events: none; }

.tsc-powered { text-align:center; font-size: 10px; color: #b0b8c9; padding: 4px 0 8px; }

@media (max-width: 480px) {
	.tsc-window { width: 100vw; height: 100vh; max-height: 100vh; bottom: 0; right: 0; left: 0; border-radius: 0; }
}
