/* Variaveis visuais centrais. Alterar cores e tokens aqui evita procurar
   valores repetidos pelo arquivo inteiro. */
:root {
  --app-bg: #f7f7f6;
  /* navy -> verde, extraidos do fundo.png / logo_PEI_TJRR.png (identidade do PEI-TJRR) */
  --sidebar-bg: #0f2438;
  --sidebar-navy: #12314d;
  --sidebar-border: rgba(255, 255, 255, 0.16);
  --text: #1f2328;
  --muted: #6b7280;
  --input-bg: #ffffff;
  --input-placeholder: #9ca3af;
  --user-bg: #eaeef4;
  --border: rgba(17, 24, 39, 0.08);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);

  /* azul-marinho da identidade PEI-TJRR, usado nos botoes/destaques do chat */
  --accent: #1e4d78;
  --accent-hover: #163c5f;
  --accent-soft: #e8eef5;
  --accent-soft-hover: #d9e3ee;
  --accent-text: #1a4468;
}

/* Reset minimo para previsibilidade entre navegadores sem trazer framework CSS. */
* {
  box-sizing: border-box;
}

/* Regra global: [hidden] sempre esconde, mesmo sobre elementos cujo seletor de
   classe define display:flex/grid/etc. Sem isso, uma regra de autor (qualquer
   especificidade) sempre vence a folha de estilo padrão do navegador — que é quem
   normalmente aplicaria display:none pro atributo hidden — e o elemento fica
   visível mesmo "escondido" via JS (el.hidden = true). */
[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  font-feature-settings: "cv05", "cv11";
}

button,
textarea {
  font: inherit;
}

/* Botao que mostra/oculta a sidebar. Fica sempre no canto superior esquerdo,
   junto da borda da sidebar (visivel ou nao) — como no ChatGPT. */
.sidebar-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, left 0.22s ease;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Layout geral: sidebar fixa em desktop e area principal centralizada. A
   transicao na largura da coluna eh o que anima o colapso da sidebar. */
.app-shell {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}

/* Colapsada, a sidebar nao some por completo: fica uma faixa fina, na mesma
   cor, so pra sinalizar que ela existe e abrigar o botao de expandir. */
.app-shell.sidebar-hidden {
  grid-template-columns: 3.75rem minmax(0, 1fr);
}

/* Sidebar institucional. */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* fundo.png (navy -> verde, mapa de RR) por baixo; um leve escurecimento
     garante contraste do texto branco em qualquer ponto do gradiente. */
  background:
    linear-gradient(180deg, rgba(8, 16, 26, 0.35), rgba(8, 16, 26, 0.55)),
    var(--sidebar-bg) url("assets/fundo.png") center / cover no-repeat;
  color: white;
  /* padding-top generoso: da espaco pro botao de expandir/ocultar (fixo no
     canto superior esquerdo) sem encostar nas logos. */
  padding: 4rem 1.5rem 1.5rem;
  transition: padding 0.22s ease;
}

.app-shell.sidebar-hidden .sidebar {
  padding: 4rem 0 0;
}

.app-shell.sidebar-hidden .sidebar > * {
  opacity: 0;
  pointer-events: none;
}

/* Logos mantem proporcao original e se adaptam a largura disponivel. */
.sidebar-logos {
  display: grid;
  gap: 1.35rem;
  flex: 0 0 auto;
  min-width: 15rem;
}

.sidebar-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* logo_PEI_TJRR.png tem bastante espaco vazio a direita do simbolo (proporcao
   bem larga) — dimensionar pela altura, nao pela largura, evita esticar isso
   e forcar um vao gigante na sidebar. */
.sidebar-logo-pei {
  width: auto;
  max-width: 100%;
  max-height: 6.0rem;
  margin: 0 auto;
}

.sidebar-logo-main {
  max-width: 8.5rem;
  margin: 0 auto;
  padding-top: 0.25rem;
  border-top: 1px solid var(--sidebar-border);
}

.partner-logos {
  display: grid;
  gap: 1.1rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--sidebar-border);
}

.publix-logo {
  max-width: 76%;
  margin: 0 auto;
}

.sidebar-divider {
  height: 1px;
  margin: 2rem 0 1.25rem;
  background: var(--sidebar-border);
  flex: 0 0 auto;
  min-width: 15rem;
}

/* Controle de historico da sessao. */
.sidebar-caption {
  margin: 0 0 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  line-height: 1.5;
  flex: 0 0 auto;
  min-width: 15rem;
}

/* Botão de novo chat — minimalista, alinhado à esquerda (ícone de lápis + texto),
   na mesma linguagem sutil do resto da sidebar (fundo quase invisível, contorno
   fino) em vez de um CTA cheio de cor — combina mais com o tom do app. */
.new-chat-button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  min-width: 15rem;
  min-height: 2.6rem;
  margin-bottom: 0.9rem;
  padding: 0 0.85rem;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.new-chat-button:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
  color: white;
}

.new-chat-button svg {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Lista de chats salvos. Cada linha tem o botão do chat (título truncado) + uma
   lixeira que só aparece no hover/foco da linha (ver .chat-delete-button abaixo). O
   chat aberto no momento fica destacado. */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 15rem;
  max-height: 16rem;
  margin-bottom: 0.6rem;
  overflow-y: auto;
}

.chat-list:empty {
  display: none;
}

.chat-list-row {
  display: flex;
  align-items: center;
  border-radius: 10px;
  transition: background-color 0.15s ease;
}

.chat-list-row:hover,
.chat-list-row:focus-within {
  background: rgba(255, 255, 255, 0.08);
}

.chat-list-item {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.15s ease;
}

.chat-list-row:hover .chat-list-item,
.chat-list-row:focus-within .chat-list-item {
  color: white;
}

.chat-list-row.active .chat-list-item {
  color: white;
  font-weight: 500;
}

/* A lixeira só existe visualmente quando a linha está em hover/foco — o resto do
   tempo fica transparente e sem capturar clique, pra não roubar espaço nem atenção. */
.chat-delete-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  margin-right: 0.35rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.chat-list-row:hover .chat-delete-button,
.chat-list-row:focus-within .chat-delete-button,
.chat-delete-button:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.chat-delete-button:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.chat-delete-button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-list-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-weight: 500;
}

/* Descricao institucional: some junto com o resto da sidebar quando ocultada. */
.sidebar-footnote {
  margin: auto 0 0;
  padding-top: 1.25rem;
  min-width: 15rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* Estados de foco visiveis melhoram acessibilidade via teclado. */
.new-chat-button:focus-visible,
.chat-list-item:focus-visible,
.chat-delete-button:focus-visible,
.send-button:focus-visible,
.sidebar-toggle:focus-visible,
.suggestions-toggle:focus-visible,
.suggestion-card:focus-visible,
.suggestion-cta:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(34, 197, 94, 0.35);
  outline-offset: 2px;
}

/* Conteudo principal limita largura em desktop para manter leitura confortavel. */
.main-content {
  min-width: 0;
  display: flex;
  justify-content: center;
}

.content-inner {
  width: min(820px, calc(100% - 3rem));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 0 1.25rem;
}

h1 {
  margin: 0;
  color: #0f172a;
  font-weight: 600;
}

/* Estado inicial: saudacao grande e centralizada. Some assim que a conversa comeca. */
.hero {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  padding: 2rem 1rem 0.5rem;
  min-height: 22rem;
}

.hero-title {
  max-width: 38rem;
  color: #0f172a;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

.hero-title .accent {
  color: var(--accent-text);
  font-weight: 700;
}

.hero-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  font-weight: 400;
}

.content-inner.chat-active .hero {
  display: none;
}

/* Lista de mensagens. O JS injeta artigos .message dentro desta area. */
.messages {
  flex: 1 1 auto;
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 1rem;
}

.content-inner.chat-active .messages {
  display: flex;
}

/* Mensagem do usuario: apenas o balao, alinhado a direita. Sem avatar. */
.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.user .bubble {
  width: fit-content;
  max-width: 100%;
  padding: 0.7rem 1.1rem;
  border-radius: 18px;
  background: var(--user-bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Resposta do assistente: SEM balao — o texto corre livremente na coluna,
   apenas com a margem lateral que a propria .content-inner ja garante. */
.message.assistant {
  width: 100%;
}

.message.assistant .bubble {
  overflow-wrap: anywhere;
}

.message.assistant .bubble > :first-child {
  margin-top: 0;
}

.message.assistant .bubble > :last-child {
  margin-bottom: 0;
}

/* Ações da resposta (hoje só copiar) — discretas, abaixo do texto. */
.message-actions {
  display: flex;
  margin-top: 0.4rem;
}

.copy-button {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.copy-button:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

.copy-button.copied {
  color: #16a34a;
}

.copy-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message.assistant .bubble p {
  margin: 0 0 0.75rem;
}

.message.assistant .bubble h3,
.message.assistant .bubble h4,
.message.assistant .bubble h5 {
  margin: 0.85rem 0 0.45rem;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.message.assistant .bubble ul,
.message.assistant .bubble ol {
  margin: 0.45rem 0 0.75rem;
  padding-left: 1.35rem;
}

.message.assistant .bubble li + li {
  margin-top: 0.25rem;
}

.message.assistant .bubble code {
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.08);
  padding: 0.12rem 0.28rem;
  color: #0f172a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message.assistant .bubble pre {
  overflow-x: auto;
  margin: 0.6rem 0 0.75rem;
  border-radius: 8px;
  background: #111827;
  padding: 0.85rem;
}

.message.assistant .bubble pre code {
  display: block;
  background: transparent;
  color: #f9fafb;
  padding: 0;
  white-space: pre;
}

.message.assistant .bubble a {
  color: var(--accent-text);
  font-weight: 600;
}

/* Estado temporario exibido enquanto a API processa a pergunta. */
.message.loading .bubble {
  color: #4b5563;
}

.loading-dots::after {
  content: "";
  display: inline-block;
  width: 1.4rem;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: "";
  }

  40% {
    content: ".";
  }

  60% {
    content: "..";
  }

  80%,
  100% {
    content: "...";
  }
}

/* Painel de progresso exibido enquanto o agente_busca chama a rag_tool — mostra a
   query da vez e um resumo do trecho recuperado, sempre em tom mais apagado que o
   texto normal (é andamento, não a resposta). Cada chamada nova substitui o
   conteúdo da chamada anterior (ver app.js, evento "tool_call"). */
.pensando-detalhe {
  margin-top: 0.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
  animation: pensando-detalhe-entrada 0.15s ease;
}

.pensando-detalhe:empty {
  display: none;
}

@keyframes pensando-detalhe-entrada {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.pensando-query {
  color: #6b7280;
  font-size: 0.82rem;
  line-height: 1.4;
}

.pensando-query .pensando-meta {
  color: #9ca3af;
}

.pensando-trecho {
  margin-top: 0.3rem;
  overflow: hidden;
  color: #9ca3af;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Flashcards de sugestao — no estado inicial ficam no fluxo normal, acima do
   input. Depois que a conversa comeca, viram um cartao flutuante ancorado ao
   composer (ver .composer-dock): fica por cima das mensagens, acompanha o
   scroll (o dock e sticky) e some sem empurrar o layout. */
.suggestions-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 0 0 auto;
  padding-bottom: 0.25rem;
}

.content-inner.chat-active .suggestions-panel {
  display: none;
}

.content-inner.chat-active.suggestions-expanded .suggestions-panel {
  display: flex;
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  left: 0;
  z-index: 6;
  max-height: min(60vh, 26rem);
  margin: 0;
  padding: 1.1rem 1.1rem 1.2rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px -14px rgba(15, 23, 42, 0.24), 0 4px 14px -4px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: painel-flutuante-entrada 0.16s ease;
}

@keyframes painel-flutuante-entrada {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.suggestions-column {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.suggestions-heading {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.suggestion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2.6rem;
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.035);
  color: var(--text);
  font-size: 0.83rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.suggestion-card:hover {
  background: var(--accent-soft);
}

.suggestion-card svg {
  flex: 0 0 auto;
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.suggestion-cta {
  min-height: 2.75rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.suggestion-cta:hover {
  background: var(--accent-soft-hover);
}

/* Pill discreto que substitui o painel de sugestoes depois que a conversa comeca. */
.suggestions-toggle {
  display: none;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  margin-bottom: 0.25rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.content-inner.chat-active .suggestions-toggle {
  display: inline-flex;
}

.suggestions-toggle:hover {
  background: var(--accent-soft);
}

.suggestions-toggle svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* Dock do composer: fixo no rodape da area principal (sticky) e serve de
   ancora de posicionamento para o painel de sugestoes flutuante, que e
   absoluto em relacao a este elemento — por isso acompanha o dock ao rolar a
   pagina, sempre colado logo acima do campo de mensagem. */
.composer-dock {
  position: sticky;
  bottom: 0;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.input-shell {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: 0;
  background: linear-gradient(
    180deg,
    rgba(242, 242, 242, 0),
    var(--app-bg) 38%,
    var(--app-bg)
  );
}

/* Campo de texto expansivel e botao de envio — pilula minimalista, como o
   composer do ChatGPT: quase sem sombra, so um contorno bem sutil. */
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.5rem 0.4rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--input-bg);
  box-shadow: var(--shadow);
}

textarea {
  width: 100%;
  min-height: 2.5rem;
  max-height: 9rem;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  caret-color: var(--text);
  padding: 0.6rem 0.25rem;
}

textarea::placeholder {
  color: var(--input-placeholder);
  opacity: 1;
}

textarea:focus {
  outline: 0;
}

.send-button {
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 2.35rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.send-button:hover {
  background: var(--accent-hover);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.send-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Botão de gravação por voz — mesma pílula do send-button, mas neutro (o azul de
   destaque fica só pro botão de envio). Só um dos dois é visível por vez (ver
   [hidden] no HTML e atualizarBotaoComposer em app.js). */
.mic-button {
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 2.35rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mic-button:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

.mic-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mic-button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Tela de escuta em tela cheia — reaproveita o mesmo tratamento visual da sidebar
   (fundo.png + gradiente navy, ver .sidebar) pra ficar da mesma família visual do
   resto do site, em vez de um dark-mode genérico tipo ChatGPT. */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(8, 16, 26, 0.55), rgba(8, 16, 26, 0.85)),
    var(--sidebar-bg) url("assets/fundo.png") center / cover no-repeat;
}

/* Selo com o próprio símbolo do TJRR ao centro (mesmo ícone da sidebar/favicon) em
   vez de uma esfera genérica — reforça que é o assistente do tribunal, não um "orbe
   de IA" qualquer. Os anéis concêntricos (.voice-ring) dão o movimento contínuo tipo
   sonar, sempre em CSS puro — o selo em si só soma a reação ao volume por cima. */
.voice-orb-wrap {
  position: relative;
  width: 11rem;
  height: 11rem;
  display: grid;
  place-items: center;
}

.voice-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(232, 238, 245, 0.5);
  animation: voice-ring-expandir 2.6s ease-out infinite;
}

.voice-ring--2 {
  animation-delay: 1.3s;
}

@keyframes voice-ring-expandir {
  0% {
    transform: scale(0.68);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* app.js escreve --nivel (0 a 1) a cada frame, já suavizado (lerp) lá mesmo — por
   isso não tem transition aqui: duas fontes de suavização (CSS + JS) brigando entre
   si deixa o movimento mais preguiçoso, não mais fluido. */
.voice-orb {
  --nivel: 0;
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  background:
    url("assets/icon_tjrr_branco.png") center / 44% no-repeat,
    radial-gradient(circle at 35% 30%, var(--accent-hover), var(--accent) 60%, var(--sidebar-navy) 100%);
  box-shadow: 0 0 calc(1.6rem + 5rem * var(--nivel)) calc(0.3rem + 1.6rem * var(--nivel))
    rgba(232, 238, 245, calc(0.3 + 0.35 * var(--nivel)));
  transform: scale(calc(1 + 0.18 * var(--nivel)));
  animation: voice-orb-respirar 3.2s ease-in-out infinite;
}

@keyframes voice-orb-respirar {
  0%, 100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.08);
  }
}

/* Enquanto aguarda a transcrição (áudio já parou de gravar): pulso suave e
   indeterminado, não reage mais ao microfone (que já foi liberado nesse ponto). */
.voice-orb.processing {
  animation: voice-orb-processando 1.3s ease-in-out infinite;
  box-shadow: 0 0 4rem 1rem rgba(232, 238, 245, 0.4);
}

@keyframes voice-orb-processando {
  0%, 100% {
    transform: scale(0.94);
  }

  50% {
    transform: scale(1.08);
  }
}

/* Legenda de progresso do overlay de voz — mesma função do .pensando-detalhe do
   chat (mostra a query/trecho recuperado via rag_tool, ver exibirToolCall/
   exibirToolResult em app.js, reaproveitadas com este elemento no lugar da bolha),
   só que em tom claro sobre o fundo navy em vez de cinza sobre fundo branco. */
.voice-caption {
  position: absolute;
  bottom: 9rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(28rem, calc(100% - 3rem));
  text-align: center;
}

.voice-caption:empty {
  display: none;
}

.voice-caption .pensando-query {
  color: rgba(255, 255, 255, 0.78);
}

.voice-caption .pensando-query .pensando-meta {
  color: rgba(255, 255, 255, 0.5);
}

.voice-caption .pensando-trecho {
  color: rgba(255, 255, 255, 0.55);
  -webkit-line-clamp: 2;
}

.voice-overlay-close {
  position: absolute;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--sidebar-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.voice-overlay-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.voice-overlay-close svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Adaptacao mobile: sidebar deixa de ser fixa, flashcards empilham em 1 coluna. */
@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-hidden {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 1rem;
  }

  .app-shell.sidebar-hidden .sidebar {
    display: none;
  }

  .sidebar-logos {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    min-width: 0;
  }

  .sidebar-divider,
  .sidebar-caption,
  .new-chat-button,
  .chat-list,
  .sidebar-footnote {
    min-width: 0;
  }

  .partner-logos {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 1rem;
  }

  .sidebar-logo-main {
    max-width: 8.5rem;
    margin: 0 auto;
  }

  .publix-logo {
    max-width: 100%;
  }

  .content-inner {
    width: calc(100% - 2rem);
    padding-top: 3rem;
  }

  .suggestions-grid {
    grid-template-columns: 1fr;
  }

}
