/* Demonstração animada do Chat com Cliente na landing (index.php, seção "Chat Integrado com Clientes").
   Substitui o antigo images/img9.png. Usa o selo e o balão do kanban-demo.css, que precisa estar carregado
   antes. O notebook mostra a tela do advogado (chat_advogado.php) e o celular mostra o app do cliente
   (dashboard-app/chat_adv.php), com a mesma conversa nos dois. Cada aparelho tem o próprio tamanho de letra,
   calculado pela largura do bloco (cqi), e o resto é medido em em: a cena cresce e encolhe como uma imagem.
   Prefixo .chd- pra não brigar com o resto da página. */

.chd .kbd-selo {
    font-size: clamp(14px, 4.6cqi, 28px);
    white-space: nowrap;
}

.chd-cena {
    position: relative;
    height: 64cqi;
    margin-bottom: 4px;
    text-align: left;
}

/* ---------- notebook (tela do advogado) ---------- */
.chd-notebook {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50em;
    font-size: 1.59cqi;
    transition: opacity .4s;
}

.chd-tampa {
    position: relative;
    padding: 1.1em .9em .9em;
    border: .1em solid #2b2b33;
    border-radius: 1.1em 1.1em .3em .3em;
    background: #0d0d12;
    box-shadow: 0 1.4em 3em rgba(26, 27, 65, .25);
}

.chd-camera {
    position: absolute;
    top: .35em;
    left: 50%;
    width: .45em;
    height: .45em;
    margin-left: -.22em;
    border-radius: 50%;
    background: #2a2a33;
}

.chd-tela {
    display: flex;
    width: 44em;
    height: 27.3em;
    overflow: hidden;
    border-radius: .25em;
    background: #f4f5f9;
    color: #1A1B41;
    line-height: 1.3;
}

.chd-base {
    position: relative;
    width: 100%;
    height: 1.3em;
    border-radius: 0 0 1.4em 1.4em / 0 0 1em 1em;
    background: linear-gradient(#4a4b54, #1c1d23);
    box-shadow: 0 1em 2em rgba(26, 27, 65, .25);
}

.chd-base::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 7em;
    height: .45em;
    margin-left: -3.5em;
    border-radius: 0 0 .5em .5em;
    background: #15161b;
}

.chd-menu {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    gap: 1.25em;
    width: 3em;
    padding-top: .9em;
    background: linear-gradient(180deg, #1A1B41, #000);
    color: rgba(255, 255, 255, .5);
    font-size: 1em;
}

.chd-menu i { font-size: .8em; }
.chd-menu .chd-logo { color: #f1c40f; font-size: 1.05em; }
.chd-menu .chd-ativo { color: #fff; }

.chd-contatos {
    display: flex;
    flex: none;
    flex-direction: column;
    width: 11em;
    border-right: .08em solid #e8eaed;
    background: #fff;
}

.chd-ct-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75em .7em;
    background: #1A1B41;
    color: #fff;
    font-size: .8em;
    font-weight: 700;
    white-space: nowrap;
}

.chd-ct-topo span:last-child {
    padding: .15em .45em;
    border: .08em solid rgba(255, 255, 255, .25);
    border-radius: .4em;
    color: rgba(255, 255, 255, .75);
    font-size: .8em;
    font-weight: 500;
}

.chd-ct-busca {
    padding: .45em .6em;
    border-bottom: .08em solid #e8eaed;
    background: #fafbfc;
}

.chd-ct-busca span {
    display: block;
    padding: .3em .5em;
    border: .08em solid #e8eaed;
    border-radius: .45em;
    background: #fff;
    color: #aab0bb;
    font-size: .68em;
    white-space: nowrap;
    overflow: hidden;
}

.chd-ct-rotulo {
    padding: .35em .9em;
    border-bottom: .08em solid #e8eaed;
    background: #f8f9fb;
    color: #6b7280;
    font-size: .55em;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.chd-ct {
    display: flex;
    align-items: center;
    gap: .5em;
    padding: .55em .6em;
    border-bottom: .08em solid #f2f3f5;
    border-left: .2em solid transparent;
}

.chd-ct.chd-ativa {
    border-left-color: #1A1B41;
    background: #eef1ff;
}

.chd-ct-av {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.2em;
    height: 2.2em;
    border-radius: 50%;
    color: #fff;
    font-size: .85em;
    font-weight: 700;
}

.chd-av-rosa { background: #ec4899; }
.chd-av-azul { background: #3b82f6; }
.chd-av-ciano { background: #06b6d4; }
.chd-av-verde { background: #10b981; }

.chd-ct-info {
    flex: 1;
    min-width: 0;
}

.chd-ct-nome {
    display: block;
    font-size: .7em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chd-ativa .chd-ct-nome { font-weight: 700; }

.chd-ct-sub {
    display: flex;
    align-items: center;
    gap: .3em;
    margin-top: .1em;
    color: #6b7280;
    font-size: .58em;
    white-space: nowrap;
}

.chd-ct-sub .fa-circle { color: #22c55e; font-size: .7em; }
.chd-nao-lida { color: #3b82f6; font-weight: 600; }

.chd-ct-meta {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: .2em;
    color: #6b7280;
    font-size: .55em;
}

.chd-ct-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    height: 1.6em;
    border-radius: .8em;
    background: #3b82f6;
    color: #fff;
    font-weight: 700;
}

.chd-conversa {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    background: #fff;
}

.chd-cab {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: .6em;
    padding: .55em .9em;
    border-bottom: .08em solid #e8eaed;
    box-shadow: 0 .15em .5em rgba(0, 0, 0, .06);
}

.chd-cab-id {
    display: flex;
    align-items: center;
    gap: .55em;
    min-width: 0;
}

.chd-cab-av {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.4em;
    height: 2.4em;
    border-radius: 50%;
    background: linear-gradient(135deg, #1A1B41, #000);
    color: #fff;
    font-size: .8em;
    font-weight: 700;
}

.chd-cab-nome {
    font-size: .85em;
    font-weight: 600;
    white-space: nowrap;
}

.chd-cab-sub {
    color: #6b7280;
    font-size: .6em;
}

.chd-cab-sub i {
    color: #22c55e;
    font-size: .75em;
}

.chd-voltar,
.chd-desativar {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: .4em;
    padding: .45em .85em;
    border-radius: .6em;
    background: #1A1B41;
    color: #fff;
    font-size: .64em;
    font-weight: 600;
    white-space: nowrap;
}

.chd-desativar { background: #28a745; }

.chd-ia-barra {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: .6em;
    padding: .45em .9em;
    border-bottom: .08em solid #e8eaed;
}

.chd-ia-status {
    display: flex;
    align-items: center;
    gap: .5em;
    min-width: 0;
    color: #28a745;
    font-size: .74em;
    font-weight: 600;
    white-space: nowrap;
}

.chd-ia-status small {
    display: block;
    color: #6b7280;
    font-size: .75em;
    font-weight: 400;
}

.chd-aviso {
    flex: none;
    padding: .45em .9em;
    background: linear-gradient(135deg, #8B5CF6, #A855F7);
    color: #fff;
    font-size: .64em;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chd-msgs {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    padding: .7em .9em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2em);
    mask-image: linear-gradient(to bottom, transparent 0, #000 2em);
    transition: opacity .4s;
}

.chd-rolo {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: .6em;
}

.chd-m {
    display: flex;
    align-items: flex-start;
    gap: .45em;
    max-width: 80%;
    transform-origin: left bottom;
}

.chd-m.chd-m-adv {
    flex-direction: row-reverse;
    margin-left: auto;
    transform-origin: right bottom;
}

.chd-m-av {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 3.1em;
    height: 3.1em;
    border-radius: 50%;
    background: linear-gradient(135deg, #1A1B41, #000);
    color: #fff;
    font-size: .6em;
    font-weight: 700;
}

.chd-m-adv .chd-m-av { background: #FFD700; color: #1A1B41; }
.chd-m-ia .chd-m-av { background: linear-gradient(135deg, #8B5CF6, #A855F7); }

.chd-m-corpo {
    flex: 1;
    min-width: 0;
    padding: .55em .75em;
    border-radius: .7em;
    background: #f0f2f5;
    font-size: .7em;
    line-height: 1.38;
}

.chd-m-adv .chd-m-corpo { background: #1A1B41; color: #fff; }

.chd-m-ia .chd-m-corpo {
    border-left: .3em solid #8B5CF6;
    background: linear-gradient(135deg, #f3f0ff, #e9d5ff);
}

.chd-m-topo {
    display: flex;
    align-items: baseline;
    gap: .7em;
}

.chd-m-topo b {
    font-size: .92em;
    font-weight: 600;
}

.chd-m-topo span {
    color: #6b7280;
    font-size: .8em;
}

.chd-m-adv .chd-m-topo span { color: rgba(255, 255, 255, .6); }

.chd-m p,
.chd-b p {
    margin: .2em 0 0;
}

.chd-itens {
    margin: .25em 0 0;
    padding: 0;
    list-style: none;
}

.chd-itens li {
    display: flex;
    gap: .45em;
    margin-top: .2em;
}

.chd-itens i {
    flex: none;
    width: 1em;
    margin-top: .2em;
    text-align: center;
}

.chd-m-ia .chd-itens i { color: #7c3aed; }

.chd-itens li.chd-oculto { display: none; }

.chd-entrada {
    display: flex;
    flex: none;
    align-items: center;
    gap: .5em;
    padding: .55em .9em;
    border-top: .08em solid #e8eaed;
}

.chd-entrada-campo {
    flex: 1;
    min-width: 0;
    padding: .55em .75em;
    border: .1em solid #e8eaed;
    border-radius: .6em;
    background: #f8f9fa;
    color: #9ca3af;
    font-size: .68em;
    white-space: nowrap;
    overflow: hidden;
}

.chd-entrada-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: .4em;
    padding: .55em .85em;
    border-radius: .6em;
    background: #6b7280;
    color: #fff;
    font-size: .66em;
    font-weight: 600;
}

/* ---------- celular (app do cliente) ---------- */
.chd-celular {
    position: absolute;
    bottom: 0;
    left: 1cqi;
    z-index: 2;
    width: 17.1em;
    height: 35em;
    padding: .55em;
    border: .08em solid #3a3a44;
    border-radius: 2.6em;
    background: #0b0b10;
    box-shadow: 0 1.6em 3.2em rgba(26, 27, 65, .35), inset 0 0 0 .15em #1f2029;
    font-size: 1.59cqi;
    transition: opacity .4s;
}

.chd-cel-tela {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 2.1em;
    background: #f5f7fa;
    color: #1A1B41;
    line-height: 1.3;
}

.chd-ilha {
    position: absolute;
    top: .45em;
    left: 50%;
    z-index: 3;
    width: 5em;
    height: 1.35em;
    margin-left: -2.5em;
    border-radius: 1em;
    background: #000;
}

.chd-status {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    height: 2.3em;
    padding: 0 1.5em;
    background: linear-gradient(135deg, #1A1B41, #000);
    color: #fff;
    font-size: .72em;
    font-weight: 700;
}

.chd-status i { margin-left: .25em; font-size: .85em; }

.chd-app-topo {
    display: flex;
    flex: none;
    align-items: center;
    gap: .45em;
    height: 2.4em;
    padding: 0 .9em;
    background: linear-gradient(135deg, #1A1B41, #000);
    color: #fff;
    font-size: .8em;
    font-weight: 800;
    letter-spacing: .04em;
    white-space: nowrap;
}

.chd-app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8em;
    height: 1.8em;
    border: .1em solid #d4af37;
    border-radius: 50%;
    color: #f1c40f;
    font-size: .9em;
}

.chd-app-titulo {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: .4em;
    padding: .65em .7em .45em;
    font-size: .9em;
    font-weight: 700;
    white-space: nowrap;
}

.chd-app-titulo > span:first-child i { margin-right: .3em; }

.chd-ia-pilula {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .3em .65em;
    border-radius: 1em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: .66em;
    font-weight: 600;
}

.chd-cel-chat {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    margin: 0 .55em;
    padding: .5em;
    overflow: hidden;
    border-radius: .8em;
    background: #202020;
    box-shadow: 0 0 .6em rgba(0, 0, 0, .35);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em);
    mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em);
    transition: opacity .4s;
}

.chd-cel-chat .chd-rolo { gap: .45em; }

.chd-b {
    position: relative;
    max-width: 88%;
    padding: .5em .65em 1.75em;
    border-radius: .75em;
    color: #fff;
    font-size: .72em;
    line-height: 1.35;
}

.chd-b-cliente {
    align-self: flex-end;
    border-bottom-right-radius: 0;
    background: #075e54;
    transform-origin: right bottom;
}

.chd-b-adv {
    align-self: flex-start;
    border-bottom-left-radius: 0;
    background: #2a2a2a;
    transform-origin: left bottom;
}

.chd-b-ia {
    align-self: flex-start;
    border: .13em solid #4f46e5;
    border-bottom-left-radius: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 .3em .6em rgba(79, 70, 229, .3);
    transform-origin: left bottom;
}

.chd-b-nome {
    display: block;
    margin-bottom: .1em;
    color: #c7c7c7;
    font-size: .85em;
    font-weight: 700;
}

.chd-b-ia .chd-b-nome { color: #e0e7ff; }
.chd-b-ia .chd-itens i { color: #fcd34d; }

.chd-b-hora {
    position: absolute;
    right: .65em;
    bottom: .4em;
    color: #c7c7c7;
    font-size: .78em;
}

.chd-tts {
    position: absolute;
    bottom: .3em;
    left: .5em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.7em;
    height: 1.7em;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    font-size: .78em;
}

.chd-tts.chd-falando {
    background: #4caf50;
    animation: chdFala 1s ease-in-out infinite;
}

.chd-pontos {
    display: flex;
    gap: .3em;
    padding: .35em 0 .1em;
}

.chd-pontos span {
    width: .45em;
    height: .45em;
    border-radius: 50%;
    background: currentColor;
    opacity: .6;
    animation: chdPula 1s ease-in-out infinite;
}

.chd-pontos span:nth-child(2) { animation-delay: .15s; }
.chd-pontos span:nth-child(3) { animation-delay: .3s; }

.chd-b-ia.chd-digitando { padding-bottom: .6em; }
.chd-m-ia .chd-pontos { color: #8B5CF6; }

.chd-cel-entrada {
    display: flex;
    flex: none;
    align-items: center;
    gap: .35em;
    padding: .55em .6em;
}

.chd-campo {
    flex: 1;
    min-width: 0;
    padding: .55em .6em;
    border: .08em solid #444;
    border-radius: .4em;
    background: #1c1c1c;
    color: #fff;
    font-size: .7em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chd-campo:empty::before {
    content: attr(data-dica);
    color: #8a8a8a;
}

.chd-campo.chd-escrevendo::after {
    content: '';
    display: inline-block;
    width: .08em;
    height: 1.05em;
    margin-left: .05em;
    vertical-align: -.15em;
    background: #fff;
    animation: chdCursor 1s steps(1) infinite;
}

.chd-enviar,
.chd-mic {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2em;
    height: 2em;
    border-radius: .45em;
    background: #075e54;
    color: #fff;
    font-size: .78em;
    transition: transform .12s, background-color .12s;
}

.chd-enviar.chd-apertado {
    background: #0a8a7b;
    transform: scale(.86);
}

.chd-cel-nav {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-around;
    height: 2.5em;
    padding-bottom: .3em;
    background: linear-gradient(135deg, #1A1B41, #000);
    color: rgba(255, 255, 255, .55);
    font-size: .85em;
}

.chd-cel-nav .chd-ativo { color: #f1c40f; }

.chd.chd-reiniciando .chd-msgs,
.chd.chd-reiniciando .chd-cel-chat {
    opacity: 0;
}

@keyframes chdPula {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-.25em); opacity: 1; }
}

@keyframes chdCursor {
    50% { opacity: 0; }
}

@keyframes chdFala {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, .6); }
    70% { box-shadow: 0 0 0 .6em rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* Celular de pé: o notebook vai pra cima, na largura toda (sem o menu e a lista de conversas), e o
   celular do cliente fica embaixo, à direita, por cima da parte de baixo da tela do notebook. */
@container (max-width: 479px) {
    .chd-cena { height: 137cqi; }
    .chd-notebook { right: auto; left: 1.6cqi; width: 37.2em; font-size: 2.6cqi; }
    .chd-tela { width: 34em; height: 21em; }
    .chd-menu,
    .chd-contatos { display: none; }
    .chd-celular { right: 1cqi; left: auto; font-size: 2.7cqi; }
    .chd .kbd-balao {
        right: auto;
        bottom: 30cqi;
        left: 2cqi;
        max-width: 44cqi;
        border-radius: 1.4em;
        line-height: 1.2;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chd-pontos span,
    .chd-tts.chd-falando,
    .chd-campo.chd-escrevendo::after { animation: none; }
}
