:root {
	--cal-target-size: 24px;
	--cal-ink: #111827;
	--cal-ink-soft: #4b5563;
	--cal-surface: #ffffff;
	--cal-surface-alt: #f8fafc;
	--cal-border: #e5e7eb;
	--cal-wa: #1c8651;
	--cal-wa-hover: #166c41;
	--cal-danger: #d93025;
	--cal-danger-bg: #fce8e6;
	--cal-ok: #188038;
}

@media (pointer: coarse) {
	:root {
		--cal-target-size: 44px;
	}
}

.cal-visually-hidden:where(:not(:focus-within, :active)) {
	position: absolute !important;
	clip-path: inset(50%) !important;
	overflow: hidden !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	border: 0 !important;
	white-space: nowrap !important;
}

#cal-chat-root,
#cal-chat-root *,
#cal-chat-root *::before,
#cal-chat-root *::after {
	box-sizing: border-box;
}

#cal-chat-root [hidden],
#cal-chat-root svg[hidden] {
	display: none !important;
}

#cal-chat-root :where(button, select, textarea, input:not([type="checkbox"], [type="radio"]), a.cal-btn) {
	min-block-size: var(--cal-target-size);
	min-inline-size: var(--cal-target-size);
	font-family: inherit;
}

#cal-chat-root :where(h2, h3) {
	text-wrap: balance;
	margin: 0;
}

#cal-chat-root p {
	text-wrap: pretty;
	margin: 0;
}

.cal-icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	border-radius: 8px;
	padding: 6px;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cal-icon-btn::after {
	content: "";
	position: absolute;
	inset: -4px;
}

.cal-icon-btn:hover {
	background: rgba(255, 255, 255, 0.12);
}

.cal-chat-launcher {
	transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease, box-shadow 0.2s ease;
}

.cal-chat-launcher:hover {
	transform: translateY(-2px);
	background-color: var(--cal-wa-hover) !important;
	box-shadow: 0 12px 28px rgba(17, 24, 39, 0.3) !important;
}

.cal-chat-launcher:focus-visible,
#cal-chat-root button:focus-visible,
#cal-chat-root input:focus-visible,
#cal-chat-root textarea:focus-visible,
#cal-chat-root select:focus-visible,
#cal-chat-root a:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

.cal-chat-unread {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: #dc2626;
	color: #ffffff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	border: 2px solid #ffffff;
}

.cal-chat-tooltip {
	position: absolute;
	bottom: 68px;
	display: flex;
	align-items: flex-start;
	gap: 6px;
	background: #ffffff;
	color: var(--cal-ink);
	border: 1px solid var(--cal-border);
	border-radius: 14px;
	padding: 10px 12px 10px 14px;
	box-shadow: 0 12px 30px rgba(17, 24, 39, 0.16);
	width: max-content;
	max-width: min(300px, calc(100vw - 36px));
}

#cal-chat-root.cal-pos-left .cal-chat-tooltip {
	left: 0;
}

#cal-chat-root.cal-pos-right .cal-chat-tooltip {
	right: 0;
}

.cal-chat-tooltip-text {
	background: transparent;
	border: 0;
	padding: 0;
	text-align: left;
	color: var(--cal-ink);
	font-size: 13.5px;
	line-height: 1.4;
	font-weight: 500;
	cursor: pointer;
	min-inline-size: 0;
}

.cal-tooltip-dismiss {
	color: #6b7280;
	padding: 2px;
	flex-shrink: 0;
}

.cal-tooltip-dismiss:hover {
	background: #f3f4f6;
	color: var(--cal-ink);
}

dialog.cal-chat-panel {
	position: fixed;
	inset: auto;
	bottom: calc(max(18px, env(safe-area-inset-bottom, 0px)) + 68px);
	margin: 0;
	padding: 0;
	border: 1px solid rgba(17, 24, 39, 0.1);
	border-radius: 18px;
	background: var(--cal-surface);
	color: var(--cal-ink);
	width: min(390px, calc(100vw - 24px));
	height: min(600px, calc(100dvh - 108px));
	max-width: none;
	max-height: none;
	box-shadow: 0 22px 54px rgba(15, 23, 42, 0.24);
	overflow: hidden;
	z-index: 99992;
}

#cal-chat-root.cal-pos-left dialog.cal-chat-panel {
	left: max(12px, env(safe-area-inset-left, 0px));
}

#cal-chat-root.cal-pos-right dialog.cal-chat-panel {
	right: max(12px, env(safe-area-inset-right, 0px));
}

dialog.cal-chat-panel[open] {
	display: flex;
	flex-direction: column;
}

@media (max-width: 540px) {
	dialog.cal-chat-panel {
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100vw;
		height: min(88dvh, 680px);
		border-radius: 20px 20px 0 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
}

.cal-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 16px;
	background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
	color: #ffffff;
	flex-shrink: 0;
}

.cal-chat-brand {
	display: flex;
	align-items: center;
	gap: 11px;
	min-inline-size: 0;
}

.cal-chat-avatar {
	position: relative;
	width: 38px;
	height: 38px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 16px;
	color: #ffffff;
	flex-shrink: 0;
}

.cal-presence-dot {
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 11px;
	height: 11px;
	border-radius: 999px;
	border: 2px solid #111827;
	background: #9ca3af;
}

.cal-presence-dot.is-online {
	background: #22c55e;
}

.cal-chat-brand-copy {
	min-inline-size: 0;
}

.cal-chat-title {
	font-size: 15px !important;
	font-weight: 700 !important;
	line-height: 1.25 !important;
	color: #ffffff !important;
}

.cal-chat-subtitle {
	font-size: 12px;
	line-height: 1.3;
	color: rgba(255, 255, 255, 0.78);
	margin-top: 2px !important;
}

.cal-chat-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.cal-chat-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 8px 10px;
	background: #f3f4f6;
	border-bottom: 1px solid var(--cal-border);
	flex-shrink: 0;
}

.cal-tab-btn {
	flex: 1 1 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 7px 10px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: #4b5563;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cal-tab-btn:hover {
	color: var(--cal-ink);
	background: rgba(255, 255, 255, 0.65);
}

.cal-tab-btn.is-active {
	background: #ffffff;
	color: var(--cal-ink);
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.cal-tab-btn.cal-tab-wa.is-active {
	color: var(--cal-wa);
}

.cal-chat-body {
	flex: 1 1 auto;
	min-block-size: 0;
	display: flex;
	flex-direction: column;
	background: var(--cal-surface-alt);
	container: calpanel / inline-size;
	overflow: hidden;
}

.cal-view {
	flex: 1 1 auto;
	min-block-size: 0;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

.cal-view[hidden],
.cal-thread-wrap[hidden],
.cal-form-card[hidden] {
	display: none !important;
}

.cal-form-card {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cal-welcome-lead {
	font-size: 13.5px;
	line-height: 1.45;
	color: #374151;
	background: #ffffff;
	border: 1px solid var(--cal-border);
	border-radius: 12px;
	padding: 11px 13px;
}

.cal-section-heading {
	font-size: 15px !important;
	font-weight: 700 !important;
	color: var(--cal-ink) !important;
}

.cal-section-desc {
	font-size: 13px;
	line-height: 1.45;
	color: var(--cal-ink-soft);
}

.cal-field {
	display: flex;
	flex-direction: column;
}

.cal-field label {
	font-size: 12.5px;
	font-weight: 600;
	color: #1f2937;
	margin-bottom: 3px;
}

.cal-opt {
	font-weight: 400;
	color: #6b7280;
}

.cal-field-hint {
	display: block;
	font-size: 11.5px;
	color: #6b7280;
	margin-bottom: 4px;
}

.cal-field input,
.cal-field textarea,
.cal-field select {
	width: 100%;
	padding: 9px 11px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--cal-ink);
	background: #ffffff;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cal-field textarea {
	resize: vertical;
}

.cal-field-error {
	display: none;
	font-size: 12px;
	line-height: 1.35;
	color: var(--cal-danger);
	margin-top: 4px;
}

#cal-chat-root :is(input, textarea, select):is(:user-invalid, .user-invalid-fallback) {
	border-color: var(--cal-danger);
	background-color: var(--cal-danger-bg);
}

#cal-chat-root :is(input, textarea, select):is(:user-invalid, .user-invalid-fallback) + .cal-field-error {
	display: block;
}

#cal-chat-root :is(input, textarea):user-valid {
	border-color: var(--cal-ok);
}

.cal-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 11px 16px;
	border: 0;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.cal-btn:disabled {
	opacity: 0.65;
	cursor: wait;
}

.cal-btn-primary {
	background: var(--cal-ink);
	color: #ffffff;
}

.cal-btn-primary:hover {
	background: #1f2937;
	color: #ffffff;
}

.cal-btn-whatsapp {
	background: var(--cal-wa);
	color: #ffffff !important;
}

.cal-btn-whatsapp:hover {
	background: var(--cal-wa-hover);
	color: #ffffff !important;
}

.cal-thread-wrap {
	flex: 1 1 auto;
	min-block-size: 0;
	display: flex;
	flex-direction: column;
}

.cal-messages-list {
	flex: 1 1 auto;
	min-block-size: 0;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cal-msg {
	display: flex;
	flex-direction: column;
	max-width: 86%;
	overflow-wrap: anywhere;
}

.cal-msg-visitor {
	align-self: flex-end;
	align-items: flex-end;
}

.cal-msg-agent {
	align-self: flex-start;
	align-items: flex-start;
}

.cal-msg-system {
	align-self: center;
	max-width: 94%;
	text-align: center;
}

.cal-msg-meta {
	font-size: 11px;
	color: #6b7280;
	margin-bottom: 3px;
	padding: 0 4px;
}

.cal-msg-bubble {
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	white-space: pre-line;
	overflow-wrap: anywhere;
}

.cal-msg-visitor .cal-msg-bubble {
	background: var(--cal-ink);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.cal-msg-agent .cal-msg-bubble {
	background: #ffffff;
	color: var(--cal-ink);
	border: 1px solid var(--cal-border);
	border-bottom-left-radius: 4px;
}

.cal-msg-system .cal-msg-bubble {
	background: #eef2ff;
	color: #3730a3;
	font-size: 12px;
	padding: 6px 12px;
	border-radius: 999px;
}

.cal-product-card {
	background: #ffffff;
	border: 1px solid var(--cal-border);
	border-radius: 12px;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	max-width: 280px;
}

@container calpanel (inline-size > 330px) {
	.cal-product-card-top {
		display: grid;
		grid-template-columns: 56px 1fr;
		gap: 10px;
		align-items: center;
	}
}

.cal-product-card img {
	width: 56px;
	height: 56px;
	object-fit: contain;
	border-radius: 8px;
	background: #f9fafb;
	max-inline-size: 100%;
}

.cal-product-card-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--cal-ink);
	line-height: 1.3;
}

.cal-product-card-prices {
	font-size: 12.5px;
	color: #374151;
	margin-top: 3px;
}

.cal-product-card-pix {
	color: var(--cal-wa);
	font-weight: 700;
	display: block;
}

.cal-product-card a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 7px 10px;
	border-radius: 8px;
	background: var(--cal-ink);
	color: #ffffff !important;
	text-decoration: none;
	font-size: 12.5px;
	font-weight: 600;
}

.cal-wa-handoff-card {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	border-radius: 12px;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: 290px;
}

.cal-wa-handoff-card p {
	font-size: 13px;
	color: #064e3b;
}

.cal-typing-bar {
	padding: 4px 16px 8px;
	font-size: 12px;
	color: #6b7280;
	display: flex;
	align-items: center;
	gap: 6px;
}

.cal-typing-dots {
	display: inline-flex;
	gap: 3px;
}

.cal-typing-dots i {
	width: 5px;
	height: 5px;
	border-radius: 999px;
	background: #6b7280;
	animation: calDotPulse 1.2s infinite ease-in-out;
}

.cal-typing-dots i:nth-child(2) {
	animation-delay: 0.2s;
}

.cal-typing-dots i:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes calDotPulse {
	0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
	40% { opacity: 1; transform: scale(1.1); }
}

.cal-antivacuum-card {
	margin: 0 12px 8px;
	padding: 10px 12px;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cal-antivacuum-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
}

.cal-antivacuum-close {
	color: #065f46;
	font-size: 13px;
	padding: 2px 6px;
	flex-shrink: 0;
}

.cal-antivacuum-card p {
	font-size: 12.5px;
	color: #065f46;
}

.cal-csat-box {
	margin: 0 12px 8px;
	padding: 10px 12px;
	background: #ffffff;
	border: 1px solid var(--cal-border);
	border-radius: 12px;
	text-align: center;
}

.cal-csat-title {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--cal-ink);
	margin-bottom: 6px !important;
}

.cal-csat-stars {
	display: inline-flex;
	gap: 4px;
}

.cal-star-btn {
	background: transparent;
	border: 0;
	font-size: 22px;
	line-height: 1;
	color: #d1d5db;
	cursor: pointer;
	padding: 4px 6px;
}

.cal-star-btn.is-lit,
.cal-star-btn:hover {
	color: #f59e0b;
}

.cal-csat-thanks {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--cal-wa);
}

.cal-composer-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #ffffff;
	border-top: 1px solid var(--cal-border);
	flex-shrink: 0;
}

.cal-composer-form textarea {
	flex: 1 1 auto;
	min-inline-size: 0;
	max-height: 96px;
	padding: 9px 12px;
	border: 1px solid #d1d5db;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.35;
	resize: none;
	background: #f9fafb;
	color: var(--cal-ink);
}

.cal-send-btn {
	background: var(--cal-ink);
	color: #ffffff;
	border-radius: 11px;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
}

.cal-send-btn:hover {
	background: #1f2937;
}

.cal-api-error {
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--cal-danger-bg);
	color: var(--cal-danger);
	font-size: 12.5px;
}

.cal-order-result {
	margin: 0 16px 16px;
	padding: 14px;
	background: #ffffff;
	border: 1px solid var(--cal-border);
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overflow-wrap: anywhere;
}

.cal-order-badge {
	display: inline-block;
	align-self: flex-start;
	padding: 4px 10px;
	border-radius: 999px;
	background: #ecfdf5;
	color: #065f46;
	font-size: 12px;
	font-weight: 700;
}

.cal-order-meta-list {
	font-size: 13px;
	color: #374151;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.cal-wa-agent-pill {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 12px;
	background: #ffffff;
	border: 1px solid var(--cal-border);
	border-radius: 12px;
}

.cal-wa-agent-badge {
	width: 38px;
	height: 38px;
	border-radius: 999px;
	background: #dcfce7;
	color: var(--cal-wa);
	font-weight: 800;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.cal-wa-agent-info {
	display: flex;
	flex-direction: column;
	min-inline-size: 0;
}

.cal-wa-agent-info strong {
	font-size: 13.5px;
	color: var(--cal-ink);
}

.cal-wa-agent-info span {
	font-size: 12.5px;
	color: var(--cal-ink-soft);
}

dialog.cal-chat-qr-modal {
	border: 0;
	border-radius: 20px;
	padding: 0;
	width: min(370px, calc(100vw - 28px));
	background: #ffffff;
	color: var(--cal-ink);
	box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
}

dialog.cal-chat-qr-modal:modal {
	overscroll-behavior: contain;
}

dialog.cal-chat-qr-modal::backdrop {
	background: rgba(15, 23, 42, 0.58);
	backdrop-filter: blur(2px);
	overflow: hidden;
	overscroll-behavior: contain;
}

.cal-qr-modal-inner {
	padding: 20px 22px 22px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 12px;
}

.cal-qr-modal-head {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.cal-qr-title {
	font-size: 17px !important;
	font-weight: 700 !important;
	color: var(--cal-ink) !important;
}

.cal-qr-close {
	color: #6b7280;
}

.cal-qr-close:hover {
	background: #f3f4f6;
	color: var(--cal-ink);
}

.cal-qr-desc {
	font-size: 13px;
	line-height: 1.45;
	color: var(--cal-ink-soft);
}

.cal-qr-svg-box {
	width: 216px;
	height: 216px;
	padding: 8px;
	border-radius: 16px;
	border: 1px solid var(--cal-border);
	background: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cal-qr-svg-box svg {
	width: 200px;
	height: 200px;
	display: block;
}

.cal-qr-phone-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--cal-ink);
}

.cal-qr-actions {
	width: 100%;
}
