/* VaiFluir — identidade: azul-escuro institucional + verde-turquesa */
:root {
  --azul: #1E3A6E; --azul-2: #2B4F8E; --turquesa: #3FA394; --turquesa-claro: #E3F4F1;
  --fundo: #FFFFFF; --fundo-2: #F4F7FB; --linha: #E1E7EF; --texto: #1B2433; --texto-2: #5B6779;
  --balao: #FFFFFF; --balao-meu: #E3F4F1; --vermelho: #D64545; --amarelo: #F2B630; --roxo: #6A4C93;
  --raio: 14px; --sombra: 0 2px 10px rgba(20, 40, 80, .08);
  color-scheme: light;
}
[data-tema="escuro"] {
  --fundo: #0F1724; --fundo-2: #162133; --linha: #253249; --texto: #E6ECF5; --texto-2: #9AA7BB;
  --balao: #1B2A40; --balao-meu: #1D4A47; --turquesa-claro: #17383A; --azul: #5B8BD6; --azul-2: #7AA2E0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); background: var(--fundo); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--azul); }

.btn { border: 0; border-radius: 10px; padding: .65rem 1rem; cursor: pointer; font-weight: 600; }
.btn-primario { background: var(--azul); color: #fff; }
[data-tema="escuro"] .btn-primario { background: var(--turquesa); }
.btn-primario:hover { filter: brightness(1.08); }
.btn-claro { background: var(--fundo-2); border: 1px solid var(--linha); }
.btn-grande { width: 100%; padding: .9rem; font-size: 1.05rem; }
.btn-icone { background: none; border: 0; font-size: 1.25rem; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  display: inline-grid; place-items: center; color: var(--texto-2); text-decoration: none; flex: none; }
.btn-icone:hover { background: var(--fundo-2); }
.contador { background: var(--turquesa); color: #fff; border-radius: 999px; font-size: .75rem; padding: .1rem .45rem; font-weight: 700; margin-left: auto; }
.contador.urgente { background: var(--vermelho); }
.contador.mencao { background: var(--azul); }

/* ---------- login ---------- */
.tela-login { display: grid; place-items: center; background: linear-gradient(160deg, var(--fundo-2), var(--turquesa-claro)); padding: 1rem; }
.caixa-login { width: 100%; max-width: 380px; background: var(--fundo); padding: 2rem; border-radius: 20px; box-shadow: var(--sombra); display: grid; gap: 1rem; }
.logo-login { width: 200px; margin: 0 auto; display: block; }
.slogan { text-align: center; color: var(--texto-2); margin: -.5rem 0 .5rem; }
.caixa-login label, .modal label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
input[type=email], input[type=password], input[type=text], input[type=search], input[type=date], select, textarea {
  border: 1px solid var(--linha); border-radius: 10px; padding: .7rem .8rem; background: var(--fundo); width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--turquesa); outline-offset: 0; border-color: transparent; }
.alerta { background: #FDECEC; color: #9B2C2C; padding: .7rem; border-radius: 10px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 340px 1fr; height: 100dvh; }
.lateral { border-right: 1px solid var(--linha); display: flex; flex-direction: column; min-height: 0; background: var(--fundo); }
.lateral-topo { display: flex; align-items: center; justify-content: space-between; padding: .6rem .8rem; }
.logo-mini { height: 44px; }
[data-tema="escuro"] .logo-mini, [data-tema="escuro"] .logo-vazio { background: #fff; border-radius: 10px; padding: 2px 6px; }
.eu { display: flex; gap: .6rem; align-items: center; padding: 0 1rem .6rem; }
.eu small { display: block; color: var(--texto-2); font-size: .8rem; }
.busca { padding: 0 .8rem .5rem; }
.lateral-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: 0 .8rem .6rem; }
.lateral-botoes .btn { font-size: .88rem; padding: .6rem .5rem; display: flex; align-items: center; justify-content: center; gap: .3rem; }
.lista-conversas { overflow-y: auto; flex: 1; padding-bottom: 1rem; }
.lista-conversas h4 { margin: .9rem 1rem .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); }
.item-conversa { display: flex; align-items: center; gap: .7rem; width: 100%; border: 0; background: none; padding: .6rem 1rem; cursor: pointer; text-align: left; }
.item-conversa:hover { background: var(--fundo-2); }
.item-conversa.ativa { background: var(--turquesa-claro); box-shadow: inset 3px 0 var(--turquesa); }
.item-texto { min-width: 0; flex: 1; display: grid; }
.item-texto strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-texto small { color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; }
.nao-lida .item-texto strong, .nao-lida .item-texto small { color: var(--texto); font-weight: 700; }
.mudo { font-size: .8rem; opacity: .6; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem; flex: none; position: relative; background: var(--azul); }
.avatar.peq { width: 34px; height: 34px; font-size: .78rem; }
.online { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #2DBE6C; border: 2px solid var(--fundo); }
.marcador { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; color: #fff; font-weight: 800; flex: none; font-size: .95rem; }

/* ---------- conversa ---------- */
.conversa { display: flex; flex-direction: column; min-height: 0; background: var(--fundo-2); position: relative; }
.vazio { margin: auto; text-align: center; color: var(--texto-2); padding: 2rem; max-width: 460px; }
.logo-vazio { width: 160px; opacity: .9; }
.conversa-topo { display: flex; align-items: center; gap: .7rem; padding: .6rem 1rem; background: var(--fundo); border-bottom: 1px solid var(--linha); }
.conversa-titulo { flex: 1; min-width: 0; display: grid; text-align: left; background: none; border: 0; padding: .2rem .4rem; border-radius: 8px; cursor: pointer; }
.conversa-titulo:hover { background: var(--fundo-2); }
.conversa-titulo strong, .conversa-titulo small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversa-titulo small { color: var(--texto-2); font-size: .82rem; }
.mensagens { flex: 1; overflow-y: auto; padding: 1rem 1rem .5rem; display: flex; flex-direction: column; gap: .15rem; }
.carregando { color: var(--texto-2); text-align: center; margin: 1.5rem 0; }
.carregar-mais { align-self: center; background: var(--fundo); border: 1px solid var(--linha); border-radius: 999px; padding: .4rem 1rem; cursor: pointer; margin-bottom: .5rem; }
.dia { text-align: center; margin: .9rem 0 .5rem; }
.dia span { background: var(--fundo); color: var(--texto-2); font-size: .78rem; padding: .25rem .8rem; border-radius: 999px; border: 1px solid var(--linha); text-transform: capitalize; }

.msg { display: flex; gap: .5rem; align-items: flex-end; max-width: 78%; position: relative; margin-top: .5rem; }
.msg.agrupada { margin-top: .1rem; }
.msg.minha { align-self: flex-end; flex-direction: row-reverse; }
.avatar-espaco { width: 34px; flex: none; }
.msg.minha .avatar-espaco { display: none; }
.balao { background: var(--balao); border-radius: var(--raio); padding: .5rem .75rem .35rem; box-shadow: var(--sombra); min-width: 90px; overflow-wrap: anywhere; }
.msg.minha .balao { background: var(--balao-meu); }
.msg.urgente .balao { box-shadow: 0 0 0 2px var(--vermelho); }
.msg.me-menciona .balao { box-shadow: 0 0 0 2px var(--azul); }
.autor { font-weight: 700; font-size: .85rem; margin-bottom: .1rem; }
.balao time { display: block; text-align: right; font-size: .7rem; color: var(--texto-2); margin-top: .15rem; }
.apagada { color: var(--texto-2); }
.mencao { background: rgba(43, 79, 142, .12); color: var(--azul); font-weight: 600; border-radius: 4px; padding: 0 .2rem; }
.mencao.mencao-minha { background: var(--azul); color: #fff; }
.etiquetas { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .3rem; }
.etq { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 6px; }
.etq-urgente { background: var(--vermelho); color: #fff; }
.etq-imovel { background: var(--turquesa-claro); color: var(--turquesa); border: 1px solid var(--turquesa); }
.citacao { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--turquesa); background: rgba(63, 163, 148, .1); border-radius: 6px; padding: .3rem .5rem; margin-bottom: .3rem; font-size: .85rem; cursor: pointer; color: var(--texto-2); }
.citacao strong { display: block; color: var(--texto); font-size: .78rem; }
.anexo-img img { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; margin: .3rem 0; }
.anexo-arq { display: flex; gap: .4rem; align-items: center; background: var(--fundo-2); padding: .5rem .7rem; border-radius: 10px; margin: .3rem 0; text-decoration: none; color: var(--texto); }
.anexo-arq small { color: var(--texto-2); margin-left: auto; }
audio { max-width: 260px; margin: .3rem 0; display: block; }
.msg-sistema { align-self: center; background: var(--turquesa-claro); color: var(--texto); border: 1px solid var(--turquesa); font-size: .85rem; padding: .35rem .8rem; border-radius: 10px; margin: .5rem 0; max-width: 90%; text-align: center; }
.msg-sistema time { color: var(--texto-2); font-size: .72rem; margin-left: .3rem; }
.destaque .balao, .msg-sistema.destaque { animation: piscar 1s 2; }
@keyframes piscar { 50% { box-shadow: 0 0 0 4px var(--amarelo); } }

.acoes { display: none; gap: .2rem; align-self: center; background: var(--fundo); border: 1px solid var(--linha); border-radius: 10px; padding: .15rem; box-shadow: var(--sombra); }
.acoes button { border: 0; background: none; padding: .3rem .5rem; border-radius: 8px; cursor: pointer; font-size: .82rem; white-space: nowrap; }
.acoes button:hover { background: var(--turquesa-claro); }
.msg:hover .acoes, .msg.mostrar-acoes .acoes { display: flex; }

/* ---------- compositor ---------- */
.compositor { background: var(--fundo); border-top: 1px solid var(--linha); padding: .5rem .7rem calc(.5rem + env(safe-area-inset-bottom)); position: relative; }
.linha-compositor { display: flex; align-items: flex-end; gap: .3rem; }
.linha-compositor textarea { resize: none; max-height: 160px; border-radius: 20px; padding: .6rem 1rem; }
.btn-enviar { width: 46px; height: 46px; border-radius: 50%; padding: 0; flex: none; font-size: 1.1rem; }
.urgente-toggle { flex: none; cursor: pointer; }
.urgente-toggle input { display: none; }
.urgente-toggle span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; border: 2px solid var(--linha); color: var(--texto-2); }
.urgente-toggle input:checked + span { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.gravando { background: var(--vermelho) !important; color: #fff !important; animation: pulso 1s infinite; }
@keyframes pulso { 50% { opacity: .6; } }
.respondendo { display: flex; align-items: center; gap: .5rem; background: var(--fundo-2); border-left: 3px solid var(--turquesa); padding: .3rem .6rem; border-radius: 8px; margin-bottom: .4rem; font-size: .85rem; }
.respondendo span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anexos-previa { display: flex; gap: .4rem; flex-wrap: wrap; }
.anexos-previa:not(:empty) { margin-bottom: .4rem; }
.chip { background: var(--turquesa-claro); border-radius: 999px; padding: .25rem .4rem .25rem .7rem; font-size: .82rem; display: inline-flex; align-items: center; gap: .3rem; }
.chip button { border: 0; background: none; cursor: pointer; }
.sugestoes { position: absolute; bottom: 100%; left: .7rem; right: .7rem; max-width: 380px; background: var(--fundo); border: 1px solid var(--linha); border-radius: 12px; box-shadow: var(--sombra); overflow: hidden; }
.sugestoes button { display: flex; gap: .6rem; align-items: center; width: 100%; border: 0; background: none; padding: .5rem .7rem; cursor: pointer; text-align: left; }
.sugestoes button small { color: var(--texto-2); margin-left: auto; font-size: .78rem; }
.sugestoes button.sel, .sugestoes button:hover { background: var(--turquesa-claro); }

/* ---------- modais ---------- */
.modal { border: 0; border-radius: 18px; padding: 0; width: min(460px, 94vw); background: var(--fundo); color: var(--texto); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(15, 25, 45, .45); }
.modal-corpo { padding: 1.3rem; display: grid; gap: .8rem; max-height: 85dvh; overflow-y: auto; }
.modal h3 { margin: 0; color: var(--azul); }
.modal-botoes { display: flex; gap: .5rem; justify-content: flex-end; }
.abas { display: flex; background: var(--fundo-2); border-radius: 10px; padding: .2rem; }
.aba { flex: 1; border: 0; background: none; padding: .5rem; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--texto-2); }
.aba.ativa { background: var(--fundo); color: var(--texto); box-shadow: var(--sombra); }
[data-painel] { display: grid; gap: .6rem; }
[data-painel][hidden] { display: none; }
.lista-pessoas { max-height: 50dvh; overflow-y: auto; }
.lista-pessoas button { display: flex; gap: .7rem; align-items: center; width: 100%; border: 0; background: none; padding: .55rem .3rem; border-radius: 10px; cursor: pointer; text-align: left; }
.lista-pessoas button:hover { background: var(--fundo-2); }
.rotulo { margin: .3rem 0 0; font-weight: 600; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-sel input { display: none; }
.chip-sel span { display: inline-block; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--linha); cursor: pointer; font-size: .88rem; border-left: 4px solid var(--c, var(--turquesa)); }
.chip-sel input:checked + span { background: var(--azul); color: #fff; border-color: var(--azul); }
.atalhos-prazo { display: flex; gap: .4rem; flex-wrap: wrap; }
.atalhos-prazo button { border: 1px solid var(--linha); background: var(--fundo-2); border-radius: 999px; padding: .35rem .8rem; cursor: pointer; }
.lista-tarefas { display: grid; gap: .5rem; }
.tarefa { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem; border-radius: 12px; background: var(--fundo-2); border-left: 4px solid var(--azul); }
.tarefa.atrasada { border-left-color: var(--vermelho); }
.tarefa small { display: block; color: var(--texto-2); }
.tarefa.atrasada small { color: var(--vermelho); }
.concluir { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--turquesa); background: none; color: var(--turquesa); font-weight: 900; cursor: pointer; flex: none; }
.concluir:hover { background: var(--turquesa); color: #fff; }

.aviso { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--texto); color: var(--fundo); padding: .6rem 1.1rem; border-radius: 999px; font-size: .9rem; z-index: 50; max-width: 90vw; text-align: center; }

.so-celular { display: none; }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .conversa { display: none; }
  .app.com-conversa .lateral { display: none; }
  .app.com-conversa .conversa { display: flex; height: 100dvh; }
  .so-celular { display: inline-grid; }
  .msg { max-width: 92%; }
  .lateral { border-right: 0; }
  .item-conversa { padding: .75rem 1rem; }
}

.primeiros-passos { text-align: left; background: var(--fundo); border-radius: 14px; padding: 1rem 1rem 1rem 2.2rem; box-shadow: var(--sombra); margin-top: 1.2rem; color: var(--texto); line-height: 1.7; }
.lista-pessoas .pessoa { display: flex; gap: .7rem; align-items: center; padding: .45rem .3rem; }
