.bmc, .bmc * { box-sizing: border-box; }
.bmc {
	--bmc-accent: #0e6b57;
	--bmc-ink: #1c2421;
	--bmc-muted: #58645f;
	--bmc-line: #dbe3df;
	--bmc-bot: #eef2f0;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--bmc-ink);
}
.bmc button, .bmc input { font: inherit; margin: 0; }
.bmc button { cursor: pointer; }
.bmc :focus-visible { outline: 2px solid var(--bmc-accent); outline-offset: 2px; }

/* Botón flotante */
.bmc-toggle {
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--bmc-accent);
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}
.bmc--right .bmc-toggle { right: 20px; }
.bmc--left .bmc-toggle { left: 20px; }
.bmc-toggle:focus-visible { outline-color: var(--bmc-ink); outline-offset: 3px; }

/* Panel */
.bmc-panel {
	position: fixed;
	bottom: 88px;
	z-index: 99991;
	width: 360px;
	max-width: calc(100vw - 24px);
	height: min(560px, calc(100vh - 110px));
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--bmc-line);
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, .2);
	overflow: hidden;
}
.bmc-panel[hidden] { display: none; }
.bmc--right .bmc-panel { right: 20px; }
.bmc--left .bmc-panel { left: 20px; }
.bmc.is-open .bmc-panel { animation: bmc-in .18s ease-out; }
@keyframes bmc-in {
	from { opacity: 0; transform: translateY(8px) scale(.98); }
	to { opacity: 1; transform: none; }
}

.bmc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 8px 12px 16px;
	background: var(--bmc-accent);
	color: #fff;
}
.bmc-title { margin: 0; font-size: 15px; font-weight: 600; color: inherit; }
.bmc-close {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font-size: 26px;
	line-height: 1;
}
.bmc-close:hover { background: rgba(255, 255, 255, .16); }
.bmc-head :focus-visible { outline-color: #fff; outline-offset: -2px; }

/* Conversación */
.bmc-log {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fff;
}
.bmc-row {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	max-width: 90%;
}
.bmc-row--user { align-self: flex-end; align-items: flex-end; }
.bmc-bubble {
	padding: 9px 12px;
	border-radius: 14px;
	background: var(--bmc-bot);
	color: var(--bmc-ink);
	white-space: pre-line;
	overflow-wrap: anywhere;
}
.bmc-row--bot .bmc-bubble { border-bottom-left-radius: 4px; }
.bmc-row--user .bmc-bubble { background: var(--bmc-accent); color: #fff; border-bottom-right-radius: 4px; }

/* Enlaces, botones de respuesta y fichas */
.bmc-links, .bmc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bmc a.bmc-link {
	display: inline-block;
	padding: 5px 11px;
	border: 1px solid var(--bmc-line);
	border-radius: 999px;
	background: #fff;
	color: var(--bmc-accent);
	font-size: 13px;
	text-decoration: none;
}
.bmc a.bmc-link:hover { border-color: var(--bmc-accent); text-decoration: underline; }
.bmc .bmc-chip {
	padding: 6px 12px;
	border: 1px solid var(--bmc-accent);
	border-radius: 999px;
	background: #fff;
	color: var(--bmc-accent);
	font-size: 13px;
	text-align: left;
}
.bmc .bmc-chip:hover { background: var(--bmc-accent); color: #fff; }
.bmc-card {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	padding: 10px 12px;
	border: 1px solid var(--bmc-line);
	border-radius: 12px;
	background: #fff;
}
.bmc-card-name { font-size: 14px; }
.bmc-card-price { color: var(--bmc-muted); font-size: 13px; }
.bmc a.bmc-link--solid { margin-top: 4px; border-color: var(--bmc-accent); background: var(--bmc-accent); color: #fff; }
.bmc a.bmc-link--solid:hover { color: #fff; }

/* Indicador de escritura */
.bmc-typing { display: inline-flex; gap: 4px; padding: 12px; }
.bmc-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--bmc-muted);
	animation: bmc-dot 1s infinite ease-in-out;
}
.bmc-typing i:nth-child(2) { animation-delay: .15s; }
.bmc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bmc-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* Entrada */
.bmc-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--bmc-line); }
.bmc .bmc-input {
	flex: 1;
	min-width: 0;
	padding: 9px 11px;
	border: 1px solid #b9c5bf;
	border-radius: 10px;
	background: #fff;
	color: var(--bmc-ink);
	font-size: 16px;
}
.bmc .bmc-send {
	padding: 0 14px;
	border: 0;
	border-radius: 10px;
	background: var(--bmc-accent);
	color: #fff;
	font-weight: 600;
}
.bmc-foot {
	margin: 0;
	padding: 0 14px calc(10px + env(safe-area-inset-bottom, 0px));
	color: var(--bmc-muted);
	font-size: 12px;
	line-height: 1.4;
}

@media (max-width: 480px) {
	.bmc.bmc--left .bmc-panel, .bmc.bmc--right .bmc-panel {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: none;
		height: min(84vh, 640px);
		border-radius: 16px 16px 0 0;
	}
	.bmc.is-open .bmc-toggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.bmc.is-open .bmc-panel, .bmc-typing i { animation: none; }
}
