:root {
  --verde: #00843D;
  --verde-escuro: #006b31;
  --fundo: #0b0f0d;
  --topo: #111a15;
  --barra: #111a15;
  --bot: #ffffff;
  --bot-texto: #16201a;
  --eu-texto: #ffffff;
  --cinza: #8a968f;
  --erro: #ff8a80;
  --raio: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #050706;
  color: #eef3f0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--fundo);
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* Topo */
.topo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--topo);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.topo-texto { display: flex; flex-direction: column; line-height: 1.2; }
.topo-texto strong { font-size: 16px; }
.status { font-size: 13px; color: #7fd6a3; }
.status::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; background: #35d07f; vertical-align: 1px;
}

/* Mensagens */
.mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.linha { display: flex; align-items: flex-end; gap: 8px; animation: surgir .22s ease-out; }
.linha.eu { justify-content: flex-end; }
.linha .mini { width: 28px; height: 28px; border-radius: 50%; flex: none; visibility: hidden; }
.linha.primeira .mini { visibility: visible; }

.balao {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: var(--raio);
  white-space: pre-line;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.bot .balao { background: var(--bot); color: var(--bot-texto); border-bottom-left-radius: 5px; }
.eu .balao { background: var(--verde); color: var(--eu-texto); border-bottom-right-radius: 5px; }
.eu .balao.pulou { background: #1d2a22; color: var(--cinza); font-style: italic; }

.digitando .balao { display: inline-flex; gap: 4px; padding: 13px 14px; }
.digitando i {
  width: 7px; height: 7px; border-radius: 50%; background: #9aa69f;
  animation: pulo 1.1s infinite ease-in-out;
}
.digitando i:nth-child(2) { animation-delay: .15s; }
.digitando i:nth-child(3) { animation-delay: .3s; }

@keyframes pulo { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes surgir { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Barra de resposta */
.barra {
  background: var(--barra);
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  min-height: 64px;
}
.barra:empty { display: none; }

.form-linha { display: flex; gap: 8px; align-items: flex-end; }
.entrada {
  flex: 1;
  width: 100%;
  min-height: 46px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 24px;
  background: #1f2b24;
  color: #fff;
  font: inherit;
  font-size: 16px;
  outline: none;
  resize: none;
}
textarea.entrada { border-radius: 18px; max-height: 140px; }
.entrada::placeholder { color: #7d8a83; }
.entrada:focus { border-color: var(--verde); }
.entrada[aria-invalid="true"] { border-color: var(--erro); }

.enviar {
  flex: none;
  width: 46px; height: 46px;
  border: 0; border-radius: 50%;
  background: var(--verde);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
}
.enviar:hover { background: var(--verde-escuro); }
.enviar svg { width: 20px; height: 20px; }

.erro-campo { color: var(--erro); font-size: 14px; margin: 0 6px 8px; }
.erro-campo:empty { display: none; }

.acoes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.botao {
  border: 0;
  border-radius: 24px;
  padding: 12px 20px;
  background: var(--verde);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.botao:hover { background: var(--verde-escuro); }
.botao.secundario { background: transparent; color: #b9c6bf; border: 1px solid #34443a; font-weight: 500; }
.botao.secundario:hover { background: #1b2620; }
.botao.largo { width: 100%; }

.opcoes { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.opcoes .botao { background: #1f2b24; border: 1px solid #2f4136; font-weight: 500; }
.opcoes .botao:hover, .opcoes .botao:focus-visible { background: var(--verde); border-color: var(--verde); }

.grade-uf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 7px;
  max-height: 42vh;
  overflow-y: auto;
  padding: 2px;
}
.grade-uf button {
  border: 1px solid #2f4136;
  border-radius: 12px;
  background: #1f2b24;
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 11px 0;
  cursor: pointer;
}
.grade-uf button:hover, .grade-uf button:focus-visible { background: var(--verde); border-color: var(--verde); }

.pular { margin-top: 8px; text-align: center; }
.link-sutil { background: none; border: 0; color: #9fb0a7; font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.legal { text-align: center; font-size: 13px; color: #8a968f; margin: 8px 0 0; }
.legal a { color: #b9c6bf; }

button:focus-visible, a:focus-visible, .entrada:focus-visible { outline: 2px solid #7fd6a3; outline-offset: 2px; }

/* Campo isca: fora da tela para pessoas, visível para robôs */
.isca { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.noscript { text-align: center; padding: 20px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}
