:root {
	--gudaima-chat-ink: #1b1815;
	--gudaima-chat-paper: #fffdf9;
	--gudaima-chat-soft: #f3eee7;
	--gudaima-chat-accent: #c66b3d;
	--gudaima-chat-human: #147d4f;
	--gudaima-chat-border: rgba(27, 24, 21, 0.14);
}

.gudaima-chat,
.gudaima-chat * {
	box-sizing: border-box;
}

.gudaima-chat {
	bottom: max(18px, env(safe-area-inset-bottom));
	font-family: inherit;
	left: max(18px, env(safe-area-inset-left));
	position: fixed;
	right: auto;
	z-index: 99970;
}

.gudaima-chat.is-open {
	z-index: 100000;
}

.gudaima-chat__launcher {
	align-items: center;
	background: var(--gudaima-chat-ink);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 12px 32px rgba(20, 16, 12, 0.22);
	color: #fff;
	cursor: pointer;
	display: flex;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	gap: 8px;
	min-height: 48px;
	padding: 11px 17px;
}

.gudaima-chat__launcher:hover,
.gudaima-chat__launcher:focus-visible {
	background: #000;
	transform: translateY(-1px);
}

.gudaima-chat__launcher-icon {
	font-size: 18px;
}

.gudaima-chat__panel {
	background: var(--gudaima-chat-paper);
	border: 1px solid var(--gudaima-chat-border);
	border-radius: 18px;
	bottom: 60px;
	box-shadow: 0 22px 60px rgba(20, 16, 12, 0.24);
	color: var(--gudaima-chat-ink);
	display: grid;
	grid-template-rows: auto minmax(190px, 1fr) auto auto auto auto;
	max-height: min(690px, calc(100vh - 110px));
	overflow: hidden;
	position: absolute;
	left: 0;
	right: auto;
	width: min(380px, calc(100vw - 28px));
}

.gudaima-chat__panel[hidden] {
	display: none;
}

.gudaima-chat__header {
	align-items: center;
	background: var(--gudaima-chat-ink);
	color: #fff;
	display: flex;
	justify-content: space-between;
	padding: 15px 16px;
}

.gudaima-chat__header div {
	display: grid;
	gap: 1px;
}

.gudaima-chat__header strong {
	font-size: 15px;
	letter-spacing: 0.08em;
}

.gudaima-chat__header span {
	color: rgba(255, 255, 255, 0.75);
	font-size: 12px;
}

.gudaima-chat__close {
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 28px;
	height: 34px;
	line-height: 1;
	padding: 0;
	width: 34px;
}

.gudaima-chat__messages {
	display: flex;
	flex-direction: column;
	gap: 9px;
	min-height: 220px;
	overflow-y: auto;
	padding: 14px;
	scroll-behavior: smooth;
}

.gudaima-chat__bubble {
	border-radius: 14px;
	font-size: 13px;
	line-height: 1.45;
	max-width: 86%;
	overflow-wrap: anywhere;
	padding: 9px 11px;
	white-space: pre-wrap;
}

.gudaima-chat__bubble p {
	margin: 0;
}

.gudaima-chat__bubble img {
	border-radius: 9px;
	display: block;
	height: auto;
	margin-top: 7px;
	max-width: 100%;
}

.gudaima-chat__bubble--bot,
.gudaima-chat__bubble--system {
	align-self: flex-start;
	background: var(--gudaima-chat-soft);
	border-bottom-left-radius: 4px;
}

.gudaima-chat__bubble--human {
	align-self: flex-start;
	background: #e6f5ec;
	border: 1px solid rgba(20, 125, 79, 0.18);
	border-bottom-left-radius: 4px;
}

.gudaima-chat__bubble--customer {
	align-self: flex-end;
	background: var(--gudaima-chat-ink);
	border-bottom-right-radius: 4px;
	color: #fff;
}

.gudaima-chat__quick {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 0 12px 9px;
}

.gudaima-chat__quick button {
	background: #fff;
	border: 1px solid var(--gudaima-chat-border);
	border-radius: 999px;
	color: var(--gudaima-chat-ink);
	cursor: pointer;
	flex: 0 0 auto;
	font: inherit;
	font-size: 11px;
	padding: 6px 9px;
}

.gudaima-chat__human {
	align-items: center;
	background: transparent;
	border: 0;
	border-top: 1px solid var(--gudaima-chat-border);
	color: var(--gudaima-chat-human);
	cursor: pointer;
	display: flex;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	gap: 7px;
	justify-content: center;
	padding: 9px;
}

.gudaima-chat__human span {
	font-size: 8px;
}

.gudaima-chat.is-human .gudaima-chat__human {
	background: #e6f5ec;
	cursor: default;
}

.gudaima-chat.is-human .gudaima-chat__human::after {
	content: "Bot pausado";
	font-weight: 500;
}

.gudaima-chat__form {
	align-items: flex-end;
	border-top: 1px solid var(--gudaima-chat-border);
	display: grid;
	gap: 7px;
	grid-template-columns: 34px 1fr 36px;
	padding: 10px;
}

.gudaima-chat__form textarea {
	background: transparent;
	border: 0;
	color: var(--gudaima-chat-ink);
	font: inherit;
	font-size: 13px;
	line-height: 1.4;
	max-height: 90px;
	min-height: 36px;
	outline: none;
	padding: 8px 2px;
	resize: none;
	width: 100%;
}

.gudaima-chat__attach,
.gudaima-chat__send {
	align-items: center;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	font-size: 16px;
	height: 34px;
	justify-content: center;
	width: 34px;
}

.gudaima-chat__attach {
	background: var(--gudaima-chat-soft);
}

.gudaima-chat__attach input {
	height: 1px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.gudaima-chat__send {
	background: var(--gudaima-chat-accent);
	color: #fff;
}

.gudaima-chat__send:disabled {
	cursor: wait;
	opacity: 0.55;
}

.gudaima-chat__file-name,
.gudaima-chat__privacy {
	color: #6d655d;
	font-size: 10px;
	margin: 0;
	padding: 0 12px 6px;
}

.gudaima-chat__file-name:empty {
	display: none;
}

.gudaima-chat__privacy {
	padding-bottom: 9px;
	text-align: center;
}

.gudaima-chat.is-loading .gudaima-chat__messages::after {
	align-self: flex-start;
	animation: gudaima-pulse 1s infinite alternate;
	color: #786f67;
	content: "Escribiendo…";
	font-size: 11px;
	padding: 2px 4px;
}

@keyframes gudaima-pulse {
	to { opacity: 0.45; }
}

@media (max-width: 480px) {
	.gudaima-chat {
		bottom: max(10px, env(safe-area-inset-bottom));
		left: max(10px, env(safe-area-inset-left));
		right: auto;
	}

	.gudaima-chat__launcher {
		justify-content: center;
		min-width: 46px;
		width: 46px;
		min-height: 44px;
		height: 46px;
		padding: 0;
	}

	.gudaima-chat__launcher > span:last-child {
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		height: 1px;
		overflow: hidden;
		position: absolute;
		white-space: nowrap;
		width: 1px;
	}

	.gudaima-chat__launcher-icon {
		font-size: 19px;
	}

	.gudaima-chat__panel {
		border-radius: 16px;
		bottom: 54px;
		left: 0;
		right: auto;
		max-height: calc(100dvh - 78px);
		width: calc(100vw - 20px);
	}

	body.gudaima-product-page .gudaima-chat {
		bottom: calc(82px + env(safe-area-inset-bottom));
	}
}

body.gudaima-chat-open .gudaima-floating-contact {
	opacity: 0 !important;
	pointer-events: none !important;
	visibility: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
	.gudaima-chat *,
	.gudaima-chat *::before,
	.gudaima-chat *::after {
		animation-duration: 0.01ms !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}
