/* KCberry — Assistente de Orçamento */
.kcb-ast {
	--ka-ink: #1A1A1A;
	--ka-cream: #FAF8F5;
	--ka-sand: #F5F2ED;
	--ka-gold: #C8A96E;
	--ka-red: #B91C1C;
	--ka-line: #E7E1D7;
	--ka-muted: #6B655C;
	--ka-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
	--ka-sans: 'DM Sans', 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	font-family: var(--ka-sans);
	font-size: 15px;
	line-height: 1.45;
	color: var(--ka-ink);
}
.kcb-ast--left { left: 20px; }
.kcb-ast--right { right: 20px; }
.kcb-ast *, .kcb-ast *::before, .kcb-ast *::after { box-sizing: border-box; }
.kcb-ast [hidden] { display: none !important; }

.kcb-ast__launcher {
	display: inline-flex; align-items: center; gap: 10px;
	height: 52px; padding: 0 20px 0 16px;
	background: var(--ka-ink); color: #fff;
	border: 1px solid rgba(200, 169, 110, .55); border-radius: 999px;
	font: 600 15px/1 var(--ka-sans); letter-spacing: .01em;
	box-shadow: 0 10px 30px rgba(26, 26, 26, .28);
	cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, opacity .3s ease, visibility .3s;
}
/* Escondido até o visitante fazer scroll — não tapa o CTA principal do hero */
.kcb-ast.is-waiting .kcb-ast__launcher { opacity: 0; visibility: hidden; transform: translateY(12px); pointer-events: none; }
.kcb-ast__launcher svg { color: var(--ka-gold); flex: none; }
.kcb-ast__launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(26, 26, 26, .34); }
.kcb-ast__launcher:focus-visible { outline: 3px solid var(--ka-gold); outline-offset: 3px; }
.kcb-ast.is-open .kcb-ast__launcher { display: none; }

.kcb-ast__nudge {
	position: absolute; bottom: 64px; width: 250px;
	background: #fff; color: var(--ka-ink);
	border: 1px solid var(--ka-line); border-radius: 14px;
	padding: 12px 30px 12px 14px; font-size: 14px;
	box-shadow: 0 12px 30px rgba(26, 26, 26, .16);
	cursor: pointer; animation: kcbAstIn .35s ease both;
}
.kcb-ast--left .kcb-ast__nudge { left: 0; }
.kcb-ast--right .kcb-ast__nudge { right: 0; }
.kcb-ast__nudge-x {
	position: absolute; top: 4px; right: 6px; width: 24px; height: 24px;
	border: 0; background: none; color: var(--ka-muted); font-size: 18px; line-height: 1; cursor: pointer;
}

.kcb-ast__panel {
	display: flex; flex-direction: column;
	width: 380px; max-width: calc(100vw - 24px);
	height: 600px; max-height: calc(100vh - 40px);
	background: var(--ka-cream);
	border: 1px solid var(--ka-line); border-radius: 18px;
	box-shadow: 0 24px 60px rgba(26, 26, 26, .28);
	overflow: hidden; animation: kcbAstIn .25s ease both;
}
@keyframes kcbAstIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.kcb-ast__head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 16px 14px 20px; background: var(--ka-ink); color: #fff;
	border-bottom: 2px solid var(--ka-gold);
}
.kcb-ast__title { font: 600 22px/1.1 var(--ka-serif); letter-spacing: .01em; }
.kcb-ast__sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: rgba(255, 255, 255, .72); }
.kcb-ast__dot { width: 7px; height: 7px; border-radius: 50%; background: #3FB950; box-shadow: 0 0 0 3px rgba(63, 185, 80, .2); }
.kcb-ast__close {
	width: 36px; height: 36px; border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, .08); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.kcb-ast__close:hover { background: rgba(255, 255, 255, .16); }

.kcb-ast__log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; overscroll-behavior: contain; }
.kcb-ast__msg { max-width: 86%; margin: 0 0 10px; padding: 10px 14px; border-radius: 16px; word-wrap: break-word; animation: kcbAstIn .2s ease both; }
.kcb-ast__msg p { margin: 0 0 6px; }
.kcb-ast__msg p:last-child { margin-bottom: 0; }
.kcb-ast__msg ul { margin: 4px 0 6px; padding-left: 18px; }
.kcb-ast__msg li { margin: 2px 0; }
.kcb-ast__msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.kcb-ast__msg--bot { background: #fff; border: 1px solid var(--ka-line); border-bottom-left-radius: 4px; }
.kcb-ast__msg--bot a { color: var(--ka-red); }
.kcb-ast__msg--user { margin-left: auto; background: var(--ka-ink); color: #fff; border-bottom-right-radius: 4px; }
.kcb-ast__msg--err { border-color: #F1C9C9; background: #FFF7F7; }

.kcb-ast__typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.kcb-ast__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ka-gold); animation: kcbAstDot 1.1s infinite ease-in-out; }
.kcb-ast__typing span:nth-child(2) { animation-delay: .15s; }
.kcb-ast__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes kcbAstDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.kcb-ast__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.kcb-ast__chip {
	padding: 8px 12px; border: 1px solid var(--ka-gold); border-radius: 999px;
	background: #fff; color: var(--ka-ink); font: 500 13.5px/1.2 var(--ka-sans); cursor: pointer;
	transition: background .15s ease;
}
.kcb-ast__chip:hover, .kcb-ast__chip:focus-visible { background: var(--ka-sand); outline: none; }

.kcb-ast__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ka-line); background: #fff; }
.kcb-ast__input {
	flex: 1; min-height: 42px; max-height: 110px; resize: none;
	padding: 10px 12px; border: 1px solid var(--ka-line); border-radius: 12px;
	background: var(--ka-cream); color: var(--ka-ink);
	font: 16px/1.4 var(--ka-sans); /* 16px evita o zoom automático no iPhone */
}
.kcb-ast__input:focus { outline: none; border-color: var(--ka-gold); box-shadow: 0 0 0 3px rgba(200, 169, 110, .25); }
.kcb-ast__send {
	flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px;
	background: var(--ka-red); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.kcb-ast.is-busy .kcb-ast__send { opacity: .5; cursor: wait; }

.kcb-ast__foot {
	display: flex; justify-content: space-between; align-items: center; gap: 8px;
	padding: 8px 14px 10px; background: #fff; font-size: 12px; color: var(--ka-muted);
}
.kcb-ast__foot a { color: var(--ka-muted); }
.kcb-ast__wa { font-weight: 600; color: #128C4A !important; text-decoration: none; }

@media (max-width: 520px) {
	.kcb-ast { bottom: 14px; }
	.kcb-ast--left { left: 12px; }
	.kcb-ast--right { right: 12px; }
	.kcb-ast__launcher { height: 48px; padding: 0 16px 0 14px; font-size: 14px; }
	.kcb-ast.is-open { left: 0; right: 0; bottom: 0; top: 0; }
	.kcb-ast__panel {
		width: 100vw; max-width: 100vw; height: 100%; max-height: none;
		border-radius: 0; border: 0;
		height: 100dvh;
	}
}
@media (prefers-reduced-motion: reduce) {
	.kcb-ast *, .kcb-ast { animation: none !important; transition: none !important; }
}
@media print { .kcb-ast { display: none !important; } }
