/* IAJus: interface do assistente e páginas públicas. Sem build: CSS próprio com tokens e tema claro/escuro. */
:root {
    --fundo: #f6f7f9;
    --superficie: #ffffff;
    --superficie-2: #f0f2f5;
    --borda: #dfe3e8;
    --texto: #18212b;
    --suave: #5a6574;
    --primaria: #1f4e79;
    --primaria-forte: #163a5b;
    --primaria-clara: #e7eef6;
    --acento: #b7862c;
    --perigo: #b42318;
    --perigo-claro: #fdecea;
    --ok: #1f7a4d;
    --raio: 10px;
    --sombra: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
    --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --lateral: 288px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --fundo: #0f141a;
        --superficie: #161d25;
        --superficie-2: #1c2530;
        --borda: #2a3542;
        --texto: #e6ebf0;
        --suave: #9aa6b4;
        --primaria: #6ea8dc;
        --primaria-forte: #8fbde6;
        --primaria-clara: #1b2b3c;
        --perigo: #f2867c;
        --perigo-claro: #3a1d1b;
        --ok: #5cc28f;
        --sombra: none;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--fonte); color: var(--texto); background: var(--fundo); }
a { color: var(--primaria); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[x-cloak] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pular { position: absolute; left: -999px; top: 0; z-index: 99; background: var(--superficie); padding: .5rem 1rem; }
.pular:focus { left: 8px; }
.suave { color: var(--suave); }
.pequeno { font-size: .85rem; }
.vazio { color: var(--suave); font-size: .9rem; padding: .5rem .25rem; list-style: none; }
.pre { white-space: pre-wrap; }
:focus-visible { outline: 2px solid var(--primaria); outline-offset: 2px; }

/* Botões e campos */
.botao { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem .95rem; border-radius: 8px;
    border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; }
.botao-primario { background: var(--primaria); color: #fff; }
@media (prefers-color-scheme: dark) { .botao-primario { color: #0f141a; } }
.botao-primario:hover { background: var(--primaria-forte); }
.botao-claro { background: var(--superficie); color: var(--texto); border-color: var(--borda); }
.botao-claro:hover { background: var(--superficie-2); }
.botao-claro.ligado { border-color: var(--primaria); color: var(--primaria); background: var(--primaria-clara); }
.botao-perigo { background: var(--superficie); color: var(--perigo); border-color: var(--perigo); }
.botao-bloco { width: 100%; }
.botao[disabled], .botao-enviar[disabled] { opacity: .5; cursor: not-allowed; }
.link-discreto { background: none; border: 0; padding: 0; font: inherit; color: var(--suave); cursor: pointer; text-decoration: none; font-size: .85rem; }
.link-discreto:hover { color: var(--texto); text-decoration: underline; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
    width: 100%; font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borda); border-radius: 8px; padding: .6rem .75rem; }
input:focus, textarea:focus { outline: 2px solid var(--primaria); outline-offset: -1px; border-color: transparent; }
.formulario { display: grid; gap: .85rem; }
.formulario label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.formulario label.marcar, .formulario label.chave { display: flex; font-weight: 400; }
.linha-botoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.erro-campo { color: var(--perigo); font-size: .85rem; margin: 0; }
.aviso { background: var(--primaria-clara); border-radius: 8px; padding: .6rem .85rem; margin: 0 0 .75rem; }
.etiqueta { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 99px; background: var(--superficie-2); color: var(--suave); border: 1px solid var(--borda); white-space: nowrap; text-decoration: none; }
.etiqueta-espaco { color: var(--primaria); background: var(--primaria-clara); border-color: transparent; }
.chave { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; user-select: none; }
.chave input { position: absolute; opacity: 0; }
.chave span { width: 34px; height: 20px; border-radius: 99px; background: var(--borda); position: relative; transition: background .15s; flex: none; }
.chave span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.chave input:checked + span { background: var(--primaria); }
.chave input:checked + span::after { transform: translateX(14px); }
.chave input:focus-visible + span { outline: 2px solid var(--primaria); outline-offset: 2px; }

/* Casca do aplicativo */
.casca { display: grid; grid-template-columns: var(--lateral) 1fr; height: 100dvh; }
.lateral { background: var(--superficie); border-right: 1px solid var(--borda); overflow: hidden; display: flex; }
.lateral-conteudo { display: flex; flex-direction: column; gap: .75rem; padding: .9rem; width: 100%; min-height: 0; }
.marca-link { display: flex; align-items: center; gap: .6rem; color: var(--texto); text-decoration: none; }
.marca-link img { border-radius: 8px; }
.marca-link span { display: grid; line-height: 1.2; min-width: 0; }
.marca-link small { color: var(--suave); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atalhos { display: grid; }
.atalho { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; border-radius: 8px; color: var(--texto); text-decoration: none; font-weight: 500; }
.atalho:hover, .atalho.ativo { background: var(--superficie-2); }
.busca input { padding: .45rem .7rem; font-size: .9rem; }
.listas { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -.4rem; padding: 0 .4rem; }
.lista-titulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); margin: .9rem .35rem .3rem; }
.lista { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: .4rem; padding: .42rem .55rem; border-radius: 7px; color: var(--texto); text-decoration: none; font-size: .9rem; }
.item:hover { background: var(--superficie-2); }
.item.ativo { background: var(--primaria-clara); color: var(--primaria-forte); font-weight: 600; }
.item-texto { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-texto small { display: block; color: var(--suave); font-size: .75rem; font-weight: 400; }
.rodape-lateral { border-top: 1px solid var(--borda); padding-top: .75rem; display: grid; gap: .5rem; }
.usuario { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primaria-clara); color: var(--primaria); display: grid; place-items: center; font-weight: 700; flex: none; }
.usuario-nome { display: grid; line-height: 1.2; font-size: .9rem; min-width: 0; }
.usuario-nome small { color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rodape-acoes { display: flex; gap: 1rem; }
.rodape-acoes form { margin: 0; }
.principal { min-width: 0; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.botao-menu { display: none; }
.veu { display: none; }

/* Conversa */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--borda); background: var(--superficie); min-height: 58px; }
.chat-titulo { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.chat-titulo h1 { font-size: 1rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-acoes { display: flex; gap: .4rem; flex: none; }
.chat-acoes .botao { min-height: 34px; padding: .35rem .7rem; font-size: .85rem; }
.chat > .aviso { margin: .75rem auto 0; max-width: 820px; width: calc(100% - 2rem); }
.mensagens { flex: 1; overflow-y: auto; padding: 1.25rem 1rem 1rem; display: flex; flex-direction: column; gap: 1.1rem; }
.mensagens > * { width: 100%; max-width: 820px; margin: 0 auto; }
.boas-vindas { text-align: center; padding: 8vh 0 1rem; }
.boas-vindas h2 { font-size: 1.6rem; }
.boas-vindas p { color: var(--suave); max-width: 560px; margin: 0 auto 1.5rem; }
.sugestoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; text-align: left; }
.sugestao { font: inherit; font-size: .9rem; text-align: left; padding: .8rem .9rem; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); color: var(--texto); cursor: pointer; }
.sugestao:hover { border-color: var(--primaria); }
.msg-usuario { align-self: flex-end; display: grid; justify-items: end; gap: .4rem; }
.texto-usuario { background: var(--primaria-clara); padding: .65rem .9rem; border-radius: 14px 14px 4px 14px; max-width: 85%; overflow-wrap: anywhere; }
.msg-assistente { display: grid; gap: .6rem; }
.etapa { display: flex; align-items: center; gap: .5rem; color: var(--suave); font-size: .9rem; }
.pontos { display: inline-flex; gap: 3px; }
.pontos i { width: 6px; height: 6px; border-radius: 50%; background: var(--primaria); animation: pulsar 1.2s infinite ease-in-out; }
.pontos i:nth-child(2) { animation-delay: .15s; }
.pontos i:nth-child(3) { animation-delay: .3s; }
@keyframes pulsar { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pontos i { animation: none; opacity: .7; } }
.msg-rodape { display: flex; gap: 1rem; align-items: center; color: var(--suave); font-size: .78rem; }
.erro { background: var(--perigo-claro); color: var(--perigo); border-radius: 8px; padding: .6rem .85rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.erro p { margin: 0; }
.fontes { border: 1px solid var(--borda); border-radius: 8px; padding: .5rem .8rem; font-size: .88rem; background: var(--superficie); }
.fontes summary { cursor: pointer; font-weight: 600; }
.fontes ol { margin: .5rem 0 0; padding-left: 1.25rem; }
.fontes small { color: var(--suave); }

/* Markdown da resposta */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.2rem 0 .5rem; }
.md h1 { font-size: 1.25rem; } .md h2 { font-size: 1.12rem; } .md h3 { font-size: 1rem; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 .8rem; }
.md ul, .md ol { padding-left: 1.4rem; }
.md li + li { margin-top: .2rem; }
.md blockquote { border-left: 3px solid var(--borda); padding-left: .9rem; color: var(--suave); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--superficie-2); padding: .1em .35em; border-radius: 4px; }
.md pre { background: var(--superficie-2); padding: .8rem; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: .9rem; }
.md th, .md td { border: 1px solid var(--borda); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.md th { background: var(--superficie-2); }

/* Anexos */
.anexos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.anexo { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border: 1px solid var(--borda); border-radius: 8px; background: var(--superficie);
    color: var(--texto); text-decoration: none; max-width: 340px; font-size: .85rem; }
.anexo small { color: var(--suave); white-space: nowrap; }
.anexo-tipo { font-size: .66rem; font-weight: 700; background: var(--primaria-clara); color: var(--primaria); padding: .15rem .35rem; border-radius: 4px; flex: none; }
.anexo-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.anexo button { border: 0; background: none; color: var(--suave); font-size: 1.1rem; cursor: pointer; padding: 0 .2rem; }
.anexo-gerado { border-color: var(--primaria); }

/* Compositor */
.compositor { padding: .6rem 1rem calc(.9rem + env(safe-area-inset-bottom)); display: grid; gap: .45rem; width: 100%; max-width: 852px; margin: 0 auto; }
.caixa { display: flex; align-items: flex-end; gap: .4rem; border: 1px solid var(--borda); border-radius: 14px; background: var(--superficie); padding: .4rem; box-shadow: var(--sombra); }
.caixa:focus-within { border-color: var(--primaria); }
.caixa textarea { border: 0; resize: none; max-height: 40vh; padding: .5rem .35rem; background: transparent; }
.caixa textarea:focus { outline: none; }
.botao-icone, .botao-enviar { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex: none; border: 0; }
.botao-icone { color: var(--suave); background: none; }
.botao-icone:hover { background: var(--superficie-2); color: var(--texto); }
.botao-enviar { background: var(--primaria); color: #fff; }
@media (prefers-color-scheme: dark) { .botao-enviar { color: #0f141a; } }
.opcoes { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0 .3rem; }
.dica { color: var(--suave); font-size: .75rem; }
.barra-envio { height: 3px; background: var(--borda); border-radius: 3px; overflow: hidden; }
.barra-envio span { display: block; height: 100%; background: var(--primaria); transition: width .2s; }

/* Páginas internas */
.pagina { overflow-y: auto; padding: 1.5rem; display: grid; gap: 1rem; align-content: start; height: 100%; }
.pagina > * { width: 100%; max-width: 1040px; margin: 0 auto; }
.pagina-topo { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.pagina-topo p { margin: .25rem 0 0; max-width: 640px; }
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.1rem 1.2rem; box-shadow: var(--sombra); }
.cartao-link { color: var(--texto); text-decoration: none; display: grid; gap: .3rem; }
.cartao-link:hover { border-color: var(--primaria); }
.cartao-link p { margin: 0; }
.meta { color: var(--suave); font-size: .82rem; }
.grade-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.lista-arquivos { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .45rem; }
.lista-arquivos li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.lista-arquivos .anexo { max-width: none; flex: 1; min-width: 0; }
.envio-docs { display: grid; gap: .5rem; border-top: 1px solid var(--borda); padding-top: .75rem; }
.lista-simples { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.lista-simples small { margin-left: .5rem; }

/* Páginas públicas */
.publico { min-height: 100dvh; display: flex; flex-direction: column; }
.topo-publico { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.25rem; background: var(--superficie); border-bottom: 1px solid var(--borda); }
.topo-publico nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.topo-publico nav a { color: var(--texto); text-decoration: none; font-weight: 500; }
.publico main { flex: 1; width: 100%; }
.rodape-publico { color: var(--suave); font-size: .82rem; text-align: center; padding: 1.25rem 1rem; }
.tela-acesso main { display: grid; place-items: center; padding: 2rem 1rem; }
.acesso { width: 100%; max-width: 400px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px; padding: 1.75rem; box-shadow: var(--sombra); }
.acesso > p { margin: .75rem 0 0; }
.doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.doc-menu { position: sticky; top: 1rem; align-self: start; display: grid; gap: .15rem; }
.doc-menu a { color: var(--texto); text-decoration: none; padding: .4rem .6rem; border-radius: 7px; font-size: .92rem; }
.doc-menu a:hover, .doc-menu a.ativo { background: var(--primaria-clara); color: var(--primaria-forte); }
.doc-corpo { max-width: 780px; }
.doc-corpo h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.doc-corpo h2 { font-size: 1.15rem; margin-top: 2rem; scroll-margin-top: 1rem; }
.doc-corpo h3 { font-size: 1rem; margin-top: 1.25rem; }
.doc-corpo table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: .75rem 0 1rem; display: block; overflow-x: auto; }
.doc-corpo th, .doc-corpo td { border: 1px solid var(--borda); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.doc-corpo th { background: var(--superficie-2); }
.doc-corpo .ancora { color: var(--suave); font-size: .78rem; font-family: var(--mono); }
.doc-corpo .destaque { border-left: 3px solid var(--acento); background: var(--superficie); padding: .7rem .9rem; border-radius: 0 8px 8px 0; }
.status-geral { display: flex; align-items: center; gap: .75rem; font-size: 1.1rem; font-weight: 600; }
.bolinha { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); flex: none; }
.bolinha.falha { background: var(--perigo); }
.barras { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; margin: .75rem 0; }
.barras span { height: 34px; border-radius: 3px; background: var(--ok); opacity: .85; }
.barras span.parcial { background: var(--acento); }
.barras span.ruim { background: var(--perigo); }
.barras span.sem { background: var(--borda); }

/* Celular */
@media (max-width: 860px) {
    .casca { grid-template-columns: 1fr; }
    .lateral { position: fixed; inset: 0 auto 0 0; width: min(86vw, var(--lateral)); z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
    .lateral.aberta { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / .25); }
    .veu { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 20; }
    .botao-menu { display: grid; place-items: center; position: absolute; top: 9px; left: 8px; z-index: 10; width: 40px; height: 40px; border: 0; background: none; color: var(--texto); cursor: pointer; }
    .chat-topo { padding-left: 3.25rem; }
    .chat-acoes .botao { padding: .35rem .55rem; }
    .pagina { padding: 3.5rem 1rem 1rem; }
    .colunas { grid-template-columns: 1fr; }
    .doc { grid-template-columns: 1fr; gap: 1rem; }
    .doc-menu { position: static; display: flex; flex-wrap: wrap; }
    .dica { display: none; }
    .texto-usuario { max-width: 92%; }
    input, textarea, select { font-size: 16px; }
}
