/* Fonte do app (Quicksand), hospedada no próprio site. */
@font-face { font-family: "Quicksand"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/quicksand-500.woff2") format("woff2"); }
@font-face { font-family: "Quicksand"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/quicksand-600.woff2") format("woff2"); }
@font-face { font-family: "Quicksand"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/quicksand-700.woff2") format("woff2"); }

/* Mesmas cores do app: azul de destaque #1E88E5, fundo/superfície claros e escuros. */
:root {
  --azul: #0056b3;
  --azul-2: #1e88e5;
  --azul-claro: #e3f2fd;
  --fundo: #f5f5f7;
  --card: #ffffff;
  --texto: rgba(0,0,0,.87);
  --suave: rgba(0,0,0,.54);
  --borda: rgba(0,0,0,.12);
  --minha: #1e88e5;
  --dele: #ffffff;
  --verde: #2e9e5b;
  --vermelho: #d93a3a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #121212; --card: #1e1e1e; --texto: #ffffff; --suave: rgba(255,255,255,.6);
    --borda: rgba(255,255,255,.12); --minha: #1e88e5; --dele: #2a2a2d; --azul-claro: rgba(30,136,229,.18);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, input, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font-family: inherit; }
h1, h2, h3 { font-weight: 700; }
body {
  font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo); color: var(--texto); font-size: 15px;
}
.oculto { display: none !important; }
.suave { color: var(--suave); font-size: 13px; }
.erro { color: var(--vermelho); font-size: 13px; margin: 4px 0; }
/* Logo oficial (imagem) — troca sozinha para a versão clara no modo escuro. */
.logo-img { display: block; margin: 0 auto; }
.logo-img img { display: block; width: 100%; height: auto; }
.logo-img.compacto { width: 150px; margin-bottom: 4px; }
.logo-img.solto { width: min(230px, 60vw); margin-bottom: 8px; }
.logo-img.grande { width: min(290px, 70vw); margin-bottom: 12px; }

.tela { min-height: 100%; padding: 16px; }
.centro { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cartao {
  background: var(--card); border: 1px solid var(--borda); border-radius: 20px;
  padding: 28px; width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.cartao.largo { max-width: 460px; }
.cartao h2 { margin: 8px 0 12px; }
.cartao form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
input[type=password], input[type=search], textarea, input[type=text] {
  width: 100%; padding: 13px 16px; border: 1px solid var(--borda); border-radius: 16px;
  background: var(--fundo); color: var(--texto); font: inherit; outline: none;
}
input:focus, textarea:focus { border-color: var(--azul-2); }
button { font: inherit; cursor: pointer; }
.primario, .secundario {
  padding: 13px 20px; border-radius: 16px; border: 0; font-weight: 700;
}
.primario { background: var(--azul-2); color: #fff; }
.primario:hover { background: var(--azul); }
.secundario { background: var(--azul-claro); color: var(--azul-2); margin-top: 10px; }
.link { background: none; border: 0; color: var(--suave); text-decoration: underline; margin-top: 14px; font-size: 13px; }
.passos { text-align: left; padding-left: 20px; line-height: 1.6; margin: 8px 0 16px; }
.qr { display: flex; justify-content: center; background: #fff; border-radius: 12px; border: 1px solid var(--borda); overflow: hidden; }
.qr svg { width: min(360px, 82vw); height: auto; display: block; }
.barra { height: 10px; background: var(--azul-claro); border-radius: 6px; overflow: hidden; margin: 16px 0 8px; }
#barra-prog { height: 100%; width: 0%; background: var(--azul-2); transition: width .3s; }

/* ───── app ───── */
#tela-app { display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: var(--alt, 100dvh); overflow: hidden; }
#lateral { position: relative; width: 380px; min-height: 0; max-width: 100%; border-right: 1px solid var(--borda); background: var(--card); display: flex; flex-direction: column; }
#painel { flex: 1; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--fundo); }
.topo { position: relative; flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--borda); background: var(--card); min-height: 58px; }
.topo .eu, .topo .titulo { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topo .titulo { flex-direction: column; align-items: flex-start; gap: 0; }
.topo .titulo > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.acoes { display: flex; gap: 2px; }
.icone { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--texto); display: inline-flex; align-items: center; justify-content: center; }
.icone:hover { background: var(--azul-claro); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--azul-claro);
  object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: var(--azul-2); font-weight: 700;
}
.avatar.grande { width: 110px; height: 110px; font-size: 44px; }
.badge { font-style: normal; background: var(--azul-2); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }
.busca { flex: none; padding: 10px 12px; }
.lista { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.item { display: flex; gap: 12px; padding: 10px 14px; cursor: pointer; align-items: center; border-bottom: 1px solid var(--borda); }
.item:hover, .item.ativo { background: var(--azul-claro); }
.item .meio { flex: 1; min-width: 0; }
.item .l1 { display: flex; justify-content: space-between; gap: 8px; }
.item .nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .hora { font-size: 12px; color: var(--suave); flex: none; }
.item .previa { color: var(--suave); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .l2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.vazio { margin: auto; text-align: center; padding: 24px; }
.msgs-area { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 6%; display: flex; flex-direction: column; gap: 4px; }
.dia { align-self: center; background: var(--card); color: var(--suave); font-size: 12px; padding: 3px 12px; border-radius: 10px; margin: 8px 0; border: 1px solid var(--borda); }
.bolha {
  max-width: min(72%, 560px); padding: 8px 12px 6px; border-radius: 16px; background: var(--dele);
  border: 1px solid var(--borda); align-self: flex-start; word-wrap: break-word; overflow-wrap: anywhere;
}
.bolha.minha { align-self: flex-end; background: var(--minha); border-color: transparent; color: #fff; }
.bolha .quem { font-size: 12px; font-weight: 700; color: var(--azul-2); }
.bolha.minha .quem, .bolha.minha .acao { color: #fff; }
.bolha.minha .rodape { color: rgba(255,255,255,.8); }
.bolha.minha .rodape .azul { color: #b3e5fc; }
.bolha.minha .cit { border-left-color: #fff; background: rgba(255,255,255,.16); }
.bolha.minha .aviso { color: rgba(255,255,255,.8); }
.bolha .corpo { white-space: pre-wrap; }
.bolha .rodape { font-size: 11px; color: var(--suave); text-align: right; margin-top: 2px; }
.bolha .rodape .azul { color: #2196f3; }
.bolha .cit { border-left: 3px solid var(--azul-2); padding: 3px 8px; margin-bottom: 4px; background: rgba(0,0,0,.05); border-radius: 4px; font-size: 13px; }
.bolha img, .bolha video { max-width: 100%; max-height: 360px; border-radius: 8px; display: block; }
.bolha img.fig { max-height: 160px; background: none; }
.bolha audio { max-width: 100%; }
.bolha .aviso { color: var(--suave); font-style: italic; }
.bolha .doc { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.bolha .acao { background: none; border: 0; color: var(--azul-2); text-decoration: underline; cursor: pointer; padding: 0; font-size: 13px; }
.mais { align-self: center; background: var(--card); border: 1px solid var(--borda); border-radius: 10px; padding: 6px 14px; color: var(--azul-2); }
.compor { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--borda); background: var(--card); }
.compor textarea { resize: none; max-height: 140px; border-radius: 22px; }
.enviar { background: var(--azul-2); color: #fff; border: 0; width: 42px; height: 42px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.compor .gravando { color: var(--vermelho); animation: pisca 1s infinite; }
@keyframes pisca { 50% { opacity: .35; } }
.resp-bar { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; background: var(--card); border-top: 1px solid var(--borda); }
.envio-prog { flex: none; padding: 4px 14px; background: var(--card); border-top: 1px solid var(--borda); font-size: 12px; color: var(--suave); display: flex; gap: 8px; align-items: center; }
.envio-prog #envio-barra { height: 6px; width: 0; background: var(--azul-2); border-radius: 3px; flex: 1; max-width: 0; transition: max-width .2s; }
.so-celular { display: none; }


/* ───── ligação ───── */
.ligacao { position: fixed; inset: 0; background: #0b1220; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.ligacao #v-remoto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.ligacao.com-video #v-remoto { display: block; }
.ligacao #v-local { position: absolute; right: 16px; bottom: 120px; width: 150px; border-radius: 12px; display: none; background: #000; border: 2px solid rgba(255,255,255,.4); }
.ligacao.com-video #v-local { display: block; }
.lig-centro { position: relative; text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.ligacao.ativa-video .lig-centro { position: absolute; top: 18px; left: 18px; text-align: left; }
.ligacao.ativa-video .lig-centro .avatar { display: none; }
.lig-botoes { position: absolute; bottom: 36px; display: flex; gap: 22px; }
.lig-botoes button { width: 64px; height: 64px; border-radius: 50%; border: 0; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.lig-botoes .ic { width: 28px; height: 28px; }
.verde { background: var(--verde); } .vermelho { background: var(--vermelho); } .cinza { background: rgba(255,255,255,.22); }
.cinza.off { background: #fff; color: #000; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; max-width: 90%; }

/* ───── ícones (mesmos do app) ───── */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; display: block; }
.ic.grande { width: 28px; height: 28px; }
#conversa { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.compor .ic { color: var(--suave); }
.enviar .ic { color: #fff; width: 22px; height: 22px; }
.compor .gravando .ic { color: var(--vermelho); }

/* ───── barra fixa de baixo (igual ao app) ───── */
.abas-barra { flex: none; display: flex; background: var(--card); border-top: 1px solid var(--borda); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.abas-barra button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--suave); font-size: 12px; font-weight: 600; border-radius: 12px; }
.abas-barra button:hover { background: var(--azul-claro); }
.abas-barra button.ativa { color: var(--azul-2); }
.abas-barra .badge { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; font-size: 10px; padding: 1px 6px; }

/* ───── menu (3 tracinhos) ───── */
.menu { position: absolute; top: calc(100% - 6px); right: 10px; z-index: 30; min-width: 240px; background: var(--card); border: 1px solid var(--borda); border-radius: 16px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; background: none; color: var(--texto); border-radius: 10px; text-align: left; text-decoration: none; font-size: 15px; font-weight: 500; }
.menu-item .ic { color: var(--suave); width: 22px; height: 22px; }
.menu-item:hover { background: var(--azul-claro); }
.menu-item.perigo, .menu-item.perigo .ic { color: var(--vermelho); }
.menu-sep { height: 1px; background: var(--borda); margin: 4px 6px; }

/* ───── feed (aba Post) ───── */
.lista.feed { padding: 10px; background: var(--fundo); }
.post { background: var(--card); border: 1px solid var(--borda); border-radius: 16px; margin-bottom: 12px; overflow: hidden; }
.post .cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.post .cab .quem { flex: 1; min-width: 0; }
.post .cab .nome { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .corpo-texto { padding: 4px 14px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .corpo-cor { padding: 36px 18px; text-align: center; font-weight: 700; font-size: 20px; color: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .fotos { display: grid; gap: 2px; }
.post .fotos.duas { grid-template-columns: 1fr 1fr; }
.post .fotos img { width: 100%; max-height: 420px; object-fit: cover; display: block; background: var(--azul-claro); }
.post .rod { display: flex; gap: 16px; padding: 8px 14px 12px; color: var(--suave); font-size: 13px; }
.post .rod span { display: inline-flex; align-items: center; gap: 5px; }
.post .rod .ic { width: 18px; height: 18px; }
.post .musica { padding: 0 14px 10px; color: var(--suave); font-size: 13px; }

/* ───── ligações ───── */
.item .ic.lig { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.item .perdida .nome, .item .perdida .ic.lig { color: var(--vermelho); }
.item .ligar { background: none; border: 0; color: var(--azul-2); padding: 8px; border-radius: 50%; display: inline-flex; }
.item .ligar:hover { background: var(--azul-claro); }

/* ───── celular ───── */
input[type=password], input[type=search], textarea, input[type=text] { font-size: 16px; } /* evita o zoom automático ao tocar (iPhone) */
@media (max-width: 760px) {
  .tela { padding: 12px; }
  .cartao { padding: 22px 18px; border-radius: 18px; }
  .icone { min-width: 44px; min-height: 44px; }
  .topo { padding: 6px 8px 6px 12px; }
  .compor { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 2px; }
  .abas-barra { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
  .abas-barra button { min-height: 52px; }
  .item { padding: 12px 14px; }
  .menu { left: 10px; right: 10px; min-width: 0; }
  .menu-item { padding: 14px 12px; }
  .ligacao #v-local { width: 96px; bottom: 130px; right: 10px; }
  .lig-botoes { gap: 16px; bottom: calc(28px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .post .fotos img { max-height: 320px; }
  #lateral { width: 100%; }
  .menu { right: 8px; }
  #painel { position: absolute; inset: 0; z-index: 5; }
  #tela-app:not(.conversa-aberta) #painel { display: none; }
  #tela-app.conversa-aberta #lateral { display: none; }
  .so-celular { display: inline-flex; }
  .msgs { padding: 10px 8px; }
  .bolha { max-width: 86%; }
}

/* ───── botão "ir para a última mensagem" (igual ao app) ───── */
.btn-fim { position: absolute; right: 14px; bottom: 14px; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--borda); background: var(--card); color: var(--azul-2); box-shadow: 0 2px 8px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; }
.btn-fim:hover { background: var(--azul-claro); }
.btn-fim .badge { position: absolute; top: -6px; right: -4px; margin: 0; }

/* ───── aviso e código de segurança ───── */
.aviso-chave { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card); border-bottom: 2px solid #f9a825; font-size: 13px; }
.aviso-chave span { flex: 1; }
.aviso-chave .secundario { margin: 0; padding: 6px 10px; }
.d-codigo { max-width: 420px; width: calc(100% - 32px); border: 1px solid var(--borda); border-radius: 16px; background: var(--card); color: var(--texto); padding: 20px; }
.d-codigo::backdrop { background: rgba(0,0,0,.5); }
.d-codigo h3 { margin: 0 0 8px; }
.codigo-num { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; font-weight: 600; letter-spacing: 1px; margin: 16px 0; user-select: all; }

.aviso-bloq { border-bottom-color: #e53935; }

/* ───── seta para o início da conversa (acima da seta para o fim) ───── */
.btn-inicio { position: absolute; right: 14px; bottom: 68px; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--borda); background: var(--card); color: var(--azul-2); box-shadow: 0 2px 8px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; }
.btn-inicio:hover { background: var(--azul-claro); }

/* ───── reação animada ───── */
.reacao-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.28); animation: reacao-entra .2s ease; cursor: pointer; }
.reacao-caixa { width: min(320px, 72vw); aspect-ratio: 1; pointer-events: none; }
@keyframes reacao-entra { from { opacity: 0; } to { opacity: 1; } }
.reacao-bolha { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.reacao-mini { flex: none; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.reacao-mini svg { width: 100%; height: 100%; display: block; }
.reacao-txt { display: flex; flex-direction: column; }
.reacao-txt b { font-weight: 700; }
.bolha.minha .reacao-txt .suave { color: rgba(255,255,255,.8); }

/* ───── bolha de áudio com ondas ───── */
.audio-w { display: flex; align-items: center; gap: 10px; width: 250px; max-width: 100%; padding: 2px 0; }
.audio-play { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0; background: var(--azul-claro); color: var(--azul-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.audio-play .ic { width: 26px; height: 26px; }
.bolha.minha .audio-play { background: rgba(255,255,255,.22); color: #fff; }
.audio-meio { flex: 1; min-width: 0; }
.audio-onda { display: block; width: 100%; height: 34px; touch-action: pan-y; cursor: pointer; }
.audio-linha { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.audio-tempo { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-vel { border: 0; border-radius: 9px; padding: 2px 8px; font-size: 12px; font-weight: 800; background: var(--azul-claro); color: var(--azul-2); }
.bolha.minha .audio-vel { background: rgba(255,255,255,.22); color: #fff; }

/* ───── ir à mensagem respondida ───── */
.bolha .cit { cursor: pointer; }
.bolha.destaque { animation: destaque 1.7s ease; }
@keyframes destaque { 0%, 60% { box-shadow: 0 0 0 3px var(--azul-2); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* ───── status do contato ───── */
.st-online { color: var(--verde); font-weight: 700; }
.st-off { color: var(--suave); }
@media (prefers-reduced-motion: reduce) {
  .reacao-overlay, .bolha.destaque { animation: none; }
}
