/* Onest (SIL Open Font License), hospedada no próprio site: nenhum dado do visitante vai para terceiros */
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fontes/onest-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fontes/onest-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ============ Tokens ============ */
:root {
  --verde-escuro: #075E54;
  --verde: #0E7B6F;
  --verde-vivo: #25D366;
  --verde-claro: #D9FDD3;
  --fundo: #F0F2F5;
  --painel: #FFFFFF;
  --painel-2: #F7F8FA;
  --conversa: #EFEAE2;
  --balao-meu: #D9FDD3;
  --balao-dele: #FFFFFF;
  --balao-humano: #FFF4D6;
  --tinta: #111B21;
  --suave: #667781;
  --linha: #E3E7EA;
  --alerta: #E53935;
  --alerta-claro: #FDECEA;
  --aviso: #F2A100;
  --azul: #1565C0;
  --raio: 12px;
  --sombra: 0 1px 2px rgba(11, 20, 26, .08);
  --sombra-alta: 0 12px 40px rgba(11, 20, 26, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --verde-escuro: #1F2C33; --verde: #00A884; --verde-claro: #0A332C; --fundo: #0B141A; --painel: #111B21; --painel-2: #182229;
    --conversa: #0B141A; --balao-meu: #005C4B; --balao-dele: #202C33; --balao-humano: #4A3B12; --tinta: #E9EDEF; --suave: #8696A0;
    --linha: #26333B; --alerta-claro: #3A1C1C; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --verde-escuro: #1F2C33; --verde: #00A884; --verde-claro: #0A332C; --fundo: #0B141A; --painel: #111B21; --painel-2: #182229;
  --conversa: #0B141A; --balao-meu: #005C4B; --balao-dele: #202C33; --balao-humano: #4A3B12; --tinta: #E9EDEF; --suave: #8696A0;
  --linha: #26333B; --alerta-claro: #3A1C1C; color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 'Onest', system-ui, sans-serif; color: var(--tinta); background: var(--fundo); -webkit-font-smoothing: antialiased; }
a { color: var(--verde); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--verde-vivo); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.suave { color: var(--suave); }
.peq-txt { font-size: .85rem; }
.oculto { display: none !important; }
kbd { font: 600 .75rem/1 'Onest', sans-serif; padding: .2em .45em; border-radius: 5px; border: 1px solid var(--linha); border-bottom-width: 2px; background: var(--painel-2); color: var(--tinta); }

/* ============ Botões e campos ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; border: 0; border-radius: 22px; padding: .6em 1.15em; cursor: pointer; font-weight: 600; background: var(--verde); color: #fff; text-decoration: none; white-space: nowrap; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.claro { background: transparent; color: var(--verde); box-shadow: inset 0 0 0 1.5px var(--verde); }
.btn.neutro { background: var(--painel-2); color: var(--tinta); box-shadow: inset 0 0 0 1px var(--linha); }
.btn.perigo { background: var(--alerta); }
.btn.peq { padding: .35em .85em; font-size: .85rem; }
.btn svg { flex: none; }
.campo { display: block; margin-bottom: 1rem; }
.campo > span { display: block; font-size: .87rem; font-weight: 600; margin-bottom: .3em; }
.campo small { display: block; color: var(--suave); font-size: .8rem; margin-top: .3em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: .6em .8em; border: 1.5px solid var(--linha); border-radius: 10px; background: var(--painel);
}
input:focus, select:focus, textarea:focus { border-color: var(--verde); outline: none; }
textarea { resize: vertical; min-height: 4.5em; }
.linha { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-start; }
.linha > * { flex: 1 1 150px; }
.botoes { display: flex; gap: .5rem; flex-wrap: wrap; flex: none; align-items: center; }
.check { display: flex; gap: .6em; align-items: flex-start; margin: .45em 0; cursor: pointer; }
.check input { accent-color: var(--verde); width: 1.1em; height: 1.1em; margin-top: .2em; flex: none; }
.opcoes { display: flex; gap: .4rem; flex-wrap: wrap; }
.opcoes label { cursor: pointer; }
.opcoes input { position: absolute; opacity: 0; pointer-events: none; }
.opcoes span { display: inline-block; padding: .4em .9em; border-radius: 20px; background: var(--painel-2); box-shadow: inset 0 0 0 1px var(--linha); font-weight: 500; }
.opcoes input:checked + span { background: var(--verde); color: #fff; box-shadow: none; }
.opcoes input:focus-visible + span { outline: 2px solid var(--verde-vivo); }
.pilula { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12em .65em; border-radius: 20px; background: var(--painel-2); color: var(--suave); white-space: nowrap; }
.pilula.ativa { background: #D9FDD3; color: #075E54; }
.pilula.suspensa { background: #FFE2E0; color: #B3261E; }
.pilula.configurando { background: #FFF2CC; color: #7A5300; }
.pilula.humano { background: var(--alerta-claro); color: var(--alerta); }

/* ============ Casca do app (estilo WhatsApp Web) ============ */
.app { display: grid; grid-template-columns: 320px 1fr; height: 100vh; }
.lateral { background: var(--painel); border-right: 1px solid var(--linha); display: flex; flex-direction: column; min-height: 0; }
.lateral > header { background: var(--verde-escuro); color: #fff; padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.marca { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.icone { background: transparent; border: 0; color: inherit; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; flex: none; }
.icone:hover { background: rgba(127, 127, 127, .15); }
.busca-lateral { padding: .6rem .8rem; border-bottom: 1px solid var(--linha); }
.busca-lateral input { border-radius: 20px; background: var(--painel-2); border-color: transparent; padding-left: 2.2em; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23667781'%3E%3Cpath d='M15.5 14h-.8l-.3-.3A6.5 6.5 0 1 0 9.5 16a6.5 6.5 0 0 0 4.2-1.6l.3.3v.8l5 5 1.5-1.5-5-5zm-6 0a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: .75em center; }
.lista { overflow: auto; flex: 1; }
.item { display: flex; gap: .75rem; align-items: center; padding: .7rem 1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--linha); cursor: pointer; position: relative; }
.item:hover { background: var(--painel-2); }
.item.sel { background: var(--painel-2); }
.item.sel::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--verde); }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--verde); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; }
.avatar.peq { width: 36px; height: 36px; font-size: .8rem; }
.item .meio { min-width: 0; flex: 1; }
.item .titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; gap: .5rem; }
.item .titulo time { font-weight: 400; font-size: .75rem; color: var(--suave); flex: none; }
.item .sub { font-size: .85rem; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contador { background: var(--verde-vivo); color: #fff; border-radius: 12px; font-size: .72rem; font-weight: 700; padding: .05em .5em; min-width: 1.5em; text-align: center; flex: none; }
.contador.alerta { background: var(--alerta); }
.rodape-lateral { padding: .7rem 1rem; border-top: 1px solid var(--linha); font-size: .85rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rodape-lateral nav { display: flex; gap: .8rem; flex-wrap: wrap; }

.principal { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.topo { background: var(--painel); border-bottom: 1px solid var(--linha); padding: .55rem 1.25rem 0; display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.topo .ident { display: flex; align-items: center; gap: .75rem; padding-bottom: .55rem; min-width: 0; }
.topo .nome { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abas { display: flex; gap: .1rem; overflow-x: auto; margin-left: auto; align-self: flex-end; scrollbar-width: none; }
.abas a { padding: .55em .85em .7em; text-decoration: none; color: var(--suave); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; font-size: .92rem; }
.abas a:hover { color: var(--tinta); }
.abas a.sel { color: var(--verde); border-bottom-color: var(--verde); }
.abas a .contador { margin-left: .3em; }
.voltar { display: none; }
.conteudo { flex: 1; overflow: auto; padding: 1.5rem 1.25rem 4rem; }
.conteudo.cheio { padding: 0; overflow: hidden; display: flex; }
.folha { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1.5rem; max-width: 880px; margin: 0 auto 1rem; }
.largo { max-width: 1100px; margin: 0 auto; }
.vazio { text-align: center; padding: 3.5rem 1rem; color: var(--suave); }
.vazio h2 { color: var(--tinta); }
.vazio p { margin-left: auto; margin-right: auto; }

/* ============ Visão geral ============ */
.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.numero { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1rem 1.1rem; text-decoration: none; color: inherit; }
.numero b { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.numero span { color: var(--suave); font-size: .87rem; }
.numero.alerta { border-color: var(--alerta); background: var(--alerta-claro); }
.numero.alerta b { color: var(--alerta); }
.prontidao { list-style: none; padding: 0; margin: 0; }
.prontidao li { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--linha); }
.prontidao li:last-child { border-bottom: 0; }
.prontidao .marca-ok { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--painel-2); box-shadow: inset 0 0 0 1.5px var(--linha); font-size: .8rem; color: var(--suave); }
.prontidao li.feito .marca-ok { background: var(--verde-vivo); box-shadow: none; color: #fff; }
.prontidao li.feito .txt { color: var(--suave); text-decoration: line-through; }
.prontidao .txt { flex: 1; }
.barra { height: 8px; border-radius: 8px; background: var(--painel-2); overflow: hidden; margin: .4rem 0 1rem; }
.barra i { display: block; height: 100%; background: var(--verde-vivo); border-radius: 8px; transition: width .4s; }

/* ============ Configurar (passo a passo) ============ */
.passos { display: flex; gap: .4rem; flex-wrap: wrap; max-width: 880px; margin: 0 auto 1rem; }
.passos button { border: 1px solid var(--linha); background: var(--painel); border-radius: 20px; padding: .4em .9em; cursor: pointer; color: var(--suave); font-weight: 500; }
.passos button b { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; border-radius: 50%; background: var(--painel-2); margin-right: .4em; font-size: .78rem; }
.passos button.sel { color: var(--tinta); font-weight: 600; border-color: var(--verde); }
.passos button.sel b { background: var(--verde); color: #fff; }
.barra-salvar { position: sticky; bottom: 0; max-width: 880px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: 0 -6px 20px rgba(11, 20, 26, .06); }
.par { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; margin-bottom: .5rem; align-items: start; }
.par.plano { grid-template-columns: 1.3fr .7fr 1.3fr auto; }
.par.atalho { grid-template-columns: 160px 1fr auto; }
.par.atalho input { font-weight: 600; }
.separador { border: 0; border-top: 1px solid var(--linha); margin: 1.5rem 0; }

/* ============ Atendimentos: CRM em 3 colunas ============ */
.crm { display: grid; grid-template-columns: 340px 1fr 300px; flex: 1; min-height: 0; width: 100%; }
.crm.sem-ficha { grid-template-columns: 340px 1fr; }
.fila { border-right: 1px solid var(--linha); background: var(--painel); display: flex; flex-direction: column; min-height: 0; }
.fila .ferramentas { padding: .6rem .75rem; border-bottom: 1px solid var(--linha); display: grid; gap: .5rem; }
.fila .ferramentas input { border-radius: 20px; background: var(--painel-2); border-color: transparent; }
.filtros { display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; }
.filtros button { border: 0; border-radius: 16px; padding: .3em .8em; background: var(--painel-2); color: var(--suave); font-weight: 600; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.filtros button.sel { background: var(--verde-claro); color: var(--verde); }
.filtros button .contador { margin-left: .25em; font-size: .68rem; }
.robo { font-size: .72rem; }

.chat { display: flex; flex-direction: column; background-color: var(--conversa); min-height: 0; min-width: 0;
  background-image: radial-gradient(rgba(7, 94, 84, .06) 1.2px, transparent 1.4px); background-size: 22px 22px; }
.chat .cab { background: var(--painel); border-bottom: 1px solid var(--linha); padding: .6rem 1rem; display: flex; gap: .75rem; align-items: center; }
.chat .cab .quem-cab { min-width: 0; flex: 1; }
.chat .cab .quem-cab > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .cab .acoes { margin-left: auto; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chat .msgs { flex: 1; overflow: auto; padding: 1rem 5%; display: flex; flex-direction: column; gap: .3rem; }
.balao { max-width: min(75%, 540px); padding: .45em .65em .3em; border-radius: 8px; box-shadow: var(--sombra); white-space: pre-wrap; word-wrap: break-word; position: relative; }
.balao .hora { float: right; font-size: .68rem; color: var(--suave); margin: .5em 0 0 .8em; }
.balao.dele { align-self: flex-start; background: var(--balao-dele); border-top-left-radius: 0; }
.balao.meu { align-self: flex-end; background: var(--balao-meu); border-top-right-radius: 0; }
.balao.humano { align-self: flex-end; background: var(--balao-humano); border-top-right-radius: 0; }
.balao .autor { display: block; font-size: .72rem; font-weight: 700; color: var(--verde); }
.dia { align-self: center; background: var(--painel); color: var(--suave); font-size: .75rem; padding: .2em .8em; border-radius: 8px; box-shadow: var(--sombra); margin: .5rem 0; }
.sistema { align-self: center; background: var(--painel); color: var(--suave); font-size: .8rem; padding: .25em .8em; border-radius: 8px; box-shadow: var(--sombra); text-align: center; max-width: 90%; }
/* O "porquê" do robô: a decisão aparece colada à resposta */
.porque { align-self: flex-end; display: flex; gap: .4em; align-items: center; font-size: .76rem; margin: -.1rem 0 .3rem; color: var(--suave); max-width: min(75%, 540px); }
.porque.esq { align-self: flex-start; }
.porque b { padding: .05em .6em; border-radius: 20px; font-weight: 600; color: #fff; background: var(--verde); white-space: nowrap; }
.porque.transbordo b { background: var(--alerta); }
.porque.agendar b { background: var(--azul); }
.digitando { align-self: flex-start; color: var(--suave); font-size: .85rem; font-style: italic; }

/* Campo de resposta estilo WhatsApp: Enter envia, Shift+Enter quebra linha, "/" respostas rápidas */
.compositor { position: relative; display: flex; gap: .5rem; align-items: flex-end; padding: .6rem .8rem; background: var(--fundo); border-top: 1px solid var(--linha); }
.compositor textarea { flex: 1; border-radius: 22px; border: 0; padding: .7em 1.1em; resize: none; min-height: 0; max-height: 160px; line-height: 1.4; background: var(--painel); }
.compositor .dica { position: absolute; left: 1.6rem; bottom: calc(100% + 2px); font-size: .72rem; color: var(--suave); background: var(--fundo); padding: .1em .6em; border-radius: 6px 6px 0 0; }
.enviar { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--verde); color: #fff; cursor: pointer; display: grid; place-items: center; }
.rapidas { position: absolute; left: .8rem; right: .8rem; bottom: calc(100% + 4px); background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra-alta); max-height: 260px; overflow: auto; z-index: 5; }
.rapidas button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .55rem .9rem; cursor: pointer; border-bottom: 1px solid var(--linha); }
.rapidas button:last-child { border-bottom: 0; }
.rapidas button b { color: var(--verde); margin-right: .4em; }
.rapidas button span { color: var(--suave); }
.rapidas button.sel, .rapidas button:hover { background: var(--verde-claro); }
.rapidas .vazio-r { padding: .7rem .9rem; color: var(--suave); font-size: .85rem; }
.sugestoes { display: flex; gap: .4rem; flex-wrap: wrap; padding: .5rem .8rem 0; background: var(--fundo); }
.sugestoes button { border: 1px solid var(--linha); background: var(--painel); border-radius: 16px; padding: .3em .8em; cursor: pointer; font-size: .85rem; }

.ficha { background: var(--painel); border-left: 1px solid var(--linha); overflow: auto; padding: 1.1rem; }
.ficha .topo-ficha { text-align: center; padding-bottom: 1rem; border-bottom: 1px solid var(--linha); margin-bottom: 1rem; }
.ficha .topo-ficha .avatar { width: 72px; height: 72px; font-size: 1.4rem; margin: 0 auto .6rem; }
.ficha h3 { font-size: .8rem; color: var(--suave); font-weight: 600; margin: 1rem 0 .4rem; }
.ficha textarea { min-height: 6em; font-size: .9rem; }
.acoes-rapidas { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.acoes-rapidas .btn { font-size: .82rem; padding: .45em .6em; }
.sem-conversa { flex: 1; display: grid; place-items: center; text-align: center; color: var(--suave); padding: 2rem; background: var(--painel-2); }
.sem-conversa kbd { margin: 0 .1em; }

/* Funil (visão alternativa) */
.funil { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .75rem; overflow-x: auto; padding: 1rem 1.25rem; align-items: start; width: 100%; }
.coluna { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); max-height: calc(100vh - 170px); display: flex; flex-direction: column; }
.coluna h3 { padding: .75rem .9rem; margin: 0; display: flex; justify-content: space-between; border-bottom: 3px solid var(--linha); font-size: .9rem; }
.coluna[data-etapa=humano] h3 { border-bottom-color: var(--alerta); }
.coluna[data-etapa=agendado] h3 { border-bottom-color: var(--azul); }
.coluna[data-etapa=ganho] h3 { border-bottom-color: var(--verde-vivo); }
.coluna .lista { padding: .25rem 0; }
.coluna .item { padding: .55rem .9rem; }

/* Agenda */
.agenda-dia { margin-bottom: 1.25rem; }
.agenda-dia h3 { font-size: .9rem; color: var(--suave); text-transform: capitalize; }
.cartao-ag { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); margin-bottom: .5rem; flex-wrap: wrap; }
.cartao-ag .hora-g { font-weight: 800; font-size: 1.2rem; min-width: 3.5em; }
.cartao-ag .quem { flex: 1; min-width: 160px; }
.cartao-ag select { width: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { font-size: .8rem; color: var(--suave); font-weight: 600; }

.qr { display: grid; place-items: center; padding: 1rem; background: #fff; border-radius: var(--raio); width: 300px; height: 300px; margin: 1rem 0; border: 1px solid var(--linha); }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.estado { display: flex; align-items: center; gap: .6rem; font-weight: 600; margin: .5rem 0 1rem; }
.bolinha { width: 12px; height: 12px; border-radius: 50%; background: var(--suave); flex: none; }
.bolinha.open { background: var(--verde-vivo); box-shadow: 0 0 0 4px rgba(37, 211, 102, .2); }
.bolinha.connecting, .bolinha.qrcode, .bolinha.gerando { background: var(--aviso); }
.bolinha.close, .bolinha.servidor_indisponivel { background: var(--alerta); }
ol.instrucoes { padding-left: 1.2rem; } ol.instrucoes li { margin-bottom: .4rem; }

.aviso-caixa { border-left: 4px solid var(--aviso); background: var(--painel); padding: .8rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.aviso-caixa.ok { border-left-color: var(--verde-vivo); }
.aviso-caixa.erro { border-left-color: var(--alerta); }

#toast { visibility: hidden; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(200%); background: #303030; color: #fff; padding: .7em 1.2em; border-radius: 10px; transition: transform .25s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { visibility: visible; transform: translateX(-50%) translateY(0); }
#toast.erro { background: var(--alerta); }

dialog { border: 0; border-radius: 16px; padding: 1.5rem; width: min(480px, calc(100% - 32px)); background: var(--painel); color: var(--tinta); box-shadow: var(--sombra-alta); }
dialog::backdrop { background: rgba(11, 20, 26, .5); }
dialog .acoes { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.lista-atalhos { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; align-items: center; font-size: .92rem; }
.lista-atalhos dt { white-space: nowrap; }
.lista-atalhos dd { margin: 0; color: var(--suave); }

/* ============ Responsivo ============ */
@media (max-width: 1180px) {
  .crm { grid-template-columns: 300px 1fr; }
  .crm .ficha { display: none; }
  .crm.ficha-aberta .ficha { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 100%); z-index: 30; box-shadow: var(--sombra-alta); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .app.com-academia .lateral { display: none; }
  .app:not(.com-academia) .principal { display: none; }
  .voltar { display: grid; }
  .topo { padding: .5rem 12px 0; }
  .abas { margin-left: 0; width: 100%; }
  .conteudo { padding: 1rem 14px 4rem; }
  .folha { padding: 1.1rem; }
  .par, .par.plano, .par.atalho { grid-template-columns: 1fr; }
  .crm, .crm.sem-ficha { grid-template-columns: 1fr; }
  .crm.com-conversa .fila { display: none; }
  .crm:not(.com-conversa) .chat, .crm:not(.com-conversa) .sem-conversa { display: none; }
  .chat .msgs { padding: 1rem 10px; }
  .chat .cab .rot { display: none; }
  .principal:has(.crm.com-conversa) .topo { display: none; }
  .balao { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ============ Relatório, equipe e refinamentos (v3) ============ */
:root { --fundo: #F5F6F8; --raio: 14px; }
.lateral > header { background: var(--painel); color: var(--tinta); border-bottom: 1px solid var(--linha); }
.lateral > header .marca { color: var(--verde-escuro); }
:root[data-theme="dark"] .lateral > header .marca { color: var(--tinta); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lateral > header .marca { color: var(--tinta); } }
h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -.03em; }
.folha, .numero, .tabela-cartao { box-shadow: 0 1px 2px rgba(11, 20, 26, .04), 0 4px 16px rgba(11, 20, 26, .03); }
.numero b { font-size: 2.1rem; }
.cabecalho-pagina { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .25rem 0 1.25rem; }
.cabecalho-pagina h1 { margin-bottom: .15em; }
.cabecalho-pagina p { margin: 0; }
.tabela-cartao { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); overflow-x: auto; }
table.relatorio th { padding: .8rem 1rem; background: var(--painel-2); }
table.relatorio td { padding: .85rem 1rem; }
table.relatorio tbody tr { cursor: pointer; transition: background .12s; }
table.relatorio tbody tr:hover, table.relatorio tbody tr:focus-visible { background: var(--painel-2); outline: none; }
table.relatorio tbody tr:last-child td { border-bottom: 0; }
table.relatorio .num { text-align: right; font-variant-numeric: tabular-nums; }
.celula-nome { display: flex; align-items: center; gap: .7rem; min-width: 180px; }
.pilula.ok { background: #D9FDD3; color: #075E54; }
.problema { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15em .6em; border-radius: 6px; margin: .1rem .25rem .1rem 0; background: var(--painel-2); color: var(--suave); }
.problema.erro { background: var(--alerta-claro); color: var(--alerta); }
.problema.aviso { background: #FFF2CC; color: #7A5300; }
.linha-equipe { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--linha); }
.linha-equipe:last-child { border-bottom: 0; }
.linha-equipe .meio { flex: 1; min-width: 0; }
.caixa-msg { white-space: pre-wrap; background: var(--painel-2); padding: 1rem; border-radius: 10px; font: inherit; }
.campo-prefixo { display: flex; align-items: stretch; border: 1.5px solid var(--linha); border-radius: 10px; overflow: hidden; background: var(--painel); }
.campo-prefixo:focus-within { border-color: var(--verde); }
.campo-prefixo span { padding: .6em .2em .6em .8em; color: var(--suave); white-space: nowrap; background: var(--painel-2); font-size: .9rem; display: flex; align-items: center; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.campo-prefixo input { border: 0 !important; border-radius: 0; padding-left: .2em; min-width: 0; }
.cartao-link { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.link-grande { font-size: 1.15rem; word-break: break-all; }
.link-grande b { color: var(--verde); }

/* Modo escuro: texto escuro sobre o verde (contraste AA), como no WhatsApp */
:root[data-theme="dark"] .btn:not(.neutro):not(.claro):not(.perigo), :root[data-theme="dark"] .enviar, :root[data-theme="dark"] .avatar { color: #06261F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.neutro):not(.claro):not(.perigo), :root:not([data-theme="light"]) .enviar, :root:not([data-theme="light"]) .avatar { color: #06261F; } }

/* Pedido de horário para a equipe confirmar */
.consulta { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; margin: .5rem 0; border: 1px solid var(--azul); border-left-width: 4px; border-radius: 10px; background: color-mix(in srgb, var(--azul) 8%, var(--painel)); }
.chat > .consulta { margin: .5rem .75rem 0; }
.consulta-txt { display: grid; gap: .15rem; min-width: 0; }
.consulta-txt span { color: var(--suave); font-size: .85rem; }
.consulta-bts { display: flex; flex-wrap: wrap; gap: .4rem; }
.porque.consultar b { background: var(--azul); }
