:root {
  /* Tons de verde de aplicativo de conversa, para o atendente se sentir em casa */
  --tinta: #075e54; --tinta-2: #0a7265; --papel: #fff; --fundo: #f0f2f5; --linha: #e0e4e7;
  --texto: #111b21; --suave: #667781; --verde: #008069; --verde-claro: #d9fdd3; --selecao: #e7f3ee; --conversa: #efeae2;
  --ambar: #8a5a0b; --ambar-claro: #fdf1d8; --vermelho: #b42318; --vermelho-claro: #fde7e4; --nota: #fff7cc;
  --raio: 10px;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { font: 15px/1.45 "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif; color: var(--texto); background: var(--fundo); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }
.suave { color: var(--suave); }
.pequeno { font-size: 13px; }

/* Botões e campos */
.botao { border: 1px solid var(--linha); background: var(--papel); border-radius: 8px; padding: 8px 14px; font-weight: 600; white-space: nowrap; }
.botao:hover { border-color: #b9c1cf; }
.botao.principal { background: var(--verde); border-color: var(--verde); color: #fff; }
.botao.principal:hover { background: #006d59; }
.botao.perigo { color: var(--vermelho); }
.botao.liso { border-color: transparent; background: transparent; }
.botao.liso:hover { background: var(--fundo); }
.botao:disabled { opacity: .5; cursor: default; }
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.campo small { display: block; color: var(--suave); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=time], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--linha); border-radius: 8px; padding: 9px 11px; background: var(--papel);
}
textarea { resize: vertical; min-height: 70px; }
.linha-botoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.marcar { display: inline-flex; gap: 7px; align-items: center; margin: 0 14px 8px 0; }

/* Entrada */
.tela-entrada { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--tinta); }
.tela-entrada form { width: min(380px, 100%); background: var(--papel); border-radius: 16px; padding: 32px; }
.tela-entrada .marca { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tela-entrada .marca img { width: 100%; height: auto; }
.tela-entrada .marca { margin-bottom: 14px; }
.tela-entrada p { margin: 0 0 22px; color: var(--suave); }
.erro-form { color: var(--vermelho); font-size: 14px; min-height: 20px; margin: 0 0 10px; }

/* Estrutura */
.casca { display: grid; grid-template-columns: 88px 1fr; height: 100%; }
.trilho { background: var(--tinta); color: #cfe6e1; display: flex; flex-direction: column; align-items: stretch; padding: 12px 8px; gap: 4px; }
.trilho img { width: 40px; height: 40px; margin: 2px auto 12px; }
.trilho button { background: none; border: 0; color: inherit; border-radius: 10px; padding: 9px 2px 7px; font-size: 11.5px; font-weight: 600; display: grid; justify-items: center; gap: 3px; position: relative; }
.trilho button svg { width: 22px; height: 22px; }
.trilho button:hover { background: var(--tinta-2); color: #fff; }
.trilho button[aria-current=page] { background: #fff; color: var(--tinta); }
.trilho .fim { margin-top: auto; display: grid; gap: 4px; }
.trilho .eu { width: 38px; height: 38px; border-radius: 50%; background: var(--tinta-2); color: #fff; display: grid; place-items: center; font-weight: 700; margin: 0 auto 2px; font-size: 14px; }
.pingo { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e0a100; color: #1b2433; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.conteudo { min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.faixa { padding: 8px 16px; font-size: 14px; font-weight: 600; display: flex; gap: 12px; align-items: center; justify-content: center; }
.faixa.alerta { background: var(--vermelho-claro); color: var(--vermelho); }
.faixa.dono { background: var(--ambar-claro); color: var(--ambar); }
.faixa.convite { background: var(--selecao); color: var(--tinta); }
.faixa button { padding: 3px 10px; }
.pagina { padding: 28px 32px 48px; overflow: auto; flex: 1; }
.pagina > header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 20px; }
.cartao + .cartao { margin-top: 16px; }
.cartao > h2 { margin-bottom: 4px; }
.cartao > h2 + p { margin: 0 0 16px; color: var(--suave); }

/* Atendimento */
.atendimento { display: grid; grid-template-columns: 350px 1fr; flex: 1; min-height: 0; }
.lista { background: var(--papel); border-right: 1px solid var(--linha); display: flex; flex-direction: column; min-height: 0; }
.lista-topo { padding: 14px 14px 10px; display: grid; gap: 10px; }
.lista-topo .titulo { display: flex; justify-content: space-between; align-items: center; }
.abas { display: flex; gap: 2px; background: var(--fundo); padding: 3px; border-radius: 9px; }
.abas button { flex: 1; border: 0; background: none; border-radius: 7px; padding: 6px 4px; font-weight: 600; font-size: 13.5px; color: var(--suave); }
.abas button[aria-selected=true] { background: var(--papel); color: var(--texto); box-shadow: 0 1px 2px rgba(23, 35, 58, .12); }
.abas b { font-weight: 700; color: var(--ambar); }
.itens { overflow: auto; flex: 1; }
.item { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--fundo); background: none; align-items: center; }
.item:hover { background: #f8f9fb; }
.item[aria-current=true] { background: var(--selecao); }
.rosto { width: 42px; height: 42px; border-radius: 50%; background: #e6eaf1; color: var(--tinta); display: grid; place-items: center; font-weight: 700; }
.item .meio { min-width: 0; }
.item .nome, .item .previa { display: block; }
.item .nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .previa { color: var(--suave); font-size: 13.5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .lado { display: grid; justify-items: end; gap: 4px; font-size: 12px; color: var(--suave); }
.bolinha { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--verde); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.etiqueta { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: #e9edf3; color: #3d4a61; white-space: nowrap; }
.etiqueta.cor-verde { background: #d5f2e3; color: #0b5c4c; }
.etiqueta.cor-azul { background: #dde9fb; color: #1d4f9c; }
.etiqueta.cor-ambar { background: var(--ambar-claro); color: var(--ambar); }
.etiqueta.cor-vermelho { background: var(--vermelho-claro); color: var(--vermelho); }
.etiqueta.cor-roxo { background: #ebe2f8; color: #5b2e9c; }
.etiqueta.prioridade { background: var(--vermelho); color: #fff; }
.meta { margin-bottom: 16px; } .meta-topo { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; } .meta-topo b { font-size: 20px; font-variant-numeric: tabular-nums; }
.barra { height: 10px; border-radius: 6px; background: var(--fundo); overflow: hidden; margin-bottom: 4px; } .barra i { display: block; height: 100%; border-radius: 6px; background: var(--verde); } .barra i.baixa { background: var(--vermelho); }
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filtros { display: flex; gap: 8px; }
.filtros select { width: auto; max-width: 130px; }
.ensinar { border: 0; background: none; padding: 0; margin-right: 10px; font-size: 11px; font-weight: 600; color: var(--verde); text-decoration: underline; text-underline-offset: 2px; }
.alerta-cartao { border-color: #f0b4ad; }
.interruptor input { width: 18px; height: 18px; }
/* Tempo de espera: a única cor forte da lista. Quanto mais tempo o cliente espera, mais ela pesa. */
.espera { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #e9edf3; color: #3d4a61; font-variant-numeric: tabular-nums; white-space: nowrap; }
.espera.media { background: var(--ambar-claro); color: var(--ambar); }
.espera.alta { background: var(--vermelho); color: #fff; }
.vazio { padding: 40px 24px; text-align: center; color: var(--suave); }
.demo { border-top: 1px solid var(--linha); padding: 10px 14px; background: var(--ambar-claro); display: grid; gap: 6px; }
.demo strong { font-size: 13px; color: var(--ambar); }
.demo form { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; }
.demo input { padding: 6px 8px; min-width: 0; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--conversa); }
.chat-topo { background: var(--papel); border-bottom: 1px solid var(--linha); padding: 10px 18px; display: flex; align-items: center; gap: 12px; }
.chat-topo .quem { min-width: 0; flex: 1; }
.chat-topo .quem strong .etiqueta { margin-left: 6px; vertical-align: 2px; }
.chat-topo .quem strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-topo .quem > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voltar { display: none; }
textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mensagens { flex: 1; overflow: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 6px; }
.dia { align-self: center; font-size: 12px; font-weight: 600; color: var(--suave); background: rgba(255, 255, 255, .8); padding: 2px 12px; border-radius: 20px; margin: 8px 0; }
.msg { max-width: min(560px, 78%); padding: 7px 11px 5px; border-radius: 12px; background: var(--papel); align-self: flex-start; box-shadow: 0 1px 1px rgba(23, 35, 58, .08); overflow-wrap: anywhere; }
.msg.saida { align-self: flex-end; background: var(--verde-claro); }
.msg.nota { align-self: flex-end; background: var(--nota); border: 1px dashed #d8c458; box-shadow: none; }
.msg.sistema { align-self: center; background: none; box-shadow: none; color: var(--suave); font-size: 13px; padding: 2px; max-width: 90%; text-align: center; }
.msg .autor { font-size: 12px; font-weight: 700; color: var(--verde); }
.msg.nota .autor { color: var(--ambar); }
.msg .texto { white-space: pre-wrap; }
.msg .hora { font-size: 11px; color: var(--suave); text-align: right; margin-top: 2px; }
.msg .hora .falha { color: var(--vermelho); font-weight: 700; }
.msg img.foto { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; margin-bottom: 4px; }
.msg video { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; }
.msg audio { display: block; width: 260px; max-width: 100%; }
.msg a.arquivo { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: rgba(23, 35, 58, .06); border-radius: 8px; color: inherit; text-decoration: none; font-weight: 600; }
.assumir { background: var(--papel); border-top: 1px solid var(--linha); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.escrever { background: var(--papel); border-top: 1px solid var(--linha); padding: 10px 14px; position: relative; }
.escrever.modo-nota { background: var(--nota); }
.escrever .caixa { display: flex; gap: 8px; align-items: flex-end; }
.escrever textarea { min-height: 42px; max-height: 160px; resize: none; }
.escrever .icone { border: 0; background: none; width: 40px; height: 42px; border-radius: 8px; display: grid; place-items: center; color: var(--suave); flex: none; }
.escrever .icone:hover { background: var(--fundo); color: var(--texto); }
.escrever .icone svg { width: 22px; height: 22px; }
.escrever .icone.gravando { background: var(--vermelho); color: #fff; }
.escrever .modo { display: flex; gap: 14px; font-size: 13px; margin-bottom: 6px; }
.escrever .modo button { border: 0; background: none; padding: 0 0 2px; font-weight: 600; color: var(--suave); border-bottom: 2px solid transparent; }
.escrever .modo button[aria-pressed=true] { color: var(--texto); border-color: var(--verde); }
.rapidas { position: absolute; bottom: 100%; left: 14px; right: 14px; background: var(--papel); border: 1px solid var(--linha); border-radius: 10px; box-shadow: 0 8px 24px rgba(23, 35, 58, .16); max-height: 240px; overflow: auto; }
.rapidas button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-bottom: 1px solid var(--fundo); }
.rapidas button:hover, .rapidas button.ativa { background: var(--selecao); }
.rapidas b { margin-right: 8px; }
.sem-conversa { flex: 1; display: grid; place-items: center; text-align: center; color: var(--suave); padding: 24px; }

/* Painel */
.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0; overflow: hidden; background: var(--papel); border: 1px solid var(--linha); border-radius: var(--raio); margin-bottom: 16px; }
.numeros div { padding: 18px 20px; border-right: 1px solid var(--linha); border-bottom: 1px solid var(--linha); margin-bottom: -1px; }
.numeros div:last-child { border-right: 0; }
.numeros dt { font-size: 13px; color: var(--suave); font-weight: 600; }
.numeros dd { margin: 4px 0 0; font-size: 30px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.numeros dd small { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--suave); letter-spacing: 0; }
.numeros .atencao dd { color: var(--vermelho); }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.duas .cartao + .cartao { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--suave); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--linha); }
td { padding: 10px; border-bottom: 1px solid var(--fundo); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ponto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c3cad6; margin-right: 8px; }
.ponto.on { background: #1fa37a; }
.rolagem { overflow-x: auto; }

/* Ajustes */
.sub-abas { display: flex; gap: 4px; border-bottom: 1px solid var(--linha); margin-bottom: 20px; overflow-x: auto; }
.sub-abas button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--suave); border-bottom: 2px solid transparent; white-space: nowrap; }
.sub-abas button[aria-selected=true] { color: var(--texto); border-color: var(--verde); }
.estreito { max-width: 760px; }
.qr { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.qr img { width: 240px; height: 240px; border: 1px solid var(--linha); border-radius: 12px; padding: 8px; background: #fff; }
.qr ol { margin: 8px 0 0; padding-left: 20px; }
.estado { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.estado i { width: 12px; height: 12px; border-radius: 50%; background: #c3cad6; }
.estado.conectado i { background: #1fa37a; }
.estado.qr i, .estado.conectando i { background: #e0a100; }
.estado.desconectado i, .estado.erro i { background: var(--vermelho); }

/* Diálogo e aviso */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(23, 35, 58, .3); color: var(--texto); }
dialog::backdrop { background: rgba(23, 35, 58, .45); }
dialog form { padding: 24px; }
dialog h2 { margin-bottom: 16px; }
dialog .linha-botoes { justify-content: flex-end; margin-top: 8px; }
.opcoes { display: grid; gap: 6px; margin-bottom: 14px; max-height: 300px; overflow: auto; }
.opcoes button { text-align: left; display: flex; align-items: center; }
#aviso { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100vw - 32px); }
#aviso.visivel { opacity: 1; }
#aviso.erro { background: var(--vermelho); }

@media (max-width: 860px) {
  .casca { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .trilho { flex-direction: row; order: 2; padding: 4px 6px; justify-content: space-around; }
  .trilho img, .trilho [data-acao=minha-senha] { display: none; }
  .trilho .fim { margin: 0; display: flex; }
  .trilho { justify-content: stretch; gap: 0; }
  .trilho .fim { display: contents; }
  .trilho button { padding: 6px 2px 4px; font-size: 10.5px; flex: 1; min-width: 0; }
  .trilho button svg { width: 20px; height: 20px; }
  .pingo { right: calc(50% - 22px); }
  .dupla { grid-template-columns: 1fr; gap: 0; }
  .atendimento { grid-template-columns: 1fr; }
  .atendimento.com-chat .lista { display: none; }
  .atendimento:not(.com-chat) .chat { display: none; }
  .voltar { display: grid; padding: 6px; }
  .chat-topo { padding: 8px 10px; gap: 8px; }
  .chat-topo .rosto { display: none; }
  .chat-topo .botao { padding: 7px 8px; font-size: 13px; }
  .pagina { padding: 18px 16px 32px; }
  .duas { grid-template-columns: 1fr; }
  .numeros div { border-right: 0; border-bottom: 1px solid var(--linha); }
  .mensagens { padding: 14px 12px; }
  .demo form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
