/* Atendimento (061): chat com a DimGrid. Reaproveita o visual do balão do DimBot (app.css: .dimbot-botao, .dimbot-balao,
   .dimbot-topo, .dimbot-mensagens, .dimbot-msg, .dimbot-texto); aqui fica só o que é próprio do atendimento. */
.at-chat { display: flex; flex-direction: column; min-height: 0; color: var(--texto); }
.at-chat .dimbot-mensagens { flex: 1; min-height: 0; }
.at-flutuante { z-index: 60; }
.at-botao { z-index: 59; }
.at-botao[aria-expanded="true"] { background: var(--lateral); }
.at-pagina { height: min(640px, calc(100vh - 220px)); min-height: 420px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 16px; overflow: hidden; }

.at-contato { flex: 1; overflow-y: auto; display: grid; gap: .65rem; align-content: start; padding: 1rem; }
.at-contato p { margin: 0; font-weight: 600; }
.at-contato label { display: grid; gap: .25rem; font-size: .85rem; color: var(--texto-2); }
.at-contato label small { font-weight: 400; }
.at-contato input, .at-escrever textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); color: var(--texto); font: inherit; font-size: 16px; }
.at-contato input:focus, .at-escrever textarea:focus { outline: 2px solid var(--destaque); outline-offset: 1px; }
.at-isca { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.at-nota { color: var(--texto-2); font-size: .78rem; }
.at-nota a { color: inherit; }
.at-erro { margin: 0; color: var(--erro); background: var(--erro-fundo); border-radius: 8px; padding: .45rem .7rem; font-size: .85rem; font-weight: 400 !important; }
.at-erro-geral { margin: 0 .7rem .6rem; }

.at-escrever { display: flex; gap: .5rem; align-items: flex-end; padding: .6rem .7rem; border-top: 1px solid var(--borda); background: var(--fundo); }
.at-escrever textarea { flex: 1; resize: none; max-height: 8rem; line-height: 1.4; }
.at-escrever .botao { flex: none; padding: .6rem .75rem; display: grid; place-items: center; }
.at-escrever .botao[disabled] { opacity: .5; cursor: default; }

.at-chat .dimbot-texto { white-space: pre-wrap; }
.at-chat .dimbot-texto a { color: inherit; text-decoration: underline; }
.at-msg-equipe .dimbot-texto { background: var(--ok-fundo); color: var(--texto); border: 1px solid var(--borda); border-radius: 14px 14px 14px 4px; }
.at-botoes { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .1rem; }
.at-botao-link { display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid var(--destaque); border-radius: 999px; padding: .42rem .9rem; font-size: .88rem; font-weight: 700; color: var(--destaque-escuro); background: var(--superficie); text-decoration: none; line-height: 1.2; }
.at-botao-link::after { content: "›"; font-size: 1.1em; line-height: 1; }
.at-botao-link.principal { background: var(--destaque); color: #1c1003; box-shadow: 0 3px 10px rgb(232 116 46 / .28); }
.at-botao-link:hover { background: var(--destaque-escuro); border-color: var(--destaque-escuro); color: #fff; }
@media (prefers-color-scheme: dark) { .at-botao-link:not(.principal) { color: var(--destaque-claro); } }
.at-msg-quem { font-size: .72rem; color: var(--texto-2); padding: 0 .3rem; }
.dimbot-msg-user .at-msg-quem { text-align: right; }
.at-msg-sistema { align-self: center; max-width: 96%; text-align: center; font-size: .8rem; color: var(--texto-2); background: var(--fundo); border: 1px dashed var(--borda); border-radius: 10px; padding: .4rem .7rem; }
.at-digitando { align-self: flex-start; display: inline-flex; gap: 4px; padding: .7rem .85rem; background: var(--fundo); border: 1px solid var(--borda); border-radius: 14px 14px 14px 4px; }
.at-digitando i { width: 6px; height: 6px; border-radius: 50%; background: var(--texto-2); animation: at-pisca 1.2s infinite ease-in-out; }
.at-digitando i:nth-child(2) { animation-delay: .2s; }
.at-digitando i:nth-child(3) { animation-delay: .4s; }
@keyframes at-pisca { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .at-digitando i { animation: none; } }

.at-vazio { margin: auto; max-width: 26rem; text-align: center; color: var(--texto-2); font-size: .92rem; }
.at-ajustes fieldset { display: grid; gap: .9rem; border: 0; padding: 0; margin: 0 0 1rem; max-width: 46rem; }
.at-ajustes label { display: grid; gap: .3rem; }
.at-ajustes label.caixa { display: flex; gap: .5rem; align-items: center; }
.at-ajustes label small { color: var(--texto-2); font-weight: 400; }
.at-ajustes input:not([type=checkbox]), .at-ajustes select, .at-ajustes textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); color: var(--texto); font: inherit; }
.at-ajustes input[type=number] { max-width: 10rem; }
.at-modelos { display: grid; gap: .4rem; }
.at-modelos > small { color: var(--texto-2); }
.at-modelos th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--texto-2); max-width: 16rem; white-space: normal; }
.at-modelos td select { min-width: 12rem; }

/* Página /atendimento */
.at-pagina-aberta { max-width: 1040px; margin: 0 auto; padding: 1.5rem 16px 2rem; }
.at-pagina-aberta h1 { margin: 0 0 1rem; font-size: 1.5rem; }
.at-pagina-grade { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.2rem; align-items: start; }
.at-pagina-lado { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem; font-size: .92rem; }
.at-pagina-lado h2 { font-size: 1rem; margin-bottom: .5rem; }
.at-pagina-lado p { margin: 0 0 .7rem; }
.at-pagina-lado p:last-child { margin-bottom: 0; }
.manual-aberto { max-width: 1240px; margin: 0 auto; padding: 1.5rem 16px 2rem; }

/* Tela da equipe (/plataforma/atendimento) */
.at-equipe { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.at-fila { display: grid; gap: .4rem; max-height: calc(100vh - 360px); min-height: 12rem; overflow-y: auto; align-content: start; }
.at-fila a { display: grid; gap: .15rem; padding: .6rem .7rem; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); text-decoration: none; }
.at-fila a.ativa { border-color: var(--destaque); box-shadow: inset 3px 0 0 var(--destaque); }
.at-fila a small { color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-fila-topo { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.at-conversa { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); display: flex; flex-direction: column; height: calc(100vh - 330px); min-height: 380px; overflow: hidden; } /* termina acima do botão do DimBot do sistema */
.at-conversa-topo { padding: .7rem .9rem; border-bottom: 1px solid var(--borda); display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; background: var(--fundo); }
.at-conversa-topo small { display: block; color: var(--texto-2); }
.at-conversa-acoes { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.at-conversa-acoes form { margin: 0; }
.at-conversa .at-escrever textarea { min-height: 2.8rem; }
.at-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9aa3ad; margin-right: .3rem; }
.at-online.sim { background: #16a34a; }

/* Fechar com nome (celular), fundo atrás da folha e convite em balão ao lado do botão (2026-11-17) */
.at-fechar { display: inline-flex; align-items: center; gap: .4rem; flex: none; font-family: inherit; }
.at-fechar span { display: none; }
.at-fundo { display: none; }
.at-atalho { text-align: center; font-size: .9rem; font-weight: 600; color: var(--destaque-escuro); padding: .35rem 0; }
@media (prefers-color-scheme: dark) { .at-atalho { color: var(--destaque-claro); } }
.at-convite:not([hidden]) { position: fixed; right: 12px; bottom: 80px; z-index: 58; display: flex; align-items: flex-start; max-width: min(16.5rem, calc(100vw - 24px)); background: var(--superficie); color: var(--texto); border: 1px solid var(--borda); border-radius: 14px 14px 4px 14px; box-shadow: 0 10px 28px rgb(0 0 0 / .24); }
.at-convite-texto { font: inherit; font-size: .92rem; line-height: 1.35; text-align: left; border: 0; background: none; color: inherit; padding: .7rem .1rem .7rem .85rem; cursor: pointer; }
.at-convite-fechar { flex: none; border: 0; background: none; color: var(--texto-2); font-size: 1rem; line-height: 1; padding: .7rem .7rem; cursor: pointer; }

@media (max-width: 900px) {
    .at-pagina-grade, .at-equipe { grid-template-columns: minmax(0, 1fr); }
    .at-fila { max-height: 14rem; }
    .at-conversa { height: 70vh; }
}
@media (max-width: 600px) {
    /* celular: o chat sobe como folha colada embaixo (teclado aberto não esconde a caixa de escrever) e deixa uma faixa da página
       à vista em cima, escurecida: dá para ver que a página continua ali, e o toque nela fecha. "Fechar" vai escrito. */
    .at-flutuante { right: 0; left: 0; bottom: 0; top: 56px; width: 100%; height: auto; border-radius: 18px 18px 0 0; border: 0; }
    .at-fundo:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 59; background: rgb(8 16 22 / .62); }
    .at-fechar { min-height: 40px; padding: .4rem .85rem; border: 1px solid var(--borda); border-radius: 999px; background: var(--superficie); color: var(--texto); font-size: .9rem; font-weight: 600; }
    .at-fechar span { display: inline; }
    .at-pagina { height: calc(100dvh - 190px); }
}
.at-modelos td:first-child { min-width: 11rem; }
