:root {
  --petroleo: #1e4a38; --petroleo2: #2b6249; --ipe: #d2a04a; --ipe-cl: #f5e9cf; --fundo: #f3eee4; --card: #ffffff;
  --texto: #18241d; --suave: #59675e; --linha: #e3dccd; --verde: #1fae64; --erro: #b42318;
  --sombra: 0 1px 2px rgba(24,36,29,.06), 0 8px 24px -12px rgba(24,36,29,.18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Instrument Sans', system-ui, sans-serif; background: var(--fundo); color: var(--texto); display: flex; flex-direction: column; font-size: 16px; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ipe); outline-offset: 2px; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* topo */
.topo { background: var(--petroleo); color: #fff; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.topo .in { max-width: 820px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.volta { color: #fff; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; text-decoration: none; }
.volta:hover { background: rgba(255,255,255,.08); }
.av { position: relative; width: 44px; height: 44px; border-radius: 14px; background: var(--ipe); color: var(--petroleo); display: grid; place-items: center; font: 600 16px 'Fraunces', sans-serif; flex: none; }
.av::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; background: var(--verde); border: 2.5px solid var(--petroleo); }
.quem { flex: 1; min-width: 0; }
.quem b { display: block; font: 700 17px/1.2 'Fraunces', sans-serif; }
.quem small { color: #b8ccd2; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conta { border: 1px solid rgba(255,255,255,.28); background: transparent; color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.conta:hover { background: rgba(255,255,255,.08); }
.conta svg.i { width: 18px; height: 18px; }

/* aviso para salvar a conversa */
.salvar { display: none; background: var(--ipe-cl); border-bottom: 1px solid #f1dc8a; }
.salvar.on { display: block; }
.salvar .in { max-width: 820px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.salvar span { flex: 1; }
.salvar button { background: var(--petroleo); color: #fff; border: 0; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.salvar .x { background: transparent; color: var(--suave); padding: 4px 6px; font-size: 18px; }

/* mensagens */
#lista { flex: 1; overflow-y: auto; padding: 20px 16px 12px; }
#lista .in { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.m { max-width: min(86%, 560px); padding: 11px 15px; border-radius: 18px; background: var(--card); box-shadow: var(--sombra); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 16px; animation: entra .18s ease-out; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .m, .dig i { animation: none !important; } }
.m.cliente { align-self: flex-end; background: var(--petroleo); color: #fff; border-bottom-right-radius: 6px; }
.m.ia, .m.humano { align-self: flex-start; border-bottom-left-radius: 6px; }
.m.humano { border-left: 3px solid var(--ipe); }
.m.sis { align-self: center; background: transparent; box-shadow: none; color: var(--suave); font-size: 13px; text-align: center; padding: 4px 10px; }
.m img.anexo { display: block; max-width: 240px; width: 100%; border-radius: 12px; margin-top: 8px; }
.m .loc { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; font-size: 14px; opacity: .92; }
.botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; white-space: normal; }
.botoes a, .botoes button { display: inline-flex; align-items: center; gap: 6px; background: var(--ipe); color: var(--petroleo); padding: 10px 16px; border-radius: 999px; text-decoration: none; border: 0; font-weight: 700; font-size: 15px; }
.botoes a.sec { background: var(--fundo); }
.pix { margin-top: 12px; white-space: normal; }
.pix img { display: block; width: 200px; max-width: 100%; margin: 4px 0 10px; border-radius: 10px; background: #fff; }
.pix code { display: block; font-size: 11px; background: var(--fundo); padding: 8px 10px; border-radius: 10px; word-break: break-all; max-height: 84px; overflow: auto; }
.dig { align-self: flex-start; background: var(--card); box-shadow: var(--sombra); border-radius: 18px; border-bottom-left-radius: 6px; padding: 14px 16px; display: flex; gap: 5px; }
.dig i { width: 7px; height: 7px; border-radius: 50%; background: #9db0b6; animation: pula 1s infinite; }
.dig i:nth-child(2) { animation-delay: .15s; } .dig i:nth-child(3) { animation-delay: .3s; }
@keyframes pula { 0%, 60%, 100% { transform: none; opacity: .6; } 30% { transform: translateY(-4px); opacity: 1; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.chips button { background: var(--card); border: 1.5px solid var(--linha); color: var(--petroleo); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; }
.chips button:hover { border-color: var(--petroleo); }

/* composição */
#prev { max-width: 820px; width: 100%; margin: 0 auto; display: flex; gap: 8px; padding: 0 16px; flex-wrap: wrap; }
#prev .ft { position: relative; }
#prev img { width: 60px; height: 60px; object-fit: cover; border-radius: 12px; display: block; }
#prev button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--texto); color: #fff; font-size: 13px; line-height: 1; }
.compor { background: var(--card); border-top: 1px solid var(--linha); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.compor form { max-width: 820px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.campo { flex: 1; display: flex; align-items: flex-end; background: var(--fundo); border: 1.5px solid transparent; border-radius: 24px; padding: 4px 4px 4px 6px; transition: border-color .15s; }
.campo:focus-within { border-color: var(--petroleo2); background: #fff; }
textarea { flex: 1; resize: none; border: 0; background: transparent; padding: 9px 8px; max-height: 140px; line-height: 1.4; outline: none; }
.ib { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--suave); display: grid; place-items: center; flex: none; }
.ib:hover { background: rgba(30,74,56,.08); color: var(--petroleo); }
.enviar { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--petroleo); color: #fff; display: grid; place-items: center; flex: none; }
.enviar:disabled { opacity: .5; }
.rodape { text-align: center; color: var(--suave); font-size: 12px; padding: 6px 16px 0; max-width: 820px; margin: 0 auto; }
.rodape a { color: inherit; text-decoration: underline; }

/* janelas (login e mapa) */
.janela { position: fixed; inset: 0; z-index: 50; background: rgba(14,26,19,.55); display: none; align-items: flex-end; justify-content: center; }
.janela.on { display: flex; }
.caixa { background: #fff; width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; animation: sobe .2s ease-out; }
@keyframes sobe { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .janela { align-items: center; } .caixa { border-radius: 22px; } }
.caixa h2 { font: 600 22px/1.2 'Fraunces', sans-serif; color: var(--petroleo); margin-bottom: 6px; }
.caixa p.sub { color: var(--suave); font-size: 15px; margin-bottom: 16px; }
.abas { display: flex; background: var(--fundo); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.abas button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--suave); }
.abas button.on { background: #fff; color: var(--petroleo); box-shadow: var(--sombra); }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
.inp { width: 100%; border: 1.5px solid var(--linha); border-radius: 12px; padding: 12px 14px; font-size: 16px; background: #fff; }
.inp:focus { border-color: var(--petroleo2); outline: none; }
.btn { width: 100%; margin-top: 18px; min-height: 50px; border: 0; border-radius: 14px; background: var(--petroleo); color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ipe { background: var(--ipe); color: var(--petroleo); }
.btn.linha { background: transparent; color: var(--petroleo); border: 1.5px solid var(--linha); margin-top: 10px; }
.btn:disabled { opacity: .55; }
.msg-erro { color: var(--erro); font-size: 14px; margin-top: 10px; min-height: 1em; }
.fechar { float: right; border: 0; background: var(--fundo); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; color: var(--suave); }
.nota-pequena { color: var(--suave); font-size: 13px; margin-top: 12px; }

/* mapa */
.caixa.mapa { max-width: 640px; }
.busca { position: relative; }
.busca .inp { padding-left: 42px; }
.busca svg.i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--suave); width: 19px; height: 19px; }
#resultados { list-style: none; border: 1.5px solid var(--linha); border-top: 0; border-radius: 0 0 12px 12px; margin-top: -6px; padding-top: 6px; max-height: 200px; overflow: auto; display: none; }
#resultados.on { display: block; }
#resultados li button { width: 100%; text-align: left; border: 0; background: #fff; padding: 10px 14px; font-size: 14px; border-top: 1px solid var(--fundo); }
#resultados li button:hover { background: var(--fundo); }
#resultados li b { display: block; font-size: 15px; }
#mapa { height: 300px; border-radius: 14px; margin-top: 12px; background: #dfe8ea; z-index: 0; }
.pino { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; background: var(--petroleo); transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0,0,0,.3); }
.escolhido { margin-top: 12px; background: var(--fundo); border-radius: 12px; padding: 12px 14px; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.linha-acoes { display: flex; gap: 8px; margin-top: 10px; }
.linha-acoes .btn { margin-top: 0; }
.ok-local { border: 0; background: transparent; color: var(--petroleo); font-weight: 700; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; padding: 4px 0; }

@media (max-width: 520px) {
  .conta span { display: none; }
  .conta { padding: 8px 10px; }
  .m { max-width: 90%; }
  #mapa { height: 260px; }
}

/* login com Google */
.g-bloco { margin-bottom: 4px; }
#g-btn { display: flex; justify-content: center; min-height: 44px; }
.ou { display: flex; align-items: center; gap: 12px; color: var(--suave); font-size: 13px; margin: 16px 0 14px; }
.ou::before, .ou::after { content: ""; flex: 1; height: 1px; background: var(--linha); }

/* suporte humano */
.conta.suporte { border-color: rgba(210,160,74,.55); }
.conta.suporte:hover { background: rgba(210,160,74,.14); }
.faixa-humano { background: #fff4cf; color: #5a4300; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid #f2d77a; }
.faixa-humano[hidden] { display: none; }
.faixa-humano svg.i { width: 16px; height: 16px; }
@media (max-width: 420px) { .conta.suporte span { display: none; } .conta.suporte { padding: 8px 10px; } }

/* marca Nome na Porta */
.av { background: transparent; overflow: visible; }
.av img { width: 100%; height: 100%; border-radius: inherit; display: block; }
