.cbm {
	--cbm-cor: #12507B;
	--cbm-fundo: #ffffff;
	--cbm-bot: #eef1f4;
	--cbm-texto: #1d2733;
	position: fixed;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 99999;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--cbm-texto);
}
.cbm-dir { right: 16px; }
.cbm-esq { left: 16px; }

.cbm *, .cbm *::before, .cbm *::after { box-sizing: border-box; }
.cbm [hidden] { display: none !important; }

.cbm button, .cbm input { font: inherit; }

.cbm-fab {
	background: var(--cbm-cor);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 12px 22px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}

.cbm-panel {
	display: flex;
	flex-direction: column;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: min(560px, calc(100vh - 32px));
	background: var(--cbm-fundo);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 10px 36px rgba(0, 0, 0, .28);
}
.cbm-panel:focus { outline: none; }

.cbm-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--cbm-cor);
	color: #fff;
}
.cbm-close {
	background: transparent;
	color: #fff;
	border: 0;
	font-size: 26px;
	line-height: 1;
	padding: 0 4px;
	cursor: pointer;
}

.cbm-log {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cbm-msg {
	max-width: 88%;
	padding: 10px 13px;
	border-radius: 12px;
	overflow-wrap: anywhere;
}
.cbm-msg p { margin: 0 0 .6em; }
.cbm-msg p:last-child { margin-bottom: 0; }
.cbm-msg a { color: inherit; text-decoration: underline; }
.cbm-bot { background: var(--cbm-bot); align-self: flex-start; border-bottom-left-radius: 4px; }
.cbm-user { background: var(--cbm-cor); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.cbm-typing { display: flex; gap: 5px; align-items: center; padding: 14px 15px; }
.cbm-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #7b8794;
}

.cbm-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.cbm-opt {
	background: var(--cbm-fundo);
	color: var(--cbm-cor);
	border: 1.5px solid var(--cbm-cor);
	border-radius: 999px;
	padding: 7px 14px;
	cursor: pointer;
	text-align: left;
}
.cbm-opt:hover:not(:disabled) { background: var(--cbm-cor); color: #fff; }
.cbm-opt:disabled { opacity: .45; cursor: default; }
.cbm-nav { border-style: dashed; }

.cbm-bot .cbm-link {
	display: inline-block;
	background: var(--cbm-cor);
	color: #fff;
	text-decoration: none;
	padding: 7px 14px;
	border-radius: 999px;
	font-weight: 600;
}

.cbm .cbm-wa {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #128C4A;
	color: #fff;
	font-weight: 600;
	text-decoration: none;
	padding: 9px 18px;
	border-radius: 999px;
}
.cbm .cbm-wa:hover { background: #0e7a3f; }
.cbm-wa-bar { padding: 10px; border-top: 1px solid #dde2e8; }
.cbm-wa-bar .cbm-wa { width: 100%; }
.cbm-wa-bar + .cbm-foot { border-top: 0; padding-top: 0; }

.cbm-res { list-style: none; margin: 0; padding: 0; }
.cbm-res li + li { margin-top: 10px; }
.cbm-res a { font-weight: 600; }
.cbm-res p { margin: 2px 0 0; font-size: 13px; opacity: .85; }

.cbm-foot, .cbm-inline { display: flex; gap: 6px; }
.cbm-foot { padding: 10px; border-top: 1px solid #dde2e8; }
.cbm-foot input, .cbm-inline input {
	flex: 1;
	min-width: 0;
	padding: 8px 12px;
	border: 1.5px solid #b9c2cc;
	border-radius: 999px;
	color: var(--cbm-texto);
	background: #fff;
}
.cbm-foot button, .cbm-inline button {
	background: var(--cbm-cor);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 8px 16px;
	font-weight: 600;
	cursor: pointer;
}

.cbm button:focus-visible,
.cbm input:focus-visible,
.cbm a:focus-visible {
	outline: 3px solid #f5b400;
	outline-offset: 2px;
}

@media (max-width: 480px) {
	.cbm-dir { right: 8px; }
	.cbm-esq { left: 8px; }
	.cbm { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
	.cbm-panel { width: calc(100vw - 16px); max-width: none; height: calc(100vh - 16px); }
}

@media (prefers-reduced-motion: no-preference) {
	.cbm-msg { animation: cbm-in .15s ease-out; }
	.cbm-typing span { animation: cbm-dot 1.1s infinite ease-in-out; }
	.cbm-typing span:nth-child(2) { animation-delay: .15s; }
	.cbm-typing span:nth-child(3) { animation-delay: .3s; }
	@keyframes cbm-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
	@keyframes cbm-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
