/* Ferramenta de trabalho, nao landing page.
   Regras: filete em vez de sombra, densidade em vez de respiro, um unico acento,
   serifa reservada ao documento. */

:root {
  --paper:    #f7f5f1;
  --surface:  #fffefb;
  --ink:      #1c1a17;
  --muted:    #6d6862;
  --faint:    #97918a;
  --rule:     #ddd8cf;
  --rule-strong: #c6bfb3;
  --accent:   #2f5d4f;
  --accent-bg:#e6efea;
  --alert:    #9a3b28;
  --alert-bg: #f7e9e5;
  --warn:     #85661a;
  --warn-bg:  #f6efdc;

  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --doc: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #171614;
    --surface:  #1e1d1a;
    --ink:      #e6e2db;
    --muted:    #968f85;
    --faint:    #6f6960;
    --rule:     #302d28;
    --rule-strong: #45413a;
    --accent:   #7fae9c;
    --accent-bg:#1e2b26;
    --alert:    #d98872;
    --alert-bg: #2c1e1a;
    --warn:     #c4a253;
    --warn-bg:  #2a2418;
  }
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* --- cabecalho ----------------------------------------------------------- */

.topo {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topo h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topo .sub {
  font-size: 0.78rem;
  color: var(--muted);
}

/* As tres secoes, no alto a direita. Antes eram dois links soltos em 0.78rem
   cinza - tamanho de legenda, para o que e a navegacao inteira do sistema.
   Agora sao abas: descem ate o filete do cabecalho, e a marca da secao atual e
   esse mesmo filete trocado de cor. Sem sombra e sem pilula - a regra da casa e
   filete. */
.topo .secoes {
  margin-left: auto;
  display: flex;
  gap: 0.15rem;
  /* Estica ate a borda de baixo do cabecalho. O `stretch` vence o `baseline` do
     .topo, e a margem negativa cobre o padding de 0.85rem: e o que assenta a
     marca da aba ativa SOBRE o filete, em vez de flutuando acima dele. */
  align-self: stretch;
  margin-bottom: -0.85rem;
}

.topo .secoes a {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.topo .secoes a:hover {
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
}

.topo .secoes a.aqui {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Janela estreita: o subtitulo sai antes que as abas comecem a se espremer. Ele
   explica, elas navegam - e navegar ganha. */
@media (max-width: 760px) {
  .topo { padding-left: 1rem; padding-right: 1rem; }
  .topo .sub { display: none; }
}

/* --- estrutura ----------------------------------------------------------- */

.quadro {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 350px;
  align-items: start;
  gap: 0;
  max-width: 1500px;
  margin: 0 auto;
}

@media (max-width: 1100px) {
  .quadro { grid-template-columns: minmax(0, 1fr); }
  .rail, .lateral { position: static; border: 0; }
  .rail { display: none; }
}

.rail {
  position: sticky;
  top: 49px;
  padding: 1.6rem 1rem 2rem 1.5rem;
  border-right: 1px solid var(--rule);
  align-self: start;
}

.rail a {
  display: block;
  padding: 0.28rem 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  border-left: 2px solid transparent;
  padding-left: 0.6rem;
  margin-left: -0.6rem;
}

.rail a:hover { color: var(--ink); border-left-color: var(--rule-strong); }

.principal { padding: 1.6rem 2rem 6rem; min-width: 0; }

.lateral {
  position: sticky;
  top: 49px;
  max-height: calc(100vh - 49px);
  overflow-y: auto;
  padding: 1.6rem 1.5rem 3rem 1.25rem;
  border-left: 1px solid var(--rule);
  align-self: start;
}

/* --- rotulos e secoes ---------------------------------------------------- */

.rotulo {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  font-weight: 600;
  margin: 0 0 0.7rem;
}

section.secao { margin-bottom: 2.4rem; }

section.secao > h2 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

/* --- perguntas ----------------------------------------------------------- */

.pergunta {
  padding: 0.7rem 0;
  border-bottom: 1px dotted var(--rule);
}

.pergunta[hidden] { display: none; }

.pergunta > label.texto,
.pergunta > .texto {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.pergunta .obrig { color: var(--alert); margin-left: 0.15rem; }

.ajuda {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  padding-left: 0.7rem;
  border-left: 2px solid var(--rule);
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 0.34rem 0.5rem;
  min-width: 15rem;
  max-width: 100%;
}

/* Narrativa: o campo precisa parecer um lugar onde se ESCREVE, nao uma linha a
   preencher. Largo e alto o bastante para caber uma historia com datas. */
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  line-height: 1.55;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

/* radio sim/nao: tres estados importam, o vazio e resposta valida */
.binario { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 2px; overflow: hidden; }
.binario label {
  padding: 0.24rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
  background: var(--surface);
  border-right: 1px solid var(--rule-strong);
}
.binario label:last-child { border-right: 0; }
.binario input { position: absolute; opacity: 0; pointer-events: none; }
.binario input:checked + span { color: var(--surface); }
.binario label:has(input:checked) { background: var(--accent); color: var(--surface); }

.opcoes { display: flex; flex-direction: column; gap: 0.24rem; margin-top: 0.15rem; }
.opcoes label { font-size: 0.87rem; display: flex; gap: 0.45rem; align-items: baseline; cursor: pointer; }

/* --- painel lateral ------------------------------------------------------ */

.bloco { margin-bottom: 1.7rem; }

.item {
  padding: 0.5rem 0 0.5rem 0.7rem;
  border-left: 2px solid var(--rule-strong);
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
}

.item.cabivel  { border-left-color: var(--accent); }
.item.possivel { border-left-color: var(--warn); }
.item.critica  { border-left-color: var(--alert); background: var(--alert-bg); }
.item.aviso    { border-left-color: var(--warn); background: var(--warn-bg); }

.item .nome { font-weight: 600; }
.item .nota { color: var(--muted); font-size: 0.78rem; display: block; margin-top: 0.15rem; }

.contador {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  font-weight: 400;
  margin-left: 0.3rem;
}

.vazio { color: var(--faint); font-size: 0.82rem; font-style: italic; }

/* --- acoes --------------------------------------------------------------- */

.acoes {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--rule-strong);
  padding: 0.7rem 1.5rem;
  display: flex;
  gap: 0.7rem;
  align-items: center;
  z-index: 20;
}

button {
  font: inherit;
  font-size: 0.87rem;
  padding: 0.4rem 1.1rem;
  border-radius: 2px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

@media (prefers-color-scheme: dark) { button { color: #14201c; } }

button.secundario { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
button:hover { filter: brightness(1.08); }

/* --- relatorio ----------------------------------------------------------- */

.relatorio {
  max-width: 46rem;
  margin: 2.5rem auto 5rem;
  padding: 0 2rem;
  font-family: var(--doc);
  font-size: 1.02rem;
  line-height: 1.6;
}

.relatorio h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 0.2rem; }
.relatorio .meta { font-family: var(--ui); font-size: 0.8rem; color: var(--muted); margin-bottom: 2rem; }
.relatorio h2 {
  font-family: var(--ui);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35rem;
  margin: 2.4rem 0 1rem;
}
.relatorio h3 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.3rem; }
.relatorio ul { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }
.relatorio li { margin-bottom: 0.2rem; }
.relatorio .fund { font-family: var(--ui); font-size: 0.84rem; color: var(--muted); }
.relatorio .fund b { color: var(--ink); font-weight: 600; }
.relatorio .marca {
  font-family: var(--ui);
  font-size: 0.76rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--alert);
  color: var(--alert);
  border-radius: 2px;
  white-space: nowrap;
}
.relatorio .caixa {
  font-family: var(--ui);
  font-size: 0.86rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--alert);
  background: var(--alert-bg);
  margin: 0.8rem 0;
}
.relatorio .caixa.neutra { border-left-color: var(--accent); background: var(--accent-bg); }

/* --- campos com sufixo --------------------------------------------------- */

.comsufixo { display: inline-flex; align-items: baseline; gap: 0.4rem; }
.sufixo { font-size: 0.8rem; color: var(--muted); }
input.curto { min-width: 8rem; }

.rail a.ativo { color: var(--accent); }
.topo a { text-decoration: none; }

.salvo { font-size: 0.78rem; color: var(--accent); font-variant-numeric: tabular-nums; }

/* --- tabelas do relatorio ------------------------------------------------ */

.relatorio table { width: 100%; border-collapse: collapse; margin: 0.9rem 0 1.2rem; }

/* --- lista de casos ------------------------------------------------------ */

.lista { max-width: 40rem; margin: 2.5rem auto; padding: 0 2rem; }

/* --- entrar e conta (so no servico) --------------------------------------- */

.lista.entrar { max-width: 24rem; }
.entrar form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.6rem; }
.entrar label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.entrar input { min-width: 0; width: 100%; }
.entrar button { align-self: flex-start; }
.entrar .nota { font-size: 0.8rem; color: var(--faint); margin-top: 1.4rem; }

.topo .conta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}
.topo .conta button { font-size: 0.78rem; padding: 0.2rem 0.7rem; }
/* O nome de quem esta logado leva a /conta. Sublinhado so no hover: no cabecalho
   ele e identificacao antes de ser link, e um sublinhado permanente ali competia
   com as abas das secoes. */
.topo .conta a { color: inherit; text-decoration: none; }
.topo .conta a:hover, .topo .conta a:focus-visible { text-decoration: underline; }
/* O `gap` do flex ja separa o nome do escritorio; sem isto sobrava um vao duplo
   entre o link e o ponto divisor. */
.topo .conta a + span { margin-left: -0.35rem; }

/* Aviso de sessao expirada no painel lateral da entrevista. */
#analise .caixa.alerta {
  font-size: 0.86rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--alert);
  background: var(--alert-bg);
  color: var(--alert);
}
/* Com as abas presentes, sao elas que empurram para a direita; sem elas (relatorio,
   minuta) a conta assume. */
.topo .secoes + .conta { margin-left: 0.8rem; }

.caso {
  display: block;
  padding: 0.6rem 0 0.6rem 0.7rem;
  border-left: 2px solid var(--rule-strong);
  border-bottom: 1px dotted var(--rule);
  margin-bottom: 0.3rem;
  text-decoration: none;
  color: var(--ink);
}
.caso:hover { border-left-color: var(--accent); background: var(--surface); }
.caso .nome { font-weight: 600; font-size: 0.92rem; display: block; }

@media print {
  .topo, .rail, .lateral, .acoes { display: none; }
  body { background: #fff; }
  .relatorio { margin: 0; max-width: none; }
  .caixa { break-inside: avoid; }
}

/* --- consulta ao corpus --------------------------------------------------- */

.lista.larga { max-width: 52rem; }

.busca {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.busca input[type="search"] {
  flex: 1 1 22rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.95rem;
}
.busca .data {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.busca .data input { padding: 0.4rem; }

.numeros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.numeros b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  margin-right: 0.25rem;
}

.dispositivo {
  padding: 0.7rem 0 0.7rem 0.7rem;
  border-left: 2px solid var(--rule-strong);
  border-bottom: 1px dotted var(--rule);
  margin-bottom: 0.4rem;
}
.dispositivo:hover { border-left-color: var(--accent); background: var(--surface); }
.dispositivo .nome { font-weight: 600; font-size: 0.9rem; }
.dispositivo .urn {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  margin-left: 0.5rem;
}
/* Serifa porque isto e texto de lei, nao rotulo de interface - a mesma regra que
   separa o relatorio do formulario no resto do sistema. */
.texto-lei {
  font-family: var(--doc);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0.3rem 0;
}
/* `.caixa` so existia dentro de `.relatorio`. A consulta ao corpus e outra
   pagina e precisa da mesma caixa, entao a base vem para fora do escopo. */
.lista .caixa {
  font-family: var(--ui);
  font-size: 0.86rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--rule-strong);
  background: var(--surface);
  margin: 0.8rem 0;
}
.lista .caixa code {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--accent-bg);
  padding: 0.1rem 0.3rem;
}
.lista .caixa.alerta {
  border-left-color: var(--alert);
  background: var(--alert-bg);
  color: var(--alert);
}

/* Narrativa no relatorio: quebra de linha e informacao. A advogada separa os
   episodios por linha, e juntar tudo num paragrafo destroi a separacao. */
.narrativa {
  white-space: pre-wrap;
  margin: 0.2rem 0 0.9rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--rule);
}
.meta.partes { margin-top: -0.2rem; }

/* --- minuta da inicial ---------------------------------------------------- */

/* A peca herda .relatorio: mesma tipografia de documento. Aqui so o que a peca
   tem e o relatorio nao - enderecamento, texto corrido justificado e a
   transcricao do dispositivo. */

.peca .enderecamento {
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 2.5rem;
}

.peca .corrido { text-align: justify; text-indent: 2.5rem; margin: 0 0 0.8rem; }
.peca .corrido.nota-cisao { text-indent: 0; font-family: var(--ui); font-size: 0.88rem; }

.peca .citacao { margin: 0.7rem 0 1.1rem; }
.peca .citacao .ref { font-family: var(--ui); font-size: 0.84rem; margin: 0 0 0.3rem; }

/* Transcricao literal da lei. Recuo e corpo menor, como a peca escreve - e
   distinta do texto do advogado a olho nu, que e o que importa: ninguem deve
   confundir o que a lei diz com o que a peca alega. */
.peca blockquote {
  margin: 0 0 0.4rem 2.5rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--rule);
  font-size: 0.94rem;
  color: var(--ink);
}

.peca ol.pedidos { margin: 0.6rem 0 1.2rem; padding-left: 2.5rem; }
.peca ol.pedidos li { margin-bottom: 0.45rem; }

/* Avisos de trabalho: existem para quem monta a peca, nunca para o juizo. Somem
   na impressao junto com a navegacao. */
.peca .aviso-tela { font-family: var(--ui); }
.peca .aviso-tela h2 { margin-top: 0.6rem; border: 0; }

@media print {
  .peca .aviso-tela, .no-print { display: none; }
}
