/* ==========================================================================
   AVM Arquitetura · Validador (/briefing/)
   ========================================================================== */

:root {
  --c-bg: #F4F1EC;
  --c-sand: #E6DDD0;
  --c-terra: #B4653F;
  --c-sage: #4F5D4E;
  --c-ink: #1F1E1C;
  --c-line: #CFC6B8;
  --f-title: 'Cormorant Garamond', Georgia, serif;
  --f-text: 'Manrope', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --grid: color-mix(in srgb, var(--c-line) 30%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.vd-body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--c-bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--c-line) 14%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--c-line) 14%, transparent) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  background-attachment: fixed;
  color: var(--c-ink);
  font-family: var(--f-text);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.vd-body.admin-bar .vd { height: calc(100dvh - 46px); }
@media (min-width: 783px) { body.vd-body.admin-bar .vd { height: calc(100dvh - 32px); } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; font-weight: 500; }

.vd {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 680px;
  margin: 0 auto;
}

/* Topo ------------------------------------------------------------------- */
.vd-top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: calc(12px + env(safe-area-inset-top)) 20px 0;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.vd-top__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vd-agent { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vd-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--c-terra);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 15px; letter-spacing: .04em;
}
.vd-online {
  position: absolute; right: 0; bottom: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #2E9E5B;
  border: 2px solid var(--c-bg);
}
.vd-agent__txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.vd-agent__txt strong { font-weight: 600; font-size: 17px; }
.vd-agent__txt small { font-size: 13px; color: color-mix(in srgb, var(--c-ink) 70%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Logo pequeno */
.logo { display: inline-flex; align-items: baseline; gap: 8px; color: var(--c-ink); text-decoration: none; white-space: nowrap; }
.logo-mark { width: 9px; height: 9px; background: var(--c-terra); align-self: center; }
.logo-name { font-family: var(--f-text); font-weight: 600; font-size: 12px; letter-spacing: .24em; }
.logo-sub { font-family: var(--f-title); font-style: italic; font-size: 16px; }
.logo-img { max-height: 32px; width: auto; }
@media (max-width: 420px) { .logo--sm .logo-name, .logo--sm .logo-sub { display: none; } .logo--sm .logo-mark { width: 12px; height: 12px; } }

/* Progresso: linha de cota que cresce */
.vd-progress { display: flex; align-items: center; gap: 14px; padding: 14px 0 12px; }
.vd-progress__line {
  position: relative; flex: 1; height: 13px;
}
.vd-progress__line::before {
  content: ''; position: absolute; left: 0; right: 0; top: 6px; height: 1px; background: var(--c-line);
}
.vd-progress__line::after {
  content: ''; position: absolute; left: 0; top: 0; width: 1px; height: 13px; background: var(--c-ink);
}
.vd-progress__fill {
  position: absolute; left: 0; right: 0; top: 6px; height: 1px;
  background: var(--c-terra);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .9s var(--ease);
}
.vd-progress__fill::after {
  content: ''; position: absolute; right: 0; top: -6px; width: 1px; height: 13px; background: var(--c-terra);
}
.vd-progress__lbl { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; font-weight: 500; min-width: 108px; text-align: right; }

/* Conversa --------------------------------------------------------------- */
.vd-chat {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 8px;
  display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain;
}
.msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 4px 16px 16px 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.msg.is-in { opacity: 1; transform: none; }
.msg__txt { margin: 0; }
.msg--agent { align-self: flex-start; background: #fff; border: 1px solid var(--c-line); }
.msg--user { align-self: flex-end; background: var(--c-ink); color: var(--c-bg); border-radius: 16px 4px 16px 16px; }
.msg--typing { padding: 14px 18px; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--c-ink) 45%, transparent); animation: vd-dot 1s infinite var(--ease); }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes vd-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Respostas -------------------------------------------------------------- */
.vd-dock {
  padding: 8px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--c-bg) 18px);
}
.vd-dock__in { display: flex; flex-direction: column; gap: 10px; }
.vd-opts { display: flex; flex-direction: column; gap: 8px; }
.vd-btn {
  appearance: none;
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 1px solid color-mix(in srgb, var(--c-ink) 28%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, #fff 70%, transparent);
  color: var(--c-ink);
  font: inherit; font-size: 17px; text-align: left; text-decoration: none;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.vd-btn:hover { border-color: var(--c-ink); background: #fff; }
.vd-btn:active, .vd-btn.is-on { background: var(--c-ink); color: var(--c-bg); border-color: var(--c-ink); }
.vd-btn:focus-visible, .vd-card:focus-visible, .vd-input:focus-visible, .vd-back:focus-visible { outline: 2px solid var(--c-terra); outline-offset: 2px; }
.vd-btn--solid { background: var(--c-ink); color: var(--c-bg); border-color: var(--c-ink); justify-content: center; font-weight: 500; }
.vd-btn--solid:hover { background: var(--c-terra); border-color: var(--c-terra); color: #fff; }
.vd-btn:disabled { opacity: .4; cursor: not-allowed; }
.vd-btn--check::before {
  content: ''; flex: 0 0 auto; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 3px;
}
.vd-btn--check.is-on::before { background: var(--c-terra); border-color: var(--c-terra); box-shadow: inset 0 0 0 3px var(--c-ink); }
.vd-btn--wa { justify-content: center; }
.vd-opts--multi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vd-opts--multi .vd-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.vd-hint { margin: 0; color: color-mix(in srgb, var(--c-ink) 70%, transparent); }

/* Texto livre (nome) */
.vd-text { display: flex; gap: 8px; }
.vd-input {
  flex: 1; min-width: 0; min-height: 52px; padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--c-ink) 35%, transparent); border-radius: 6px;
  background: #fff; color: var(--c-ink); font: inherit; font-size: 17px;
}
.vd-text .vd-btn { width: auto; flex: 0 0 auto; }
.vd-err { margin: 0; min-height: 0; color: #9a3d1a; font-size: 15px; }
.vd-err:empty { display: none; }

/* Cards de estilo 2x3 */
.vd-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 52dvh; overflow-y: auto; padding: 2px; }
.vd-card {
  position: relative; appearance: none; padding: 0; border: 1px solid var(--c-line); border-radius: 6px; overflow: hidden;
  background: #fff; color: var(--c-ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.vd-card__img { display: block; aspect-ratio: 1 / 1; background: var(--c-sand); overflow: hidden; }
.vd-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1s var(--ease); }
.vd-card:hover .vd-card__img img { transform: scale(1.04); }
.vd-card__lbl { display: block; padding: 10px 12px; font-size: 15px; line-height: 1.3; min-height: 48px; }
.vd-card__tick {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #fff; background: rgba(31, 30, 28, .35);
}
.vd-card.is-on { border-color: var(--c-ink); box-shadow: 0 0 0 1px var(--c-ink); }
.vd-card.is-on .vd-card__lbl { background: var(--c-ink); color: var(--c-bg); }
.vd-card.is-on .vd-card__tick { background: var(--c-terra); border-color: var(--c-terra); }
.vd-card.is-on .vd-card__tick::after {
  content: ''; position: absolute; left: 8px; top: 5px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
@media (max-width: 559px) {
  .vd-cards { max-height: 44dvh; gap: 8px; }
  .vd-card__img { aspect-ratio: 16 / 10; }
  .vd-card__lbl { font-size: 14px; padding: 8px 10px; min-height: 0; }
  .vd-card__tick { width: 22px; height: 22px; }
  .vd-card.is-on .vd-card__tick::after { left: 7px; top: 4px; width: 5px; height: 10px; }
}
@media (min-width: 560px) { .vd-cards { max-height: none; } }

.vd-back {
  align-self: flex-start;
  appearance: none; border: 0; background: none; padding: 8px 2px; min-height: 40px;
  color: color-mix(in srgb, var(--c-ink) 70%, transparent); font: inherit; font-size: 15px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.vd-back:hover { color: var(--c-terra); }
.vd-dock > .vd-back { margin-bottom: 4px; }

.vd-noscript { margin: 0; padding: 16px; background: #fff; border: 1px solid var(--c-line); }

/* Rodapé mínimo */
.vd-foot {
  padding: 8px 20px calc(10px + env(safe-area-inset-bottom));
  font-size: 13px; line-height: 1.5; text-align: center;
  color: color-mix(in srgb, var(--c-ink) 72%, transparent);
}
.vd-foot p { margin: 0; }
.vd-foot a { color: inherit; text-underline-offset: 3px; }
.vd-foot a:hover { color: var(--c-terra); }

@media (prefers-reduced-motion: reduce) {
  .msg { opacity: 1; transform: none; transition: none; }
  .vd-progress__fill, .vd-card__img img, .vd-btn { transition: none; }
  .dots i { animation: none; opacity: .6; }
}
