#mch-chat-widget, #mch-chat-widget * {
	box-sizing: border-box;
	font-family: var(--mch-font, 'Barlow', sans-serif);
}

#mch-chat-widget {
	position: fixed;
	bottom: 22px;
	z-index: 999999;
	--mch-panel: #07122A;
	--mch-border: #1B2F57;
	--mch-card: #0F2145;
}
#mch-chat-widget.mch-pos-right { right: 22px; }
#mch-chat-widget.mch-pos-left  { left: 22px; }

/* Launcher (round avatar with glow ring) */
#mch-chat-toggle {
	width: 68px;
	height: 68px;
	padding: 0;
	border-radius: 50%;
	border: 2px solid var(--mch-primary, #00A3D9);
	background: var(--mch-bg, #0B1A35);
	cursor: pointer;
	overflow: hidden;
	display: block;
	box-shadow: 0 0 0 4px rgba(0,163,217,0.18), 0 8px 24px rgba(0,0,0,0.35);
	transition: transform .2s ease, box-shadow .2s ease;
}
#mch-chat-toggle:hover { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(0,163,217,0.25), 0 10px 28px rgba(0,0,0,0.4); }
#mch-chat-toggle img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* Window */
#mch-chat-window {
	position: absolute;
	bottom: 82px;
	width: 384px;
	max-width: calc(100vw - 32px);
	height: 545px;
	max-height: calc(100vh - 120px);
	background: var(--mch-bg, #0B1A35);
	border: 1px solid var(--mch-border);
	box-shadow: 0 18px 50px rgba(0,0,0,0.45);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: mch-pop .18s ease;
	color: #fff;
}
#mch-chat-widget.mch-pos-right #mch-chat-window { right: 0; }
#mch-chat-widget.mch-pos-left  #mch-chat-window { left: 0; }
.mch-hidden { display: none !important; }

@keyframes mch-pop {
	from { opacity: 0; transform: translateY(10px) scale(.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.mch-chat-header {
	background: var(--mch-panel);
	border-bottom: 1px solid var(--mch-border);
	padding: 12px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
}
.mch-avatar-wrap { position: relative; width: 40px; height: 40px; flex-shrink: 0; }
.mch-avatar {
	width: 40px; height: 40px; border-radius: 50%;
	object-fit: cover; display: block;
	border: 2px solid var(--mch-primary, #00A3D9);
}
.mch-dot {
	position: absolute; right: -1px; bottom: 0;
	width: 10px; height: 10px; border-radius: 50%;
	background: #2ee08a; border: 2px solid var(--mch-panel);
}
.mch-header-text { flex: 1; min-width: 0; }
.mch-header-text strong { display: block; font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.mch-sub {
	font-size: 10px; font-weight: 600; letter-spacing: 1.4px;
	text-transform: uppercase; color: var(--mch-primary, #00A3D9);
	margin-top: 3px;
}
.mch-close {
	background: transparent; border: none; color: #8fa3c7; cursor: pointer;
	width: 30px; height: 30px; padding: 4px; border-radius: 6px;
	display: flex; align-items: center; justify-content: center;
}
.mch-close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.mch-close svg { width: 18px; height: 18px; }

/* Body */
.mch-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scrollbar-width: thin;
	scrollbar-color: var(--mch-border) transparent;
}

.mch-msg {
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	white-space: pre-wrap;
}
.mch-msg.bot {
	color: #fff;
	font-weight: 600;
	align-self: flex-start;
	max-width: 100%;
}
.mch-msg.user {
	align-self: flex-end;
	max-width: 85%;
	background: var(--mch-primary, #00A3D9);
	color: var(--mch-secondary, #fff);
	padding: 8px 12px;
	font-weight: 500;
	border-radius: 4px;
}
.mch-msg.bot a { color: var(--mch-primary, #00A3D9); text-decoration: underline; }

.mch-msg.typing { display: flex; gap: 5px; align-items: center; padding: 6px 0; }
.mch-msg.typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--mch-primary, #00A3D9);
	opacity: .5;
	animation: mch-blink 1.1s infinite ease-in-out;
}
.mch-msg.typing span:nth-child(2) { animation-delay: .15s; }
.mch-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mch-blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

/* Quick question buttons */
.mch-quick { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.mch-quick button {
	text-align: left;
	background: rgba(7,18,42,0.7);
	border: 1px solid var(--mch-border);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	padding: 12px 12px;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}
.mch-quick button:hover { border-color: var(--mch-primary, #00A3D9); background: var(--mch-card); }

/* Input row */
.mch-chat-input-row {
	display: flex;
	align-items: stretch;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid var(--mch-border);
	background: var(--mch-bg, #0B1A35);
}
#mch-chat-input {
	flex: 1;
	resize: none;
	background: var(--mch-panel);
	border: 1px solid var(--mch-border);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 11px 12px;
	max-height: 90px;
	outline: none;
	border-radius: 0;
	line-height: 1.3;
}
#mch-chat-input::placeholder { color: #c9d4ea; opacity: .9; font-weight: 600; }
#mch-chat-input:focus { border-color: var(--mch-primary, #00A3D9); }

#mch-chat-send {
	width: 42px;
	border: none;
	background: #14506E;
	color: #8fd3ee;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	border-radius: 0;
	transition: background .15s ease;
}
#mch-chat-send:hover { background: var(--mch-primary, #00A3D9); color: #fff; }
#mch-chat-send svg { width: 18px; height: 18px; }
#mch-chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* Inline lead-capture form */
.mch-lead-form {
	background: var(--mch-panel);
	border: 1px solid var(--mch-border);
	padding: 14px;
	align-self: stretch;
}
.mch-lead-form-title { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 10px; }
.mch-lead-form input {
	width: 100%;
	background: var(--mch-bg, #0B1A35);
	border: 1px solid var(--mch-border);
	color: #fff;
	padding: 8px 10px;
	font-size: 13px;
	margin-bottom: 8px;
	outline: none;
	border-radius: 0;
}
.mch-lead-form input::placeholder { color: #8fa3c7; }
.mch-lead-form input:focus { border-color: var(--mch-primary, #00A3D9); }
.mch-lead-form-actions { display: flex; gap: 8px; margin-top: 2px; }
.mch-lead-submit {
	flex: 1; background: var(--mch-primary, #00A3D9); color: #fff; border: none;
	padding: 8px 0; font-size: 13px; font-weight: 700; cursor: pointer;
}
.mch-lead-skip { background: transparent; color: #8fa3c7; border: none; font-size: 12px; cursor: pointer; padding: 8px; }

@media (max-width: 480px) {
	#mch-chat-widget { bottom: 14px; }
	#mch-chat-widget.mch-pos-right { right: 14px; }
	#mch-chat-widget.mch-pos-left  { left: 14px; }
	#mch-chat-window { width: calc(100vw - 28px); height: calc(100vh - 110px); bottom: 78px; }
	#mch-chat-toggle { width: 60px; height: 60px; }
}

/* Guard against theme CSS overriding widget text sizes */
#mch-chat-widget .mch-msg { font-size: 14px; line-height: 1.5; }
#mch-chat-widget .mch-quick button { font-size: 13px; line-height: 1.3; letter-spacing: normal; text-transform: none; margin: 0; min-height: 0; border-radius: 0; box-shadow: none; }
#mch-chat-widget #mch-chat-input { font-size: 13px; line-height: 1.3; margin: 0; height: auto; box-shadow: none; }
#mch-chat-widget .mch-header-text strong { font-size: 14px; line-height: 1.2; margin: 0; }
#mch-chat-widget .mch-sub { font-size: 10px; line-height: 1.2; }
#mch-chat-widget button { text-transform: none; }
