/* Ull.IA: chat em ia.cisdeste.com. Mesma paleta do Portal da regulação, sem depender do style.css dele. */
:root {
  --bg: #ffffff; --lateral: #f4f6fa; --superficie: #ffffff; --realce: #e9edf4; --balao: #eef2f8;
  --texto: #0b1324; --texto-2: #5d6b82; --borda: #e2e8f0;
  --acento: #1d5bd8; --acento-forte: #1747b0; --acento-suave: #e8effd; --sobre-acento: #fff;
  --perigo: #c62f32; --perigo-suave: #fdeeee; --ok: #15803d;
  --sombra: 0 8px 28px -12px rgba(16, 24, 40, .28);
  --fonte: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --fonte-titulo: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424; --lateral: #0a1120; --superficie: #151f35; --realce: #1b2740; --balao: #1b2740;
    --texto: #e8edf6; --texto-2: #93a1ba; --borda: #22304b;
    --acento: #6f9cf3; --acento-forte: #8fb2f6; --acento-suave: #172748; --sobre-acento: #0a1120;
    --perigo: #ff8a8c; --perigo-suave: #3a1619; --ok: #4ade80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424; --lateral: #0a1120; --superficie: #151f35; --realce: #1b2740; --balao: #1b2740;
  --texto: #e8edf6; --texto-2: #93a1ba; --borda: #22304b;
  --acento: #6f9cf3; --acento-forte: #8fb2f6; --acento-suave: #172748; --sobre-acento: #0a1120;
  --perigo: #ff8a8c; --perigo-suave: #3a1619; --ok: #4ade80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--fonte); font-size: 15px; line-height: 1.55; color: var(--texto); background: var(--bg); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.marca-ia {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 9px;
  color: #fff; background: linear-gradient(135deg, #1747b0, #2b6cf0);
}
.marca-ia svg { width: 16px; height: 16px; }
.marca-ia--grande { width: 52px; height: 52px; border-radius: 16px; }
.marca-ia--grande svg { width: 28px; height: 28px; }
.marca-ia--neutra { background: var(--realce); color: var(--texto-2); }

.giro { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: giro .8s linear infinite; display: none; }
.giro--acento { display: block; width: 26px; height: 26px; border-color: var(--borda); border-top-color: var(--acento); }
button:disabled .giro { display: inline-block; }
@keyframes giro { to { transform: rotate(360deg); } }

/* ---------- Login e aviso de acesso ---------- */
.tela-central { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 360px; text-align: center; }
.login h1 { font-family: var(--fonte-titulo); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 4px; }
.login__sub { margin: 0 0 22px; color: var(--texto-2); }
.login form { display: grid; gap: 14px; text-align: left; }
.login label { display: grid; gap: 6px; font-size: .84rem; font-weight: 600; }
.login input { padding: 11px 13px; font-size: 16px; border-radius: 11px; border: 1px solid var(--borda); background: var(--superficie); }
.login input:focus { outline: 2px solid var(--acento); outline-offset: 0; border-color: transparent; }
.login__rodape { margin: 18px 0 0; font-size: .8rem; color: var(--texto-2); }
.botao-primario, .botao-secundario {
  width: 100%; padding: 11px 16px; font-weight: 600; border-radius: 11px; display: inline-flex; justify-content: center; align-items: center; gap: 10px;
}
.botao-primario { border: 0; background: var(--acento); color: var(--sobre-acento); }
.botao-primario:hover { background: var(--acento-forte); }
.botao-primario:disabled { opacity: .75; cursor: progress; }
.botao-secundario { border: 1px solid var(--borda); background: transparent; }
.botao-secundario:hover { background: var(--realce); }
.aviso { margin: 0; font-size: .84rem; color: var(--texto-2); }
.aviso--erro { padding: 9px 12px; border-radius: 10px; color: var(--perigo); background: var(--perigo-suave); font-weight: 600; }

/* ---------- Estrutura do chat ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.lateral { flex: none; width: 272px; display: flex; flex-direction: column; background: var(--lateral); border-right: 1px solid var(--borda); }
.lateral__topo { padding: 14px 14px 10px; }
.marca { display: inline-flex; align-items: center; gap: 10px; font-family: var(--fonte-titulo); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.nova-conversa {
  display: flex; align-items: center; gap: 8px; margin: 0 10px 10px; padding: 9px 12px; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--borda); border-radius: 10px; background: var(--superficie);
}
.nova-conversa:hover { background: var(--realce); }
.nova-conversa svg { width: 16px; height: 16px; }

.conversas { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 10px; }
.conversas__grupo { margin: 12px 8px 4px; font-size: .74rem; font-weight: 600; color: var(--texto-2); }
.conversa { display: flex; align-items: center; border-radius: 9px; }
.conversa:hover, .conversa--ativa { background: var(--realce); }
.conversa__abrir { flex: 1; min-width: 0; padding: 8px 10px; text-align: left; font-size: .88rem; border: 0; background: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversa__apagar { flex: none; display: none; place-items: center; width: 28px; height: 28px; margin-right: 3px; border: 0; border-radius: 7px; background: none; color: var(--texto-2); }
.conversa:hover .conversa__apagar, .conversa--ativa .conversa__apagar, .conversa__apagar:focus-visible { display: grid; }
.conversa__apagar:hover { color: var(--perigo); }
.conversa__apagar svg { width: 15px; height: 15px; }

.conversas { margin-bottom: 6px; }
.lateral__rodape { margin-top: 6px; display: flex; align-items: center; gap: 2px; padding: 10px; border-top: 1px solid var(--borda); }
.usuario { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; }
.usuario__avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: .8rem; font-weight: 700; color: var(--acento); background: var(--acento-suave); }
.usuario__nome { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--texto-2); }
.icone:hover { background: var(--realce); color: var(--texto); }
.icone svg { width: 18px; height: 18px; }
.tema-sol { display: none; }
:root[data-theme="dark"] .tema-sol { display: block; }
:root[data-theme="dark"] .tema-lua { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tema-sol { display: block; }
  :root:not([data-theme="light"]) .tema-lua { display: none; }
}

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px; }
#abrirLateral { display: none; }
.topo__titulo { flex: 1; min-width: 0; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo__cidade {
  flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; font-size: .78rem; font-weight: 600;
  border-radius: 999px; color: var(--acento); background: var(--acento-suave);
}
.topo__cidade svg { width: 14px; height: 14px; }

.rolagem { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 20px; scroll-behavior: smooth; }
.mensagens, .composer, .boas-vindas, .ressalva { width: 100%; max-width: 760px; margin-inline: auto; }

/* ---------- Boas-vindas ---------- */
.boas-vindas { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px 0; }
.boas-vindas h1 { font-family: var(--fonte-titulo); font-size: clamp(1.45rem, 4vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; margin: 16px 0 6px; }
.boas-vindas p { margin: 0 0 24px; max-width: 480px; color: var(--texto-2); }
.sugestoes { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sugestao { padding: 12px 14px; font-size: .88rem; text-align: left; border: 1px solid var(--borda); border-radius: 13px; background: var(--superficie); }
.sugestao:hover { background: var(--realce); }

/* ---------- Mensagens ---------- */
.mensagens { display: flex; flex-direction: column; gap: 22px; }
.msg-usuario { align-self: flex-end; max-width: 82%; padding: 9px 15px; border-radius: 18px 18px 5px 18px; background: var(--balao); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-ia { display: flex; gap: 12px; align-items: flex-start; }
.msg-ia__corpo { flex: 1; min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.msg-ia__corpo > .texto > :first-child { margin-top: 0; }
.texto p { margin: 0 0 10px; }
.texto h4 { margin: 14px 0 6px; font-size: .98rem; font-weight: 700; }
.texto ul, .texto ol { margin: 0 0 10px; padding-left: 22px; }
.texto li { margin-bottom: 4px; }
.texto code { padding: 1px 5px; font-size: .88em; border-radius: 5px; background: var(--realce); }
.msg-erro { color: var(--perigo); }

.cita {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin: 0 1px; padding: 0 4px; vertical-align: 1px;
  font-size: .68rem; font-weight: 700; line-height: 1; border: 0; border-radius: 999px; color: var(--acento); background: var(--acento-suave);
}
.cita:hover { color: var(--sobre-acento); background: var(--acento); }

.pensando { display: inline-flex; align-items: center; gap: 10px; min-height: 28px; color: var(--texto-2); font-size: .9rem; }
.pensando__pontos { display: inline-flex; gap: 4px; }
.pensando__pontos i { width: 6px; height: 6px; border-radius: 50%; background: var(--acento); animation: pulso 1.2s infinite ease-in-out; }
.pensando__pontos i:nth-child(2) { animation-delay: .15s; }
.pensando__pontos i:nth-child(3) { animation-delay: .3s; }
@keyframes pulso { 0%, 70%, 100% { opacity: .3; transform: scale(.85); } 35% { opacity: 1; transform: scale(1); } }

.privacidade { display: flex; gap: 8px; margin-top: 4px; padding: 8px 11px; font-size: .82rem; border-radius: 10px; color: var(--texto-2); background: var(--realce); }
.privacidade svg { flex: none; width: 15px; height: 15px; margin-top: 2px; }

.fontes { margin-top: 8px; }
.fontes summary { width: fit-content; font-size: .8rem; font-weight: 600; color: var(--texto-2); cursor: pointer; }
.fontes summary:hover { color: var(--texto); }
.fontes ol { margin: 6px 0 0; padding-left: 20px; font-size: .84rem; color: var(--texto-2); }
.fontes li { margin-bottom: 2px; }
.fontes li.destaque { color: var(--texto); font-weight: 600; }

.acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 6px; margin-left: -7px; }
.acao { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--texto-2); }
.acao:hover { background: var(--realce); color: var(--texto); }
.acao svg { width: 16px; height: 16px; }
.acao--feita { color: var(--ok); }
.acao--ativa { color: var(--acento); background: var(--acento-suave); }
.acoes__nota { margin-left: 6px; font-size: .8rem; color: var(--texto-2); }

.nota { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border: 1px solid var(--borda); border-radius: 12px; background: var(--superficie); }
.nota label { font-size: .84rem; font-weight: 600; }
.nota textarea { width: 100%; min-height: 76px; padding: 8px 10px; font-size: 16px; resize: vertical; border: 1px solid var(--borda); border-radius: 9px; background: var(--bg); }
.nota__botoes { display: flex; justify-content: flex-end; gap: 8px; }
.nota__botoes button { padding: 7px 13px; font-size: .85rem; font-weight: 600; border-radius: 8px; }
.nota__cancelar { border: 1px solid var(--borda); background: none; }
.nota__enviar { border: 0; color: var(--sobre-acento); background: var(--acento); }
.nota__enviar:disabled { opacity: .7; }

/* ---------- Caixa de pergunta ---------- */
.rodape-chat { padding: 0 16px calc(10px + env(safe-area-inset-bottom)); }
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 9px 9px 9px 16px; border: 1px solid var(--borda); border-radius: 22px;
  background: var(--superficie); box-shadow: var(--sombra);
}
.composer:focus-within { border-color: var(--acento); }
.composer textarea { flex: 1; min-width: 0; max-height: 220px; padding: 5px 0; font-size: 16px; line-height: 1.45; border: 0; outline: 0; resize: none; background: none; }
.enviar { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--sobre-acento); background: var(--acento); }
.enviar:hover { background: var(--acento-forte); }
.enviar:disabled { color: var(--texto-2); background: var(--realce); cursor: default; }
.enviar svg { width: 18px; height: 18px; }
.ressalva { margin-top: 7px; margin-bottom: 0; text-align: center; font-size: .74rem; color: var(--texto-2); }

/* ---------- Acessos (admins) ---------- */
.lateral__acessos { display: flex; align-items: center; gap: 8px; margin: 0 10px 4px; padding: 8px 12px; color: inherit; text-decoration: none; font-size: .88rem; font-weight: 500; text-align: left; border: 0; border-radius: 9px; background: none; }
.lateral__acessos:hover, .lateral__acessos--ativo { background: var(--realce); }
.lateral__acessos svg { width: 17px; height: 17px; }
.acessos { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 24px; }
.acessos__conteudo { width: 100%; max-width: 760px; margin-inline: auto; display: grid; gap: 12px; }
.acessos__resumo { margin: 0; color: var(--texto-2); font-size: .9rem; }
.acessos__filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.acessos__busca { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--borda); border-radius: 10px; background: var(--superficie); }
.acessos__busca:focus-within { border-color: var(--acento); }
.acessos__busca svg { flex: none; width: 16px; height: 16px; color: var(--texto-2); }
.acessos__busca input { flex: 1; min-width: 0; padding: 8px 0; font-size: 16px; border: 0; outline: 0; background: none; }
.segmentos { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--realce); }
.segmentos button { padding: 5px 11px; font-size: .84rem; font-weight: 500; white-space: nowrap; border: 0; border-radius: 8px; background: none; color: var(--texto-2); }
.segmentos button[aria-pressed="true"] { color: var(--texto); background: var(--superficie); font-weight: 600; }
.acessos__lista { border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; }
.acessos__vazio { margin: 0; padding: 22px 14px; text-align: center; color: var(--texto-2); font-size: .9rem; }
.medico { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--borda); }
.medico:first-child { border-top: 0; }
.medico__info { flex: 1; min-width: 0; }
.medico__nome { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .92rem; font-weight: 500; }
.medico__sub { font-size: .78rem; color: var(--texto-2); }
.selo { padding: 1px 7px; font-size: .7rem; font-weight: 700; border-radius: 999px; color: var(--acento); background: var(--acento-suave); }
.selo--neutro { color: var(--texto-2); background: var(--realce); }
.chave { flex: none; position: relative; width: 40px; height: 24px; padding: 0; border: 0; border-radius: 999px; background: var(--realce); box-shadow: inset 0 0 0 1px var(--borda); transition: background .15s; }
.chave::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: transform .15s; }
.chave[aria-checked="true"] { background: var(--acento); box-shadow: none; }
.chave[aria-checked="true"]::after { transform: translateX(16px); }
.chave:disabled { opacity: .6; cursor: progress; }

/* ---------- Celular ---------- */
.veu { display: none; }
@media (max-width: 800px) {
  .lateral { position: fixed; inset: 0 auto 0 0; z-index: 20; width: min(290px, 84vw); transform: translateX(-100%); transition: transform .2s ease; }
  .lateral--aberta { transform: none; box-shadow: var(--sombra); }
  .veu { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(5, 10, 22, .45); }
  #abrirLateral { display: inline-grid; margin-left: -6px; }
  .topo { padding-inline: 12px; }
  .sugestoes { grid-template-columns: 1fr; }
  .msg-usuario { max-width: 90%; }
  .conversa__apagar { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition: none !important; scroll-behavior: auto !important; }
}
