/* =========================================================================
   AVM Planejados · Validador (chat de orçamento)
   ========================================================================= */
:root {
	--wood: #A0714F; --wood-dk: #835D41; --graphite: #2E2E2E; --off: #F5F1EC; --sand: #E4D9CB; --ink: #1B1B1B;
	--ff-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
	--ff-body: "Inter", ui-sans-serif, system-ui, sans-serif;
	--muted: #5A534B;
	--line: rgba(27,27,27,.12);
	--ease: cubic-bezier(.2,.7,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.vd-body {
	background: var(--sand); color: var(--ink);
	font: 400 17px/1.5 var(--ff-body); -webkit-font-smoothing: antialiased;
	overflow: hidden;
}
:focus-visible { outline: 2px solid var(--wood-dk); outline-offset: 2px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.vd {
	height: 100vh;
	height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
	max-width: 640px; margin: 0 auto;
	display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
	background: var(--off);
	box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(27,27,27,.12);
}

/* ---------- Topo ---------- */
.vd-top { position: relative; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.vd-top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); min-height: 68px; }
.vd-agent { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vd-avatar {
	position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%;
	display: grid; place-items: center; background: var(--wood); color: #fff;
	font: 700 19px var(--ff-head); letter-spacing: .04em;
}
.vd-online { position: absolute; right: 0; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #1FAF5A; border: 2px solid #fff; }
.vd-agent-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.vd-agent-txt strong { font: 600 17px var(--ff-head); }
.vd-agent-txt span { font-size: 17px; line-height: 1.25; color: var(--muted); }
.vd-logo { flex: none; display: inline-flex; color: var(--ink); text-decoration: none; min-height: 48px; align-items: center; }
.vd-logo .logo-svg { width: 110px; height: auto; }
.vd-logo .logo-img { max-height: 36px; width: auto; }
.logo-post { fill: currentColor; }
.logo-tail { fill: var(--wood); }
.logo-line { stroke-width: 0; }
.logo-name { font: 700 25px var(--ff-head); letter-spacing: 5px; fill: currentColor; }
.logo-sub { font: 500 11.5px var(--ff-body); letter-spacing: 1.4px; fill: currentColor; opacity: .8; }
@media (max-width: 480px) { .vd-logo .logo-svg { width: 88px; } }
@media (max-width: 360px) { .vd-logo { display: none; } }

.vd-progress { height: 3px; background: var(--sand); }
.vd-progress span { display: block; height: 100%; width: 0; background: var(--wood); transition: width .5s var(--ease); }

/* ---------- Chat ---------- */
.vd-main {
	overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
	display: flex; flex-direction: column;
	padding: 20px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.vd-chat { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
.vd-msg { display: flex; max-width: 86%; animation: vdIn .35s var(--ease) both; }
.vd-msg-bot { align-self: flex-start; }
.vd-msg-user { align-self: flex-end; }
.vd-msg-user + .vd-msg-bot, .vd-msg-bot + .vd-msg-user { margin-top: 10px; }
.vd-bubble {
	padding: 12px 16px; border-radius: 18px; font-size: 17px; line-height: 1.45;
	overflow-wrap: anywhere;
}
.vd-msg-bot .vd-bubble { background: #fff; color: var(--ink); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(27,27,27,.06); }
.vd-msg-user .vd-bubble { background: var(--graphite); color: #fff; border-bottom-right-radius: 6px; }
.vd-bubble a { color: var(--wood-dk); }
@keyframes vdIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.vd-typing .vd-bubble { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.vd-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9A9187; animation: vdDot 1s infinite ease-in-out; }
.vd-typing span:nth-child(2) { animation-delay: .15s; }
.vd-typing span:nth-child(3) { animation-delay: .3s; }
.vd-typing em { font-style: normal; font-size: 17px; margin-left: 8px; }
@keyframes vdDot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.vd-foot { padding: 20px 0 16px; text-align: center; color: var(--muted); font-size: 17px; border-top: 1px solid var(--line); }
.vd-foot p { margin: 2px 0; }
.vd-foot a { color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Controles (respostas) ---------- */
.vd-controls {
	position: relative; z-index: 2; background: var(--off);
	padding: 0 max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
	box-shadow: 0 -12px 24px -12px rgba(27,27,27,.12);
}
.vd-controls-inner { max-height: 58dvh; overflow-y: auto; padding-top: 12px; }
.vd-back {
	display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin-bottom: 4px;
	background: none; border: 0; color: var(--muted); font-size: 17px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px;
}
.vd-back[hidden] { display: none; }
.vd-back:hover { color: var(--ink); }

.vd-opts { display: flex; flex-direction: column; gap: 8px; }
.vd-opts:empty { display: none; }
.vd-opt {
	display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
	min-height: 52px; padding: 12px 18px; border-radius: 14px;
	background: #fff; color: var(--ink); border: 1px solid rgba(27,27,27,.18);
	font: 500 17px/1.25 var(--ff-body); text-align: center; text-decoration: none; cursor: pointer;
	transition: background-color .2s, border-color .2s, color .2s, transform .15s;
	animation: vdIn .3s var(--ease) both;
}
.vd-opt:hover { border-color: var(--ink); }
.vd-opt:active { transform: scale(.985); }
.vd-opt-primary, .vd-start { background: var(--graphite); color: #fff; border-color: var(--graphite); font-weight: 600; font-family: var(--ff-head); }
.vd-opt-primary:hover { background: var(--ink); }
.vd-opt-primary:disabled { opacity: .45; cursor: not-allowed; }
.vd-opt-whats { background: #0F7A40; border-color: #0F7A40; color: #fff; font: 600 18px var(--ff-head); min-height: 56px; }
.vd-opt-whats::before {
	content: ""; width: 22px; height: 22px; flex: none; background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2a8.2 8.2 0 0 1-4.2-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.3-.4.7-1.4.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5c-.2 0-.4.1-.6.3-.2.2-.8.8-.8 2s.8 2.3 1 2.5c.1.2 1.6 2.5 4 3.5 1.5.6 2 .7 2.8.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.1-1.2l-.4-.3z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2a8.2 8.2 0 0 1-4.2-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.3-.4.7-1.4.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5c-.2 0-.4.1-.6.3-.2.2-.8.8-.8 2s.8 2.3 1 2.5c.1.2 1.6 2.5 4 3.5 1.5.6 2 .7 2.8.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.1-1.2l-.4-.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.vd-opt-whats:hover { background: #0B6534; border-color: #0B6534; }
.vd-opt-ghost { background: transparent; }

/* Múltipla escolha com ícones */
.vd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vd-opt-check { justify-content: flex-start; text-align: left; position: relative; padding: 10px 40px 10px 12px; min-height: 60px; }
.vd-opt-check span { flex: 1; }
.vd-ico { width: 26px; height: 26px; flex: none; color: var(--wood-dk); }
.vd-tick { position: absolute; right: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border: 1.5px solid rgba(27,27,27,.3); border-radius: 6px; }
.vd-opt-check[aria-pressed="true"] { background: var(--graphite); color: #fff; border-color: var(--graphite); }
.vd-opt-check[aria-pressed="true"] .vd-ico { color: #E5C9AE; }
.vd-opt-check[aria-pressed="true"] .vd-tick { border-color: #fff; background: #fff; }
.vd-opt-check[aria-pressed="true"] .vd-tick::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--graphite); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.vd-continue { margin-top: 4px; }
@media (max-width: 360px) { .vd-grid { grid-template-columns: 1fr; } }

/* Nome */
.vd-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.vd-form input {
	min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 1px solid rgba(27,27,27,.25);
	background: #fff; font: 400 17px var(--ff-body); color: var(--ink); width: 100%; min-width: 0;
}
.vd-form input:focus { outline: none; border-color: var(--graphite); box-shadow: 0 0 0 3px rgba(160,113,79,.25); }
.vd-form input.vd-erro { border-color: #A23B2A; }
.vd-form .vd-opt { width: auto; padding: 12px 22px; }
.vd-hint { grid-column: 1 / -1; margin: 0; color: #8E3222; font-size: 17px; }

@media (min-width: 641px) {
	body.vd-body { padding: 0; }
	.vd-opts-single .vd-opt, .vd-opts-final .vd-opt { justify-content: flex-start; text-align: left; }
	.vd-opts-final .vd-opt-whats { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
