/* LawX Juris — tela operacional de pesquisa.
 *
 * Uma camada só. A folha anterior tinha duas: a base e um bloco de override a partir da linha 762
 * que redeclarava `body`, `.site-header`, o hero e o composer inteiros. Para mudar a altura do
 * cabeçalho era preciso descobrir qual das duas declarações vencia, e a resposta dependia da ordem
 * do arquivo — que é a pior fonte de verdade possível.
 *
 * Ordem: tokens, base, cabeçalho, pesquisa, filtros, resultados, cobertura, rodapé, responsivo.
 */

:root {
  /* Claro e sóbrio: a tela é de leitura longa — enunciados, teses, ementas —, e texto escuro sobre
     fundo claro é o que se lê por mais tempo sem cansar. Os nomes dizem o papel, e não a cor: o
     tema anterior chamava o texto forte de `--white`, e trocar de tema exigia reler cada regra. */
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-sunk: #f2f3f1;
  --ink: #16202b;
  --text: #2a3440;
  --text-2: #3c4752;
  --muted: #56616d;
  --subtle: #66707b;
  /* Só para marcas que não são texto (pontos, a barra da parcela não apurada): 3,5:1, acima dos
     3:1 de elemento gráfico e abaixo dos 4,5:1 de texto. Texto claro usa `--subtle`. */
  --faint: #7a838d;
  --accent: #1f4fbf;
  --accent-ink: #1a3f99;
  --accent-soft: color-mix(in srgb, var(--accent) 8%, transparent);
  --on-accent: #ffffff;
  --ok: #17704a;
  --warn: #8f5300;
  --danger: #b3261e;
  --line: #e2e4e1;
  --line-strong: #c8cdd2;
  --shadow: 0 1px 2px rgb(22 32 43 / 6%), 0 8px 24px rgb(22 32 43 / 6%);
  --shadow-pop: 0 18px 40px rgb(22 32 43 / 14%);
  --shadow-side: -12px 0 40px rgb(22 32 43 / 12%);
  --backdrop: rgb(22 32 43 / 32%);
  --header-bg: rgb(247 247 244 / 92%);

  /* Etiquetas em caixa alta, em dois tamanhos e não em dez. Caixa alta pede entreletra: sem ela as
     maiúsculas se colam. */
  --label-size: .72rem;
  --label-tracking: .06em;
  --label-size-sm: .68rem;
  --label-tracking-sm: .09em;
  /* A sobrescrita — `STF · STJ · TST`, `Resposta normativa`. Ela é curta e fica sozinha sobre um
     título, e por isso pede entreletra maior que a etiqueta comum: sem ela as três siglas se leem
     como uma palavra só. Entra na escala em vez de ser um valor solto na regra, que é a diferença
     entre uma variação decidida e a próxima etiqueta nascendo com `.13em` porque alguém achou. */
  --label-tracking-wide: .1em;
  --label-weight: 700;

  /* Largura de leitura. Um valor, usado pelo cabeçalho e pelo conteúdo, para as duas colunas
     alinharem sem cada bloco escolher a sua. */
  --page: 1080px;
  --gutter: max(20px, calc((100vw - var(--page)) / 2));

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { font-size: 106.25%; }

body {
  min-width: 320px;
  margin: 0;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { border: 0; }

::selection { color: var(--ink); background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* O atributo `hidden` vence qualquer `display` declarado depois dele.
   O padrão do navegador é `[hidden] { display: none }` na folha do agente, e **qualquer** regra de
   autor com `display` a sobrepõe — inclusive `display: grid`. O efeito: "O que eu entendi" e
   "Resposta" nascem com `hidden` no HTML e apareciam vazias na primeira carga da tela, dois painéis
   em branco acima do campo de pesquisa.
   `!important` aqui é o uso legítimo dele: a regra não é uma preferência de estilo, é a semântica do
   atributo. Sem ele, todo componente novo que use `hidden` precisa lembrar de não declarar
   `display` — e um deles vai esquecer. */
[hidden] { display: none !important; }

button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Rótulo que o leitor de tela anuncia e a tela não mostra — o campo de pesquisa tem placeholder,
   mas placeholder não é rótulo. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Cabeçalho ────────────────────────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}
.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}
.brand-word {
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 9px;
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: 0;
}
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong {
  color: var(--ink);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.brand-copy small { color: var(--subtle); font-size: .57rem; }

.header-action, .ghost-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-2);
  background: var(--surface);
  font-size: .73rem;
  font-weight: 700;
}
.workspace-heading {
  max-width: 760px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-ink);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-wide);
  text-transform: uppercase;
}
.search-composer {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.submit-hint {
  color: var(--subtle);
  font-size: .68rem;
}
.has-searched .examples { display: none; }
.has-searched .search-composer { margin-bottom: 10px; }
.header-action:hover, .ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

/* ── Pesquisa ─────────────────────────────────────────────────────────────────────────────────── */

.workspace {
  width: min(var(--page), calc(100% - 40px));
  padding: 40px 0 64px;
  margin: 0 auto;
}
.workspace h1, .workspace-title {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.25;
}

.query-row {
  display: grid;
  position: relative;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.query-row:focus-within {
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
.query-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 9px 11px;
  border-top: 1px solid var(--line);
}

/* ── Portão de acesso ─────────────────────────────────────────────────────────────────────────── */

.gate-workspace {
  display: grid;
  place-items: center;
  /* Menos a altura do cabeçalho: centra na área útil, e não na página inteira — centrar na página
     empurra o cartão para baixo do dobro da barra. */
  min-height: calc(100vh - 120px);
}
.gate-card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}
.gate-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.gate-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
.gate-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.gate-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  font-size: .9rem;
}
.gate-row input:focus {
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
.gate-row .search-button { min-width: 96px; }
.gate-show {
  margin-top: 10px;
  padding: 4px 0;
  border: 0;
  color: var(--accent-ink);
  background: none;
  font-family: inherit;
  font-size: .74rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.gate-show:hover { color: var(--ink); }
.gate-show:focus-visible {
  border-radius: 6px;
  outline: 2px solid color-mix(in srgb, var(--accent) 58%, transparent);
  outline-offset: 3px;
}
.gate-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: .8rem;
  line-height: 1.45;
}
.gate-note {
  margin: 16px 0 0;
  color: var(--subtle);
  font-size: .72rem;
  line-height: 1.5;
}

/* ── Sugestão enquanto digita ──────────────────────────────────────────────────────────────────── */

.suggest,
.action-type-suggest {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 296px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.suggest-item {
  display: grid;
  gap: 3px;
  align-items: start;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.suggest-item:last-child { border-bottom: none; }
/* `is-active` é o realce das setas, e `:hover` o do mouse. Os dois pintam igual de propósito: a
   pessoa que alterna entre teclado e mouse não deve ver dois vocabulários de destaque. */
.suggest-item.is-active,
.suggest-item:hover { background: var(--accent-soft); }
.suggest-name {
  color: var(--ink);
  font-size: .87rem;
  line-height: 1.35;
}
.suggest-meta {
  color: var(--subtle);
  font-size: .7rem;
  white-space: normal;
}
.suggest-status {
  margin: 8px 0 0;
  color: var(--warn);
  font-size: .75rem;
  line-height: 1.45;
}
textarea {
  width: 100%;
  min-height: 104px;
  max-height: 190px;
  padding: 17px 18px 14px;
  overflow: hidden;
  border: 0;
  border-radius: 11px 11px 0 0;
  color: var(--ink);
  background: transparent;
  font-size: .95rem;
  line-height: 1.5;
  resize: none;
}
textarea::placeholder { color: var(--subtle); }
textarea:focus {
  outline: none;
}
.search-button {
  flex: 0 0 auto;
  min-width: 128px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  color: var(--on-accent);
  background: var(--accent);
  font-size: .82rem;
  font-weight: 800;
}
.search-button:hover { background: var(--accent-ink); }
.search-button:disabled { cursor: wait; filter: grayscale(.5); opacity: .6; }

/* ── Tipo de Ação e exemplos ─────────────────────────────────────────────────────────────────── */

.filters-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: 999px;
  color: var(--on-accent);
  background: var(--accent);
  font-size: .66rem;
  letter-spacing: 0;
}
.filters.has-active-filters { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.action-type-combobox { position: relative; }
.action-type-suggest { z-index: 40; }

.examples { margin-top: 18px; }
.examples-title {
  margin: 0 0 9px;
  color: var(--subtle);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.example-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.example-card {
  display: grid;
  gap: 4px;
  align-content: center;
  min-width: 0;
  min-height: 68px;
  padding: 11px 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}
.example-card strong {
  overflow-wrap: anywhere;
  font-size: .82rem;
  line-height: 1.35;
}
.example-card small {
  color: var(--subtle);
  font-size: .7rem;
  line-height: 1.3;
}
.example-card:hover,
.example-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--accent-soft);
}
.example-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Filtros ──────────────────────────────────────────────────────────────────────────────────── */

.filters {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.search-output {
  scroll-margin-top: 82px;
  padding-top: 28px;
}
.output-header {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}
.output-header .eyebrow { margin-bottom: 5px; }
.output-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
}
.search-loading {
  display: grid;
  gap: 11px;
}
.search-loading span {
  display: block;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent) 7%, transparent) 48%, transparent 66%),
    var(--surface);
  background-size: 240% 100%;
  animation: loading-sweep 1.25s ease-in-out infinite;
}
.feedback.searching { color: var(--accent-ink); }
@keyframes loading-sweep {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .search-loading span { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* O resumo **é** o botão: abrir e fechar são do navegador, e não de um `click` que pode não chegar
   a ser ligado. O `+` vira `−`, o mesmo sinal dos cartões de área — um vocabulário, não dois. */
.filters-summary {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  color: var(--text-2);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.filters-summary::-webkit-details-marker { display: none; }
.filters-summary::after {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--accent);
  content: "+";
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}
.filters[open] .filters-summary { color: var(--ink); }
.filters[open] .filters-summary::after { content: "−"; }
.filters > :not(summary) { padding-inline: 18px; }
.filters > :last-child { padding-bottom: 16px; }
.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  align-items: start;
}
.field { min-width: 0; margin: 0; border: 0; }
.field label, .field legend {
  display: block;
  padding: 0;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.field input, .field select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-sunk);
  font-size: .78rem;
}
.field select:disabled { cursor: not-allowed; opacity: .55; }
.field input:hover, .field select:hover { border-color: var(--line-strong); }

.courts { display: flex; gap: 7px; }
.chip-check {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-sunk);
  cursor: pointer;
}
.chip-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.chip-check span { color: var(--text-2); font-size: .75rem; font-weight: 700; }
.chip-check.selected { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.chip-check.selected span { color: var(--accent); }

.switch {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 0 0;
  margin-top: 15px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.switch input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.switch span { display: grid; gap: 2px; }
.switch strong { color: var(--text); font-size: .77rem; }
.switch small { color: var(--subtle); font-size: .68rem; line-height: 1.5; }

.filters-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}

.applied {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}
.applied-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: .71rem;
  font-weight: 700;
}
.applied-chip:hover { border-color: color-mix(in srgb, var(--accent) 66%, transparent); }
.applied-chip span { color: var(--accent-ink); font-size: .85rem; line-height: 1; }

.feedback { min-height: 0; margin: 12px 0 0; font-size: .74rem; }
.feedback.error { color: var(--danger); }
.feedback:empty { margin: 0; }

/* ── Resultados ───────────────────────────────────────────────────────────────────────────────── */

.results {
  display: grid;
  gap: 11px;
  margin-top: 18px;
}
.results:focus { outline: none; }
.results:empty { margin-top: 0; }
.result-notice, .empty {
  padding: 18px 20px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: .78rem;
  line-height: 1.6;
}
.result-notice { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.empty { display: grid; gap: 11px; justify-items: start; }
.empty strong { color: var(--ink); font-size: .84rem; }

/* ── O que eu entendi · resposta objetiva ─────────────────────────────────────────────────────
   Vêm antes dos precedentes porque é nessa ordem que se lê. O contorno tracejado nos chips diz
   "isto é uma leitura, não um dado": chip sólido tem o mesmo peso visual de filtro aplicado, e o
   usuário passaria a tratar a inferência como escolha dele. */
.reading { display: grid; gap: 9px; margin: 0 0 4px; }
.reading-title {
  margin: 0;
  color: var(--subtle);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.reading-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.reading-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: .71rem;
  font-weight: 700;
}
.reading-chip-editable { cursor: pointer; }
.reading-chip-editable:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.reading-chip-editable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.verdict {
  display: grid;
  gap: 8px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
}
/* A cor da borda diz o desfecho antes da leitura. Só três valores: responder, perguntar e não ter.
   Um por estado faria seis cores que ninguém aprende. */
.verdict[data-state="needs_context"] { border-left-color: var(--warn); }
.verdict[data-state="divergence"] { border-left-color: var(--warn); }
.verdict[data-state="collection_not_covered"],
.verdict[data-state="no_support_found"],
.verdict[data-state="out_of_scope"] { border-left-color: var(--subtle); }
.verdict-headline { margin: 0; color: var(--ink); font-size: .92rem; font-weight: 700; }
/* Busca só por palavra: a manchete ganha um selo, e o selo fica na manchete e não numa faixa
   separada. Faixa própria some do campo de visão de quem já está lendo o resultado; aqui ela é a
   primeira coisa que se lê depois do estado. */
.verdict[data-state][data-lexical="sim"] .verdict-headline::after {
  content: " · sem busca semântica";
  color: var(--warn);
  font-size: .74rem;
  font-weight: 600;
}
.verdict-reason { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.verdict-choices { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.verdict-question { margin: 0; width: 100%; color: var(--ink); font-size: .82rem; }

.results-count {
  margin: 0;
  color: var(--subtle);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}

/* Ocupa a linha inteira: é a continuação da lista, e não uma ação secundária ao lado dela. */
.load-more {
  justify-self: stretch;
  min-height: 42px;
  text-align: center;
}

.result-card {
  position: relative;
  padding: 18px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.result-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--faint);
  content: "";
}
.result-card.normative-result::before { background: var(--ok); }
.result-card.void-result::before { background: var(--danger); }
.result-card:hover { border-color: var(--line-strong); }

/* Linha 1: tribunal, espécie, vigência e força. */
.result-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.tag {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.tag.court { border-color: color-mix(in srgb, var(--accent) 34%, transparent); color: var(--accent-ink); }
.tag.ok { border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.tag.warn { border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.tag.void { border-color: color-mix(in srgb, var(--danger) 32%, transparent); color: var(--danger); }
.tag.force { border-color: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--accent); }

/* Linha 2: a identificação citável, do jeito que vai à petição. */
.result-title {
  margin: 9px 0 0;
  color: var(--ink);
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* Trecho essencial em quatro linhas. A ementa integral, que chegava a 1.300 caracteres na frente do
   usuário, passou para "Ver detalhes": ninguém decide relevância lendo dez parágrafos. */
/* Rótulo do texto: diz se o que vem abaixo é enunciado, tese ou ementa. */
.result-excerpt-label {
  display: block;
  margin: 10px 0 4px;
  color: var(--accent-ink);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
/* Sem recorte: o enunciado de uma súmula tem 140 a 620 caracteres e cabe na tela. Cortar em quatro
   linhas economizava espaço às custas do conteúdo, que é a única coisa que o advogado veio buscar —
   e no Tema 709 o corte caía na questão submetida, escondendo a tese. */
.result-excerpt {
  margin: 0;
  color: var(--text);
  font-size: .81rem;
  line-height: 1.7;
}
/* A redação da data não existe no acervo: a falta é dita no lugar do texto, e não preenchida com o
   de hoje. Borda em vez de cor só, para não depender dela. */
.result-excerpt-missing {
  padding: 8px 10px;
  border-left: 3px solid var(--warn);
  color: var(--muted);
  font-style: italic;
}
.result-excerpt mark {
  padding: 0 2px;
  border-radius: 3px;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}
/* Quem julgou e quando, antes do texto. */
.result-meta {
  margin: 6px 0 0;
  color: var(--subtle);
  font-size: .71rem;
  line-height: 1.5;
}
.result-reason {
  margin: 9px 0 0;
  color: var(--subtle);
  font-size: .69rem;
}

.result-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  padding-top: 13px;
  margin-top: 13px;
  border-top: 1px solid var(--line);
}
.result-details { min-width: 0; }
/* O mesmo `+` dos cartões de área e do painel de filtros. Três coisas que expandem na tela, e um
   sinal só para as três: quem aprende num lugar já sabe nos outros. */
.result-details summary {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.result-details summary::-webkit-details-marker { display: none; }
.result-details summary::before {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--accent);
  content: "+";
  font-size: .85rem;
  line-height: 1;
}
.result-details[open] summary::before { content: "−"; }
.result-details summary:hover { color: var(--accent); }
.result-details[open] summary { margin-bottom: 12px; }
.result-facts {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
}
.result-facts dt {
  color: var(--subtle);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.result-facts dd { margin: 0; color: var(--text); font-size: .74rem; line-height: 1.5; }
.result-headnote-label {
  display: block;
  margin-top: 14px;
  color: var(--accent-ink);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.result-headnote-full {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: .76rem;
  line-height: 1.72;
}
.source-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 9px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  font-size: .73rem;
  font-weight: 700;
  text-decoration: none;
}
.source-link:hover { border-color: color-mix(in srgb, var(--accent) 52%, transparent); }

/* ── Atualizações e histórico ─────────────────────────────────────────────────────────────────
   Dois diálogos do mesmo molde (`.sheet`): mais largos que o da cobertura porque mostram listas e
   textos lado a lado, e de tela inteira no telefone — um diálogo de 430px com rolagem dentro de
   rolagem é ilegível em 360px. */

.sheet {
  width: min(900px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0 22px 22px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
}
.sheet::backdrop { background: var(--backdrop); }
.sheet-head {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.sheet-head h2 { margin: 0; color: var(--ink); font-size: 1rem; line-height: 1.35; }
.sheet-head h2:focus { outline: none; }
.sheet-head h2:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet-head .eyebrow { margin-bottom: 4px; }
.sheet-section { margin-top: 20px; }
.sheet-subtitle { margin: 0 0 8px; color: var(--ink); font-size: .88rem; font-weight: 800; }
.sheet-hint { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }

.tag.muted { border-color: var(--line-strong); color: var(--text-2); }

.sources-body { display: grid; gap: 14px; margin-top: 12px; }
.source-court h4 {
  margin: 0 0 8px;
  color: var(--accent-ink);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.source-list, .source-notes, .history-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.source-row, .history-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.source-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.source-name { color: var(--ink); font-size: .8rem; }
.source-code { color: var(--muted); font-size: .7rem; font-family: ui-monospace, monospace; }
.source-verified { margin: 6px 0 0; color: var(--text); font-size: .76rem; }
.source-attempt { margin: 4px 0 0; color: var(--warn); font-size: .74rem; }
.source-mode { margin: 3px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.source-sweep-old { color: var(--warn); }
.source-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 14px;
  margin: 10px 0 0;
}
.source-facts dt { color: var(--muted); font-size: .72rem; font-weight: 700; }
.source-facts dd { margin: 0; color: var(--text-2); font-size: .74rem; line-height: 1.5; }
.source-notes { gap: 4px; margin-top: 8px; color: var(--text-2); font-size: .72rem; line-height: 1.5; }
.source-notes li::before { content: "• "; color: var(--muted); }
.source-note-warn { color: var(--warn); }

/* Dois filtros só: tribunal e período. O resto do recorte (coleção, tipo, trocas de fonte) é
   conferência da operação e fica em "Informações do acervo". */
.changes-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 12px;
  align-items: end;
}
.changes-period { padding: 0; }
.changes-period-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.changes-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.changes-actions .search-button { min-height: 40px; }
.changes-list { display: grid; gap: 10px; margin-top: 12px; }
.changes-list:empty { margin-top: 0; }
.sources-body > .ghost-button, .changes-list > .ghost-button { justify-self: start; }
.change-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.change-title { margin: 8px 0 4px; color: var(--ink); font-size: .86rem; line-height: 1.4; }
.change-update-title { margin: 4px 0; color: var(--ink); font-size: .84rem; font-weight: 700; line-height: 1.4; }
.change-values { margin: 0 0 2px; color: var(--text); font-size: .82rem; font-variant-numeric: tabular-nums; }
.change-meta { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.change-note { margin-top: 4px; color: var(--subtle); font-style: italic; }
.change-day {
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.change-day:first-child { margin-top: 0; }
.change-diff {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.change-side {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-sunk);
}
.change-side-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.change-text {
  margin: 0;
  color: var(--text);
  font-size: .76rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.change-empty { color: var(--muted); font-style: italic; }
/* Cor **e** traço: riscado e sublinhado dizem o que saiu e o que entrou para quem não distingue o
   vermelho do verde. */
.diff-del { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); text-decoration: line-through; }
.diff-ins { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); text-decoration: underline; }
.change-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
}
.history-button { min-height: 34px; }
/* Sem endereço oficial conferido não há botão de conferência, e o lugar dele diz isso em texto
   discreto (`semEnderecoOficial`), sem link nenhum. */
.no-official-url { font-size: .72rem; line-height: 1.4; }
.data-table .source-link { min-height: 28px; padding: 0 8px; font-size: .72rem; white-space: nowrap; }

.history-heading { margin: 16px 0 0; }
.history-source { margin: 0 0 6px; }
.history-current { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 14px; }
.history-standing { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.history-standing strong { color: var(--text); font-size: .76rem; }
.history-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 16px; }
.history-form .field { min-width: 200px; }
.history-form .search-button { min-height: 40px; }
.history-at-date { display: grid; gap: 8px; margin-top: 14px; }
.history-at-date .result-excerpt { margin: 0; }
/* Editar e conferir: só dentro da Plataforma, para quem tem a edição concedida. */
.history-edicao { display: grid; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.history-edicao-acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.history-edicao-acoes a, .voltar-plataforma { text-decoration: none; }
.history-muted { margin: 0; color: var(--muted); font-size: .74rem; font-style: italic; }
.history-section { margin-top: 20px; }
.history-item-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; color: var(--text); font-size: .76rem; }
.history-item-detail { margin: 4px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.history-item .result-details { margin-top: 6px; }

@media (max-width: 860px) {
  .changes-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .changes-actions { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .header-action { padding: 8px 9px; white-space: nowrap; }
  .sheet {
    width: 100%;
    max-height: 100%;
    height: 100%;
    margin: 0;
    padding: 0 14px 18px;
    border: 0;
    border-radius: 0;
  }
  .changes-filters { grid-template-columns: 1fr; }
  .changes-actions { flex-direction: column-reverse; }
  .changes-actions button, .history-form .search-button, .history-form .field { width: 100%; min-height: 44px; }
  .change-diff { grid-template-columns: 1fr; }
  .source-facts { grid-template-columns: 1fr; gap: 2px; }
  .source-facts dd { margin-bottom: 6px; }
  .change-foot { align-items: stretch; flex-direction: column; }
  .history-button { min-height: 44px; }
}

/* Dois botões no cabeçalho não cabem ao lado do nome em 360px: empilhados, estouravam a barra.
   O nome sai e a marca fica — o link continua anunciado pelo `aria-label`. */
@media (max-width: 440px) {
  .brand-copy { display: none; }
  .site-header { gap: 10px; }
  .header-action { padding: 7px 8px; font-size: .68rem; }
}

/* ── Escopo da pesquisa · tribunal e data jurídica ───────────────────────────────────────────────
   À vista, ao lado da pergunta: são as duas escolhas que mudam o que a resposta significa. */

.search-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  margin-top: 16px;
}
.scope-group { display: grid; gap: 6px; min-width: 0; padding: 0; margin: 0; border: 0; }
.scope-group legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.scope-hint, .field-hint { color: var(--subtle); font-size: .74rem; line-height: 1.45; }
.field-hint { display: block; margin-top: 6px; }
.as-of-options { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.as-of-options input[type="date"] {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface);
  font-size: .82rem;
}

/* Contexto e refinamento lado a lado e recolhidos: duas linhas finas, e não dois formulários. */
.more-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
  margin-top: 16px;
}
.more-options .filters { margin-top: 0; }
.filters[open] { grid-column: 1 / -1; }
.summary-note {
  color: var(--subtle);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.context-panel .field { padding-bottom: 16px; }

/* O selo de verificação: frase em caixa de sentença com um marcador. A cor só reforça. */
.check-label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 600;
}
.check-label::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}
.check-label.ok::before { background: var(--ok); }
.check-label.warn::before { background: var(--warn); }
/* ── Limites da resposta ──────────────────────────────────────────────────────────────────────── */

.limits {
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-sunk);
}
.limits-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.limits-list {
  display: grid;
  gap: 5px;
  padding-left: 18px;
  margin: 0;
  color: var(--text-2);
  font-size: .82rem;
  line-height: 1.55;
}

/* ── Painel lateral ───────────────────────────────────────────────────────────────────────────────
   Detalhe e Atualizações abrem à direita, na altura toda: a lista de resultados continua visível à
   esquerda e, ao fechar, o leitor está no mesmo cartão em que estava. */
.sheet-side {
  width: min(600px, 100%);
  height: 100%;
  max-height: none;
  margin: 0 0 0 auto;
  border-width: 0 0 0 1px;
  border-radius: 0;
  box-shadow: var(--shadow-side);
}
.sheet-side.sheet-wide { width: min(860px, 100%); }

@media (max-width: 860px) {
  .more-options { grid-template-columns: 1fr; }
}

/* ── Navegação e vistas ───────────────────────────────────────────────────────────────────────── */

.site-nav { display: flex; gap: 4px; margin-right: auto; margin-left: 24px; }
.site-nav-link {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
}
.site-nav-link:hover { color: var(--ink); background: var(--surface-sunk); }
.site-nav-link[aria-current="page"] { color: var(--ink); background: var(--surface-sunk); }

/* ── Sobre o acervo ───────────────────────────────────────────────────────────────────────────────
   Texto, tribunais e coleções, sem números. Uma coluna em qualquer largura: nomes longos quebram
   em vez de empurrar a página para o lado. */
.sobre { max-width: 760px; }
.sobre-texto { margin: 12px 0 0; color: var(--text); font-size: .92rem; line-height: 1.6; }
.sobre-secao { margin-top: 22px; }
.sobre-tribunais, .conferencia-lista, .sobre-colecoes { padding: 0; margin: 0; list-style: none; }
.sobre-tribunais { display: grid; gap: 12px; margin-top: 10px; }
.sobre-tribunal {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.sobre-tribunal h4, .conferencia-tribunal h4 { margin: 0; color: var(--ink); font-size: .95rem; }
.sobre-tribunal .source-link { justify-self: start; }
.sobre-colecoes, .conferencia-lista { display: grid; gap: 3px; color: var(--text-2); font-size: .84rem; line-height: 1.5; }
.sobre-colecoes li, .conferencia-lista li { overflow-wrap: anywhere; }
.conferencia-tribunal + .conferencia-tribunal { margin-top: 12px; }
.sobre-revisao { margin: 22px 0 0; font-size: .76rem; }
.sobre-revisao a { color: var(--muted); }

/* ── Painel do acervo ──────────────────────────────────────────────────────────────────────────
   Números grandes só no indicador principal; o resto é tabela com barra, em que a barra é de um
   tom só e o texto ao lado diz tudo sozinho. A parcela não apurada vai em cinza e por último. */

.acervo-head { display: block; }
.acervo-title { margin: 0; color: var(--ink); font-size: 1.6rem; font-weight: 700; }
.acervo-title:focus { outline: none; }
.acervo-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.acervo-filters .field { min-width: 150px; }
.acervo-section {
  margin-top: 22px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.acervo-section-title { margin: 0 0 6px; color: var(--ink); font-size: 1.02rem; font-weight: 700; }
.acervo-section-note { margin: 0 0 12px; color: var(--subtle); font-size: .82rem; line-height: 1.55; }
.acervo-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.acervo-controls .field { min-width: 140px; }
.acervo-controls .search-button, .acervo-controls .ghost-button { min-height: 40px; }
.acervo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px 28px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.kpi {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.kpi-label { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi-value { margin: 6px 0 0; color: var(--ink); font-size: 1.6rem; font-weight: 650; }
.kpi-value:empty { display: none; }
.kpi-hero .kpi-value { font-size: 3rem; line-height: 1.05; }
.kpi-detail { margin: 6px 0 0; color: var(--subtle); font-size: .78rem; line-height: 1.45; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table th, .data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  vertical-align: top;
}
.data-table thead th {
  color: var(--muted);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.data-table.compact { max-width: 320px; margin-top: 8px; }
.num, .pct { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .num { text-align: right; }
.cell-detail { display: block; margin-top: 2px; color: var(--subtle); font-size: .76rem; }
.muted-text { color: var(--subtle); }

.year-chart {
  display: flex;
  gap: 2px;
  align-items: end;
  height: 180px;
  padding-top: 18px;
  border-bottom: 1px solid var(--line-strong);
}
.year-col {
  position: relative;
  display: flex;
  flex: 1 1 0;
  justify-content: center;
  align-items: end;
  height: 100%;
  min-width: 4px;
}
.year-bar {
  display: block;
  width: 100%;
  max-width: 24px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
}
.year-col:hover .year-bar { background: var(--accent-ink); }
.year-peak {
  position: absolute;
  top: -18px;
  color: var(--text);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.year-axis {
  display: flex;
  justify-content: space-between;
  margin: 6px 0 10px;
  color: var(--subtle);
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
}
.undated-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--faint);
  color: var(--text-2);
  background: var(--surface-sunk);
  font-size: .8rem;
  line-height: 1.55;
}

.dist { margin: 0; }
.dist-title { margin-bottom: 8px; color: var(--ink); font-size: .9rem; font-weight: 650; }
.dist-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.dist-table th, .dist-table td { padding: 4px 6px; }
.dist-label { width: 40%; color: var(--text); font-weight: 500; text-align: left; }
.dist-bar-cell { width: 40%; }
.dist-bar {
  display: block;
  height: 10px;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.dist-bar.muted { background: var(--faint); }
.dist-table .num { color: var(--text); }
.dist-table .pct { color: var(--subtle); }
.dist-total { margin: 6px 0 0; color: var(--subtle); font-size: .76rem; }

.event-list { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.event-month {
  padding: 14px 0 6px;
  color: var(--muted);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.event-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.event-when { color: var(--text); font-size: .82rem; font-variant-numeric: tabular-nums; }
.event-body { display: grid; gap: 4px; }
.event-title {
  padding: 0;
  color: var(--accent);
  background: none;
  font-size: .9rem;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.event-title:hover { color: var(--accent-ink); }
.event-detail { margin: 0; color: var(--subtle); font-size: .78rem; line-height: 1.5; }

@media (max-width: 620px) {
  /* Marca, navegação e Atualizações não cabem numa linha em 390px: a navegação desce para a
     segunda, inteira, e o cabeçalho cresce em vez de transbordar. */
  .site-header { flex-wrap: wrap; row-gap: 0; padding-block: 8px 0; }
  .site-nav { order: 3; width: 100%; margin: 4px 0 0; }
  .site-nav-link { padding: 8px 10px; font-size: .84rem; }
  .acervo-section { padding: 16px 14px; }
  .kpi-hero .kpi-value { font-size: 2.4rem; }
  .event-item { grid-template-columns: 1fr; gap: 4px; }
  .acervo-filters .field, .acervo-controls .field { min-width: 0; flex: 1 1 140px; }
}

/* ── Painel do acervo: barra de recorte, abas e estados ────────────────────────────────────────── */

.acervo-bar {
  position: sticky;
  z-index: 5;
  top: 62px;
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.acervo-bar .acervo-filters { align-items: end; }
.acervo-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.acervo-bar-actions .ghost-button { min-height: 40px; }
.acervo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.acervo-chips:empty { display: none; }
.acervo-recorte { margin: 0; color: var(--text-2); font-size: .82rem; }
.acervo-recorte:empty { display: none; }
.acervo-tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.acervo-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: none;
  font-size: .9rem;
  font-weight: 600;
}
.acervo-tab:hover { color: var(--ink); }
.acervo-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.acervo-panel { padding-top: 4px; }
.acervo-panel:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.acervo-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 22px; }
.acervo-grid-2 > .acervo-section { min-width: 0; }
.acervo-state { margin: 8px 0; color: var(--subtle); font-size: .86rem; }
.acervo-details {
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.acervo-details summary { color: var(--ink); font-weight: 650; cursor: pointer; }
.acervo-details[open] summary { margin-bottom: 12px; }
.dist-pick {
  padding: 0;
  color: var(--accent);
  background: none;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dist-pick:hover { color: var(--accent-ink); }
.thesis-excerpt { margin-top: 6px; max-width: 62ch; }
.thesis-label {
  color: var(--muted);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.thesis-text { margin: 2px 0 0; color: var(--text); font-size: .82rem; line-height: 1.5; }
/* Vínculos do precedente. O estado vai escrito na etiqueta; a borda tracejada só reforça que a
   sugestão automática não é decisão. */
.link-chips { display: grid; gap: 4px; margin-top: 8px; max-width: 62ch; }
.link-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.link-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .76rem;
  line-height: 1.4;
}
.link-chip-name { min-width: 0; overflow-wrap: break-word; }
.link-chip-status {
  flex: none;
  white-space: nowrap;
  color: var(--ok);
  font-size: var(--label-size-sm);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.link-chip-suggested { border-style: dashed; background: var(--surface-sunk); color: var(--text-2); }
.link-chip-suggested .link-chip-status { color: var(--warn); }
.link-suggested-block {
  margin-top: 14px;
  padding: 12px 14px 4px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-sunk);
}
.link-suggested-title {
  margin: 0 0 8px;
  color: var(--warn);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.fonte-tribunal + .fonte-tribunal { margin-top: 18px; }
.fonte-tribunal-title { margin: 0 0 4px; color: var(--ink); font-size: .95rem; }
.fonte-grupo { margin: 10px 0 4px; color: var(--muted); font-size: .8rem; font-weight: 600; }
/* A pendência de verificação pede atenção, e só ela ganha o marcador de alerta. */
.data-table tr.row-pending td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segment {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface);
  font-size: .84rem;
  font-weight: 600;
}
.segment:hover { border-color: var(--accent); color: var(--ink); }
.segment[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.tempo-controls { flex-direction: column; align-items: flex-start; margin-top: 12px; }
.tempo-custom { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.tempo-custom[hidden] { display: none !important; }

@media (max-width: 620px) {
  .acervo-bar { position: static; padding: 12px; }
  .acervo-bar-actions { width: 100%; margin-left: 0; }
  .acervo-bar-actions .ghost-button { flex: 1 1 140px; }
}

/* ── Relatório para impressão ─────────────────────────────────────────────────────────────────
   Na tela, uma prévia em largura de página A4; na impressão, só ele sai. A capa ocupa a primeira
   página, e nenhuma tabela ou distribuição é cortada ao meio. */

.report-open { align-self: end; min-height: 40px; }
.report-dialog {
  width: min(900px, 100%);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: var(--surface-sunk);
}
.report-dialog::backdrop { background: var(--backdrop); }
.report-toolbar {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.report {
  max-width: 794px;
  margin: 18px auto 40px;
  padding: 48px 56px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: .9rem;
  line-height: 1.6;
}
.report-cover { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.report-eyebrow {
  margin: 0 0 10px;
  color: var(--accent-ink);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking-wide);
  text-transform: uppercase;
}
.report-h1 { margin: 0; color: var(--ink); font-size: 2rem; line-height: 1.2; }
.report-lead { margin: 12px 0 0; color: var(--text-2); font-size: 1rem; }
.report-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.report-figure { display: grid; gap: 4px; }
.report-figure strong { color: var(--ink); font-size: 2.2rem; line-height: 1.1; }
.report-figure span { color: var(--muted); font-size: .84rem; }
.report-meta { margin: 0; color: var(--subtle); font-size: .8rem; }
.report-section { margin-top: 28px; }
.report-h2 { margin: 0 0 10px; color: var(--ink); font-size: 1.2rem; }
.report-section p { margin: 0 0 10px; }
.report-note { color: var(--subtle); font-size: .82rem; }
.report-table { margin: 6px 0 12px; }
.report-list { display: grid; gap: 6px; padding-left: 18px; margin: 0 0 10px; }
.report-footer { margin-top: 36px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--subtle); font-size: .76rem; }

@page { size: A4; margin: 16mm 14mm; }

@media print {
  body { background: var(--surface); }
  body > *:not(#relatorio) { display: none !important; }
  .report-dialog {
    position: static;
    display: block;
    width: auto;
    height: auto;
    overflow: visible;
    background: none;
  }
  .report-dialog::backdrop { display: none; }
  .report-toolbar { display: none; }
  .report { max-width: none; margin: 0; padding: 0; box-shadow: none; font-size: 10.5pt; }
  .report-cover { break-after: page; border-bottom: 0; }
  .report-section { break-inside: auto; }
  .report-h2 { break-after: avoid; }
  .report table, .report figure, .report tr, .report-note { break-inside: avoid; }
  .dist-bar, .year-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

@media (max-width: 620px) {
  .report { padding: 24px 18px; }
  .report-figures { grid-template-columns: 1fr; }
}

/* ── Rodapé ───────────────────────────────────────────────────────────────────────────────────── */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  padding: 20px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: .7rem;
}
.site-footer strong { color: var(--text-2); }
.site-footer p { margin: 0; }

/* ── Julgados relacionados ────────────────────────────────────────────────────────────────────── */

/* Material de apoio, e a folha diz isso sem precisar de rótulo: sem preenchimento de cartão, sem
   fundo próprio, só uma régua acima separando-a da resposta. O que governa o caso está acima e tem
   cartão; o que ilustra está aqui e tem lista. */
.related {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.related-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px; /* alvo de toque: a seção é fechada e o resumo é o único jeito de abri-la. */
  padding: 0 4px;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
}
.related-summary::-webkit-details-marker { display: none; }
.related-summary:hover .related-label { color: var(--ink); }
.related-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* A seta é do CSS e gira com o estado nativo do `details`: nada em JavaScript acompanha isso. */
.related-summary::before {
  color: var(--subtle);
  content: "▸";
  font-size: .7rem;
  transition: transform .16s ease;
}
.related[open] .related-summary::before { transform: rotate(90deg); }

.related-label {
  color: var(--text-2);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.related-hint {
  color: var(--subtle);
  font-size: var(--label-size-sm);
  letter-spacing: var(--label-tracking-sm);
  text-transform: uppercase;
}
.related[open] .related-hint { display: none; }

.related-list {
  display: grid;
  gap: 11px;
  margin-top: 14px;
}

.related-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-sunk);
}
.related-card h4 {
  margin: 0;
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.35;
}
.related-card .result-meta,
.related-card .result-notice { margin: 0; }
.related-card blockquote {
  margin: 2px 0;
  padding: 9px 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--text-2);
  font-size: .76rem;
  line-height: 1.55;
}
.related-card .source-link {
  width: fit-content;
  margin-top: 2px;
}
/* ── Responsivo ───────────────────────────────────────────────────────────────────────────────── */

/* Tablet e janela estreita de desktop. Três cartões lado a lado deixam o terceiro com metade da
   largura do primeiro e quebram a linha de assuntos em quatro. */
@media (max-width: 860px) {
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .courts-field { grid-column: 1 / -1; }
  .example-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Telefone. Tudo em uma coluna, e todo alvo de toque com 44px — a medida que as diretrizes de
   acessibilidade fixam e que decide se o dedo acerta o chip ou o de baixo.
   O bloco abaixo estava fora do `@media`: a dica "Enter para pesquisar" sumia também no desktop e o
   compositor perdia o respiro em qualquer largura. */
@media (max-width: 620px) {
  .search-composer { padding: 16px; }
  .submit-hint { display: none; }
  .output-header { align-items: center; }
  .output-header h2 { font-size: 1.02rem; }
  .output-header .ghost-button {
    flex: 0 0 auto;
    padding-inline: 9px;
  }
  .search-output { scroll-margin-top: 70px; }
  .example-cards { grid-template-columns: 1fr; }
  .filters-summary { min-height: 48px; }
  .workspace { width: min(100% - 28px, var(--page)); padding-top: 30px; }
  .workspace h1, .workspace-title { font-size: 1.32rem; }
  .query-row { align-items: stretch; }
  .query-row textarea { width: 100%; }
  .query-toolbar { align-items: stretch; }
  .search-button { width: 100%; }
  /* Nome e contexto empilham: lado a lado, "Reconhecimento de curso especializado" e
     "Trânsito · TRAPAS-003" não cabem em 360px, e `nowrap` no contexto empurraria o nome para fora
     da caixa. O contexto é o que distingue os homônimos, então ele fica — abaixo, não truncado. */
  /* Alvo de toque: 9px de padding dá 38px de altura, e o mínimo confortável é 44. */
  .suggest-item { padding: 11px 14px; }
  .filters-grid { grid-template-columns: 1fr; }
  .courts { flex-wrap: wrap; }
  .chip-check { min-height: 44px; }
  .result-facts { grid-template-columns: 1fr; gap: 2px; }
  .result-facts dd { margin-bottom: 8px; }
  .result-foot { align-items: stretch; flex-direction: column; }
  .source-link { justify-content: center; }
  .brand-copy small { display: none; }
  /* Rótulo e dica lado a lado não cabem em 320px: a dica quebrava a linha e empurrava a seta para
     fora do alvo de toque. Em tela estreita a seta já diz que abre. */
  .related-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
.official-link { border-color: color-mix(in srgb, var(--ok) 34%, transparent); color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }

/* ── A posição · o que os julgados fazem com a tese ───────────────────────────────────────────
   Ao lado de "quem cita", e visualmente mais leve que o resultado: é evidência anexa à norma. As
   cores dizem o lado — quem sustenta em verde, quem restringe em âmbar, quem contraria em vermelho —
   porque "14 aplicam, 2 contrariam" precisa ser lido como dois fatos, e não somado. */
.stance {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
}
.stance-title {
  margin: 0;
  color: var(--subtle);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}

/* ── Situação e histórico do precedente ────────────────────────────────────────────────────────
   Dentro do cartão da normativa, fechado por padrão: a hierarquia da tela é a do direito — o que
   governa vem primeiro, a história vem a pedido. */
.timeline {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.timeline-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.timeline-summary::-webkit-details-marker { display: none; }
.timeline-summary::before {
  content: "▸";
  color: var(--muted);
  font-size: .7rem;
  transition: transform .15s ease;
}
.timeline[open] .timeline-summary::before { transform: rotate(90deg); }
.timeline-title {
  color: var(--text-2);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.stance-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.stance-count {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
  font-size: .72rem;
  font-weight: 600;
}
.stance-count.supportive { border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.stance-count.restrictive { border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.stance-count.contradicts { border-color: color-mix(in srgb, var(--danger) 32%, transparent); color: var(--danger); }
.stance-pending {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.55;
}

/* A situação é a única coisa que decide o que se pode citar, e por isso é a que ganha cor. */
.timeline-standing {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .7rem;
  font-weight: 700;
}
.timeline-standing.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--ok); }
.timeline-standing.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); }
.timeline-standing.void { background: color-mix(in srgb, var(--danger) 9%, transparent); color: var(--danger); }
.timeline-count { color: var(--muted); font-size: .72rem; }

.timeline-body { margin-top: 10px; display: grid; gap: 7px; }
.timeline-line { margin: 0; color: var(--text-2); font-size: .76rem; line-height: 1.5; }
.timeline-line strong { color: var(--text); }
.timeline-asof strong { color: var(--accent-ink); }
/* "Não registrado" não é alarme: é o caso comum, e pintá-lo de vermelho ensinaria a ignorar o
   vermelho de verdade. */
.timeline-unknown { color: var(--muted); font-style: italic; }

.timeline-events {
  margin: 4px 0 0;
  padding: 0 0 0 14px;
  display: grid;
  gap: 5px;
  border-left: 2px solid var(--line-strong);
  list-style: none;
}
.timeline-event {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: .76rem;
}
.timeline-when {
  min-width: 84px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
/* Data desconhecida se lê como desconhecida, e não como espaço em branco. */
.timeline-undated { color: var(--subtle); font-style: italic; }
.timeline-what { color: var(--text-2); }
.timeline-source { color: var(--accent-ink); font-size: .72rem; text-decoration: none; }
.timeline-source:hover { text-decoration: underline; }

/* A descrição do evento: procedência e ressalva, em linha própria abaixo do rótulo.
   Quebra a linha porque é prosa, e prosa espremida ao lado de uma data vira ruído que ninguém lê. */
.timeline-detail {
  flex-basis: 100%;
  margin-left: 92px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.45;
}

/* O aviso de que o texto exibido é posterior à data consultada.
   Cor de alerta e não de erro: nada está quebrado — o que há é uma ressalva que muda o uso do
   enunciado, e pintá-la de vermelho a igualaria a "esta tese caiu", que é outra coisa. */
.timeline-wording {
  border-left: 3px solid var(--warn);
  padding-left: 9px;
}
.timeline-wording strong { color: var(--warn); }

/* A inferência com moldura própria. A separação tem de ser visual, e não só de campo: campos irmãos
   com a mesma tipografia viram, na leitura, a mesma afirmação. */
.timeline-inferred {
  margin-top: 4px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--warn) 6%, transparent);
  display: grid;
  gap: 4px;
}
.timeline-inferred .timeline-line strong { color: var(--warn); }

/* Explorar: o filtro de apuração vale só para a tabela, e fica junto dela. */
.acervo-table-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.acervo-table-tools .field { min-width: 260px; }
.inquiry-detail { margin-top: 4px; font-size: .76rem; color: var(--muted); }
.inquiry-detail summary { cursor: pointer; color: var(--text-2); }
.inquiry-detail ul { margin: 4px 0 0; padding-left: 16px; }
.inquiry-detail li + li { margin-top: 2px; }

/* Exceções: poucos casos, cada um com o porquê e a evidência. */
.exception-list { display: grid; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.exception-list:empty { margin-top: 0; }
.exception-category {
  margin: 0;
  color: var(--muted);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
}
.exception-reasons { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: .8rem; line-height: 1.5; }
.exception-evidence { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--line-strong); color: var(--muted); font-size: .78rem; line-height: 1.5; }
@media (max-width: 640px) { .acervo-table-tools .field { min-width: 0; flex: 1 1 100%; } }

/* Explorar: o filtro por motivo vem de um grupo das Exceções e não tem controle; o texto diz qual é. */
.applied-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.applied-filter[hidden] { display: none; }
.applied-filter .acervo-section-note { margin: 0; flex: 1 1 320px; }

/* ─── Lista de jurisprudência normativa (a entrada) ──────────────────────────────────────────────
   Uma coluna de cartões curtos: identificação, situação e data, trecho, e as duas ações. O que é
   painel — contagens, cobertura, apuração — fica em "Informações do acervo". */
.lista-form { display: grid; gap: 10px; margin-bottom: 14px; }
.lista-controles {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 150px) minmax(170px, 220px) auto;
  gap: 10px;
  align-items: end;
}
.lista-refinos {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding-top: 12px;
}
.lista-refinar .acervo-section-note { margin: 8px 0 0; }
.lista-status { margin: 4px 0 10px; color: var(--muted); font-size: .76rem; }
.lista-erro { display: grid; gap: 8px; justify-items: start; margin-bottom: 12px; }
.lista-itens { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.lista-itens[aria-busy="true"] { opacity: .6; }
.lista-cartao {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
/* O caído é lido como caído antes de o texto ser lido: borda, e não só cor da etiqueta. */
.lista-cartao-caido { border-left: 3px solid var(--danger); }
.lista-item-cabeca, .lista-item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.lista-item-titulo { margin: 0; color: var(--ink); font-size: .95rem; line-height: 1.35; }
.lista-item-titulo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lista-data { color: var(--subtle); font-size: .74rem; }
.lista-aviso { margin: 0; color: var(--warn); font-size: .74rem; }
.lista-nota { margin: 0; color: var(--muted); font-size: .74rem; }
.lista-trecho .result-excerpt-missing { margin: 0; font-size: .78rem; }
.lista-acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
.lista-rodape { margin: 18px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.6; }

@media (max-width: 860px) {
  .lista-controles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lista-busca { grid-column: 1 / -1; }
  .lista-refinos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .lista-controles, .lista-refinos { grid-template-columns: minmax(0, 1fr); }
  .lista-cartao { padding: 12px; }
}

/* ─── Histórico: a resposta numa data ────────────────────────────────────────────────────────────
   Três blocos fixos — situação, redação, depois desta data —, cada ato numa frase com a fonte; e
   o registro técnico da LawX recolhido no fim. */
.history-answer {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.history-answer:first-child { border-top: 0; }
.history-answer-label { color: var(--ink); font-size: .8rem; }
.history-ato { margin: 0; color: var(--text); font-size: .78rem; line-height: 1.55; }
.history-tecnico { margin-top: 18px; color: var(--muted); font-size: .76rem; }
.history-tecnico > summary { cursor: pointer; font-weight: 600; }

/* ─── Editor do cadastro (`editar.html`) ─────────────────────────────────────────────────────────
   Uma coluna de leitura: o registro só leitura no topo, as divergências da fonte antes dos campos,
   os grupos recolhíveis e a publicação no fim. As etiquetas são as de `.field`. */
.editor { max-width: 860px; }
.editor-registro, .editor-divergencias, .editor-grupo {
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.editor-divergencias { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.editor-grupo > summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.editor-grupo[open] > summary { margin-bottom: 12px; }
.editor-subtitulo { margin: 14px 0 8px; color: var(--ink); font-size: .9rem; font-weight: 700; }
.editor-registro .editor-subtitulo, .editor-divergencias .editor-subtitulo { margin-top: 0; }
.editor-leitura { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: .76rem; }
.editor-leitura dt { color: var(--muted); }
.editor-leitura dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.editor-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.editor-campo, .editor-data, .editor-lista { margin-bottom: 12px; padding: 0; }
.editor-campo textarea, .editor-adicionar input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-sunk);
  font-size: .78rem;
  line-height: 1.5;
}
.editor-texto { min-height: 160px; resize: vertical; }
.editor-data-linha { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 8px; }
.editor-erro { margin: 4px 0 0; }
.editor-itens { display: grid; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; font-size: .78rem; }
.editor-item { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.editor-item-vazio { color: var(--muted); }
.editor-adicionar { display: flex; gap: 8px; align-items: center; }
.editor-adicionar select, .editor-data-linha select, .editor-data-linha input { min-height: 40px; }
.editor-eventos { display: grid; gap: 8px; margin-bottom: 10px; }
.editor-evento { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.editor-evento > summary { cursor: pointer; color: var(--text-2); font-size: .8rem; font-weight: 600; }
.editor-evento-novo { margin: 0 0 10px; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.editor-evento-novo > legend { padding: 0 4px; color: var(--accent-ink); font-weight: 700; }
.editor-novo-ato:empty { display: none; }
.editor-divergencia { padding: 10px 0; border-top: 1px solid var(--line); font-size: .78rem; }
.editor-divergencia p { margin: 0 0 4px; }
.editor-divergencia-campo { color: var(--ink); font-weight: 700; }
.editor-formulario .search-button { margin-top: 6px; }
.editor-resultado { margin-bottom: 14px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); border-radius: 12px; background: var(--surface); }
.editor-resultado a { text-decoration: none; }
.editor-sucesso { margin: 0 0 6px; color: var(--ok); font-weight: 700; }
.editor-conflito { margin-top: 8px; color: var(--text); }
.editor-conflito-lista { margin: 4px 0 8px; padding-left: 18px; }

@media (max-width: 620px) {
  .editor-grade, .editor-data-linha { grid-template-columns: minmax(0, 1fr); }
  .editor-leitura { grid-template-columns: minmax(0, 1fr); }
  .editor-adicionar { flex-wrap: wrap; }
}
