/* Central de atendimento — chat, chamar atenção, listas e painel */

/* ---------- chamar atenção (estilo MSN) ---------- */
@keyframes dc-tremer {
  0%, 100% { transform: translate3d(0, 0, 0); }
  10%, 50%, 90% { transform: translate3d(-9px, 2px, 0); }
  30%, 70% { transform: translate3d(9px, -2px, 0); }
  20%, 60% { transform: translate3d(-5px, -1px, 0); }
  40%, 80% { transform: translate3d(5px, 1px, 0); }
}
body.dc-tremendo > .app, body.dc-tremendo > .painel, body.dc-tremendo > .casca { animation: dc-tremer .55s cubic-bezier(.36, .07, .19, .97) 2; }
@keyframes dc-piscar { 0%, 100% { box-shadow: inset 0 0 0 0 rgba(245, 196, 0, 0); } 50% { box-shadow: inset 0 0 0 6px rgba(245, 196, 0, .9); } }
body.dc-piscando::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 3000; animation: dc-piscar .45s ease 3; }
@media (prefers-reduced-motion: reduce) { body.dc-tremendo > .app, body.dc-tremendo > .painel, body.dc-tremendo > .casca { animation: none; } }

.atend-aviso {
  position: fixed; top: calc(var(--safe-t, 0px) + 12px); left: 50%; transform: translateX(-50%); z-index: 2500;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 12px 16px; border-radius: 14px;
  background: var(--verde-800); color: #fff !important; font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  text-decoration: none !important; animation: atend-entrar .3s ease;
}
.atend-aviso .ic { width: 22px; height: 22px; color: var(--amarelo-500); flex: none; }
.atend-aviso span { flex: 1; min-width: 0; }
.atend-aviso b { background: rgba(255, 255, 255, .16); border-radius: 9px; padding: 6px 10px; font-size: .85rem; }
.atend-aviso.saindo { opacity: 0; transition: opacity .35s ease; }
@keyframes atend-entrar { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

[data-atend-contador]:empty, [data-atend-contador][data-n="0"] { display: none; }

/* ---------- telas do cliente/produtor ---------- */
.pedido-ajuda { display: grid; gap: 8px; }
.pedido-ajuda form { margin: 0; }
.atend-tela { padding-bottom: 8px; }
.atend-hero { display: flex; gap: 14px; align-items: center; margin-top: 4px; }
.ico-caixa-g { width: 56px; height: 56px; border-radius: 16px; }
.ico-caixa-g .ic { width: 28px; height: 28px; }
.atend-atalhos { grid-template-columns: 1fr; }
.atend-atalho, .atend-item {
  display: flex; align-items: center; gap: 12px; padding: 14px; background: #fff; border: 1px solid var(--borda); border-radius: 16px;
  color: inherit; text-decoration: none !important;
}
.atend-atalho:hover, .atend-item:hover { border-color: var(--verde-500); }
.atend-atalho .seta, .atend-item .seta { color: var(--suave); }
.atend-lista { padding: 6px; display: grid; gap: 6px; }
.atend-lista .atend-item { border-color: transparent; }
.atend-item .cresce { min-width: 0; }
.atend-item.destaque { border-color: var(--amarelo-500); background: #fffbea; }
.atend-faq details { border-bottom: 1px solid var(--borda); }
.atend-faq details:last-child { border-bottom: 0; }
.atend-faq summary { list-style: none; cursor: pointer; padding: 14px 4px; font-weight: 700; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.atend-faq summary::-webkit-details-marker { display: none; }
.atend-faq summary .ic { color: var(--suave); transition: transform .2s ease; flex: none; }
.atend-faq details[open] summary .ic { transform: rotate(180deg); }
.atend-faq p { margin: 0 4px 14px; color: var(--texto-2); }

.atend-cab .atend-assunto { display: block; font-size: 1.02rem; line-height: 1.3; }
.atend-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .82rem; color: var(--texto-2); }
.atend-meta a, .atend-meta span { display: inline-flex; align-items: center; gap: 5px; }
.atend-decisao { display: flex; gap: 10px; padding: 12px; border-radius: 12px; background: #eef7ef; border: 1px solid #cfe6d2; }
.atend-decisao > .ic { color: var(--verde-700); flex: none; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; }
.chat-msgs { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; }
.chat-dia { align-self: center; font-size: .72rem; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; margin: 6px 0; }
.msg {
  max-width: 84%; align-self: flex-start; background: #fff; border: 1px solid var(--borda); border-radius: 16px 16px 16px 5px;
  padding: 8px 12px 6px; box-shadow: 0 1px 2px rgba(16, 24, 18, .04); overflow-wrap: anywhere;
}
.msg .autor { font-size: .74rem; font-weight: 800; color: var(--suave); margin-bottom: 2px; }
.msg.papel-associacao .autor { color: var(--verde-700); }
.msg.papel-produtor .autor { color: #8a5a00; }
.msg .texto { font-size: .95rem; line-height: 1.45; color: var(--texto); }
.msg .hora { font-size: .68rem; color: var(--suave); text-align: right; margin-top: 2px; font-variant-numeric: tabular-nums; }
.msg.meu { align-self: flex-end; background: var(--verde-700); border-color: transparent; border-radius: 16px 16px 5px 16px; }
.msg.meu .texto, .msg.meu .hora { color: #fff; }
.msg.meu .hora { opacity: .75; }
.msg-foto { display: block; margin-top: 6px; }
.msg-foto img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; object-fit: cover; }
.msg-etiqueta { display: flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.msg-etiqueta .ic { width: 14px; height: 14px; }
.msg.msg-nota { background: #fffbea; border: 1px dashed #e2c65a; }
.msg.msg-nota .texto, .msg.msg-nota .hora { color: var(--texto); }
.msg.msg-nota .msg-etiqueta { color: #7d6000; }
.msg.msg-decisao { border: 2px solid var(--verde-600); background: #f1f8f1; max-width: 92%; }
.msg.msg-decisao .texto, .msg.msg-decisao .hora { color: var(--texto); }
.msg.msg-decisao .msg-etiqueta { color: var(--verde-700); }
.msg-sistema { align-self: center; max-width: 92%; text-align: center; font-size: .78rem; color: var(--texto-2); background: var(--cinza-100); border-radius: 12px; padding: 6px 12px; }
.msg-atencao {
  align-self: center; display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: #fff8dc; border: 1px solid #f3e2a0; color: #7d6000; font-size: .84rem; font-weight: 700;
}
.msg-atencao .ic { width: 18px; height: 18px; }
.msg-atencao small { font-weight: 600; opacity: .7; }

.chat-compor {
  position: sticky; bottom: 0; z-index: 5; background: var(--bg); padding: 10px 0 calc(10px + var(--safe-b, 0px));
  border-top: 1px solid var(--borda); display: grid; gap: 8px;
}
/* no celular o menu de baixo fica sempre visível: o campo de mensagem para logo acima dele */
.app:not(.sem-nav) .chat-compor { bottom: calc(var(--nav-h) + var(--safe-b, 0px)); padding-bottom: 10px; }
@media (min-width: 768px) { .app .chat-compor { bottom: 0; padding-bottom: calc(10px + var(--safe-b, 0px)); } }
@media (min-width: 600px) and (max-width: 767px) { .com-lateral .app .chat-compor { bottom: 0; padding-bottom: calc(10px + var(--safe-b, 0px)); } }
.chat-linha { display: flex; gap: 8px; align-items: flex-end; }
.chat-texto { flex: 1; min-height: 46px; max-height: 160px; resize: none; padding-top: 11px; padding-bottom: 11px; line-height: 1.35; }
.chat-btn { flex: none; width: 46px; height: 46px; padding: 0; display: grid; place-items: center; cursor: pointer; }
.chat-btn[disabled] { opacity: .5; }
.chat-anexo { display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 600; background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 6px 10px; }
.chat-anexo span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-nota { margin: 0; }

/* ---------- painel da associação ---------- */
.atend-painel { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .atend-painel { grid-template-columns: minmax(0, 1fr) 360px; } }
.atend-painel-chat { min-width: 0; }
.chat-painel { background: #fff; border: 1px solid var(--borda); border-radius: 18px; margin-top: 12px; overflow: hidden; }
.chat-painel .chat-rolagem { height: min(62vh, 640px); overflow-y: auto; padding: 14px 16px; background: #f7f8f5; }
.chat-painel .chat-compor { position: static; padding: 10px 12px; background: #fff; }
.atend-painel-lado { display: grid; gap: 12px; }
.atend-painel-lado .card h3 { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.atend-pedido-loja { padding: 8px 0; border-top: 1px solid var(--borda); margin-top: 8px; }
.atend-acao { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--borda); }
.atend-acao:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.atend-acao-feita { padding: 8px 0; border-top: 1px solid var(--borda); }
.atend-acao-feita:first-of-type { border-top: 0; }
.atend-linha-espera td:first-child { box-shadow: inset 3px 0 0 var(--amarelo-500); }

/* ---------- tela larga: lista de conversas ao lado do chat (estilo WhatsApp Web) ---------- */
.atend-split-lista { display: none; }
.atend-split-cab { display: flex; align-items: center; gap: 8px; font-weight: 800; padding: 10px 12px 8px; }
.atend-split-cab .ic { width: 18px; height: 18px; color: var(--verde-700); }
.atend-split-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none !important; }
.atend-split-item:hover { background: var(--cinza-100); }
.atend-split-item.ativo { background: #e7f3e8; }
.atend-split-item .cresce { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.atend-split-item .ico-caixa { width: 38px; height: 38px; flex: none; }
.atend-split-item .ico-caixa .ic { width: 18px; height: 18px; }
.atend-split-st { width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor !important; padding: 0 !important; }
@media (min-width: 1024px) {
  .atend-split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; max-width: 1200px; margin: 0 auto; padding: 24px 32px 0; align-items: start; }
  .atend-split > .atend-tela { max-width: none; padding: 0; margin: 0; }
  .atend-split > .atend-split-lista { display: block; position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow-y: auto; background: #fff; border: 1px solid var(--borda); border-radius: 18px; padding: 6px; }
}
@media (min-width: 1500px) {
  .atend-painel { grid-template-columns: 300px minmax(0, 1fr) 360px; }
  .atend-painel > .atend-split-lista { display: block; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; background: #fff; border: 1px solid var(--borda); border-radius: 18px; padding: 6px; }
}
/* Cabeçalho da conversa: o selo de situação desce de linha quando o assunto ficaria espremido */
.atend-cab > .flex { flex-wrap: wrap; row-gap: 6px; }
.atend-cab > .flex > .cresce { flex: 1 1 180px; }
.atend-cab > .flex > .badge { margin-left: auto; }
/* Com o menu lateral do app (produtor) a lista fica mais estreita até 1280px */
@media (min-width: 1024px) and (max-width: 1279px) {
  .casca .atend-split { grid-template-columns: 240px minmax(0, 1fr); gap: 14px; padding: 18px 18px 0; }
}
