/* JL Consulta — a norma visual está em ../DESIGN.md (formato Google Labs).
   As variáveis abaixo têm o MESMO nome dos tokens de lá (colors.primary →
   --primary); o tests/test_site.py confirma que os valores não divergem.
   Mudar uma cor = mudar no DESIGN.md, correr o lint, copiar para aqui. */
:root {
  --primary: #1C1B19;  --secondary: #5C5A55;  --tertiary: #9A3B24;
  --tertiary-hover: #7E2F1C;  --neutral: #F6F4EF;  --surface: #FFFFFF;
  --line: #E3DFD6;  --highlight: #FBE7A1;  --danger: #A3261B;
  --score-high: #1E6B45;  --score-high-bg: #E5F1EA;
  --score-mid: #73560A;   --score-mid-bg: #F8EED0;
  --score-low: #5C5A55;   --score-low-bg: #EFEDE7;
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --leitura: 760px;  --toque: 44px;
}
/* Modo escuro: os tokens dark-* do DESIGN.md */
@media (prefers-color-scheme: dark) {
  :root {
    --neutral: #141413;  --surface: #1F1E1C;  --primary: #EDEBE6;
    --secondary: #A9A69E;  --tertiary: #F0A487;  --tertiary-hover: #F6BFA9;
    --line: #37352F;  --highlight: #5E4B0E;
    --score-low-bg: #2A2926;  --score-low: #A9A69E;
    --score-high-bg: #17321F;  --score-high: #8FD3AB;
    --score-mid-bg: #3A3014;  --score-mid: #E9C766;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--neutral); color: var(--primary);
       font: 400 1rem/1.6 var(--fonte); }
a { color: var(--tertiary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--tertiary); outline-offset: 2px; }
main { max-width: var(--leitura); margin: 0 auto; padding: 16px; }

/* typography.display / title / small */
h1 { font-size: 1.625rem; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; margin: 8px 0 16px; }
h2 { font-size: 1.0625rem; font-weight: 650; line-height: 1.35; margin: 40px 0 8px; }
h3 { font-size: 1.0625rem; font-weight: 650; line-height: 1.35; margin: 0; }
.discreto { color: var(--secondary); font-weight: 400; font-size: 0.8125rem; line-height: 1.45; }

/* Topo */
.topo { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
        gap: 8px 16px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.marca { font-weight: 650; color: var(--primary); font-size: 1.0625rem; }
.topo nav { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.topo nav a { display: inline-flex; align-items: center; min-height: var(--toque); }
.topo nav a.discreto { color: var(--secondary); }

/* components.card */
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
          padding: 16px; margin-bottom: 8px; overflow-wrap: anywhere; }
.cartao p { margin: 8px 0; }
.linha-titulo { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.linha-titulo h3 { min-width: 0; }

/* components.chip e score-* (o mesmo código de cores do email do Monitor) */
.etiqueta, .nota { display: inline-block; white-space: nowrap; border-radius: 999px; padding: 3px 8px;
                   font-size: 0.75rem; font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; }
.etiqueta { background: var(--score-low-bg); color: var(--secondary); }
.etiqueta.revogado { color: var(--danger); }
.nota-alta { background: var(--score-high-bg); color: var(--score-high); }
.nota-media { background: var(--score-mid-bg); color: var(--score-mid); }
.nota-baixa { background: var(--score-low-bg); color: var(--score-low); }

.ligacoes { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.ligacoes a { display: inline-flex; align-items: center; min-height: var(--toque); font-weight: 600; }
/* components.search-hit */
.trecho mark { background: var(--highlight); color: var(--primary); padding: 0 2px; border-radius: 6px; }

/* components.input e button-primary */
.pesquisa-grande { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.pesquisa-grande input[name=q] { flex: 1 1 260px; min-width: 0; }
.pesquisa-grande select { flex: 1 1 150px; min-width: 0; }
input, select { font: inherit; min-height: var(--toque); padding: 10px 14px; border-radius: 6px;
                border: 1px solid var(--line); background: var(--surface); color: var(--primary); }
button { font: inherit; font-weight: 650; min-height: var(--toque); padding: 10px 18px; border-radius: 6px;
         border: none; background: var(--tertiary); color: var(--surface); cursor: pointer; }
button:hover { background: var(--tertiary-hover); }
.ajuda { color: var(--secondary); font-size: 0.8125rem; margin-top: 0; }

.grelha-concelhos, .grelha-numeros { display: grid; gap: 8px;
       grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.concelho { display: flex; align-items: center; justify-content: center; min-height: 56px;
            text-align: center; font-weight: 650; margin: 0; }
/* Porta: um cartão por serviço */
.grelha-servicos { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.servico { display: block; margin: 0; color: var(--primary); min-height: 96px; }
.servico:hover { text-decoration: none; border-color: var(--tertiary); }
.servico h3 { color: var(--tertiary); }
.servico .emoji { font-size: 2rem; line-height: 1.2; margin-bottom: 8px; }
.numero .valor { font-size: 1.625rem; font-weight: 650; }

.documento { padding: 8px 0; border-bottom: 1px solid var(--line); }
.documento .discreto { display: block; word-break: break-all; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
          padding: 4px 16px; margin-bottom: 8px; }
summary { cursor: pointer; min-height: var(--toque); display: flex; align-items: center; gap: 8px; }

/* Login */
.entrar { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.caixa-login { width: 100%; max-width: 340px; }
.caixa-login label { display: block; margin: 16px 0; }
.caixa-login input { width: 100%; margin-top: 4px; }
.caixa-login button { width: 100%; margin-top: 8px; }
/* Olho para ver a senha: dentro do campo, à direita; o risco aparece quando a senha está à vista */
.campo-senha { position: relative; display: block; }
.campo-senha input { padding-right: 52px; }
.caixa-login button.olho { position: absolute; right: 0; bottom: 0; width: var(--toque); min-height: var(--toque);
                           margin: 0; padding: 0; background: none; color: var(--secondary);
                           display: flex; align-items: center; justify-content: center; }
.caixa-login button.olho:hover { background: none; color: var(--primary); }
.olho .risco { display: none; }
.olho[aria-pressed="true"] .risco { display: inline; }
.aviso { color: var(--danger); }

footer { text-align: center; color: var(--secondary); font-size: 0.8125rem; padding: 24px 16px 40px; }

/* Pesquisa: várias páginas dentro do mesmo cartão, separadas por uma linha */
.pagina-encontrada + .pagina-encontrada { border-top: 1px solid var(--line); padding-top: 8px; }
.ajuda-pesquisa { margin: 4px 0 16px; }
.ajuda-pesquisa table { border-collapse: collapse; font-size: 0.8125rem; }
.ajuda-pesquisa td { padding: 4px 12px 4px 0; vertical-align: top; }
.ajuda-pesquisa p { color: var(--secondary); font-size: 0.8125rem; }
code { font-size: 0.875em; background: var(--neutral); border-radius: 6px; padding: 1px 5px; }
.artigos { color: var(--secondary); font-size: 0.8125rem; }
.aviso-doc { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px; }
h2.grupo { margin-top: 24px; }
