/* Portal de acesso -- pagina estatica, sem build e sem dependencia externa.
   Nao usa Tailwind de proposito: e servida fora do bundle do app, e um CSS de
   poucos KB nao justifica arrastar o pipeline do frontend junto.

   Paleta e raios seguem o app (slate + sky) para o municipio nao sentir que
   trocou de sistema ao ser encaminhado. */

:root {
    color-scheme: light dark;

    --fundo: #f8fafc;
    --fundo-brilho: #e0f2fe;
    --cartao: #ffffff;
    --borda: #e2e8f0;
    --borda-forte: #cbd5e1;
    --texto: #0f172a;
    --texto-suave: #64748b;
    --destaque: #0284c7;
    --destaque-forte: #0369a1;
    --destaque-fundo: #f0f9ff;
    --realce: #075985;
    --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .18);
}

@media (prefers-color-scheme: dark) {
    :root {
        --fundo: #020617;
        --fundo-brilho: #0c4a6e;
        --cartao: #0f172a;
        --borda: #1e293b;
        --borda-forte: #334155;
        --texto: #e2e8f0;
        --texto-suave: #94a3b8;
        --destaque: #38bdf8;
        --destaque-forte: #7dd3fc;
        --destaque-fundo: #0b2b3d;
        --realce: #bae6fd;
        --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
    }
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: var(--fundo);
    /* Brilho discreto atras do cartao; sem imagem, sem requisicao. */
    background-image: radial-gradient(60rem 32rem at 50% -18%, var(--fundo-brilho), transparent 70%);
    color: var(--texto);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.cartao {
    width: 100%;
    max-width: 30rem;
    padding: 2rem;
    background: var(--cartao);
    border: 1px solid var(--borda);
    border-radius: 16px;
    box-shadow: var(--sombra);
}

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

.cabecalho {
    display: flex;
    align-items: center;
    gap: .875rem;
    margin-bottom: 1.75rem;
}

.marca {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    padding: .5rem;
    border-radius: 12px;
    background: var(--destaque-fundo);
    color: var(--destaque);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.marca-cruz { stroke-width: 2; }

h1 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.subtitulo {
    margin: 0;
    font-size: .875rem;
    color: var(--texto-suave);
}

/* ------------------------------------------------------- ultimo acessado */

.ultimo {
    margin-bottom: 1.5rem;
    padding: .875rem 1rem;
    background: var(--destaque-fundo);
    border: 1px solid var(--borda);
    border-radius: 12px;
}

.ultimo[hidden] { display: none; }

.ultimo-rotulo {
    margin: 0 0 .5rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texto-suave);
}

.ultimo-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--destaque-forte);
    text-decoration: none;
}

.ultimo-link:hover .ultimo-nome,
.ultimo-link:focus-visible .ultimo-nome { text-decoration: underline; }

.ultimo-link .seta { transition: transform .15s ease; }
.ultimo-link:hover .seta { transform: translateX(3px); }

.ultimo-esquecer {
    margin-top: .625rem;
    padding: 0;
    font: inherit;
    font-size: .8125rem;
    color: var(--texto-suave);
    background: none;
    border: 0;
    cursor: pointer;
    text-decoration: underline;
}

.ultimo-esquecer:hover { color: var(--texto); }

/* ------------------------------------------------------------------- campo */

label {
    display: block;
    margin-bottom: .5rem;
    font-size: .875rem;
    font-weight: 600;
}

.campo-caixa {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: 0 .875rem;
    background: var(--fundo);
    border: 1px solid var(--borda-forte);
    border-radius: 10px;
}

/* Foco desenhado na caixa, nao no input: a moldura precisa envolver o icone. */
.campo-caixa:focus-within {
    border-color: var(--destaque);
    outline: 2px solid var(--destaque);
    outline-offset: 1px;
}

.campo-icone {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--texto-suave);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: .8125rem 0;
    font: inherit;
    color: var(--texto);
    background: none;
    border: 0;
    outline: none;
}

input::placeholder { color: var(--texto-suave); }

input:disabled { cursor: progress; }

/* --------------------------------------------------------------- resultados */

.resultados {
    list-style: none;
    margin: .75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    /* Oito resultados cabem; alem disso rola dentro da propria lista, sem
       empurrar o rodape para fora da tela em telefone. */
    max-height: 21rem;
    overflow-y: auto;
}

.resultados:empty { margin: 0; }

.opcao {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem .875rem;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--borda);
    border-radius: 10px;
    cursor: pointer;
}

/* Um estado visual so para mouse e teclado: a opcao ativa via seta e a mesma
   coisa que a opcao sob o cursor, e duas aparencias confundiriam. */
.opcao:hover,
.opcao.ativa {
    border-color: var(--destaque);
    background: var(--destaque-fundo);
}

.opcao:focus-visible {
    outline: 2px solid var(--destaque);
    outline-offset: 1px;
}

.opcao-nome { font-weight: 500; }

/* Trecho que casou com o que foi digitado. <mark> traz fundo amarelo do
   navegador, que briga com a paleta -- por isso e neutralizado aqui. */
.opcao-nome mark {
    padding: 0;
    color: var(--realce);
    font-weight: 700;
    background: none;
}

.opcao-uf {
    flex-shrink: 0;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--texto-suave);
}

/* -------------------------------------------------------- dica / mensagens */

.dica,
.mensagem {
    margin: .75rem 0 0;
    font-size: .875rem;
    color: var(--texto-suave);
}

.dica[hidden],
.mensagem[hidden] { display: none; }

.mensagem.erro { color: #b91c1c; }

@media (prefers-color-scheme: dark) {
    .mensagem.erro { color: #fca5a5; }
}

/* -------------------------------------------------------- atalhos internos */

.atalhos {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--borda);
}

.atalhos[hidden] { display: none; }

.atalhos-titulo {
    margin: 0 0 .75rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texto-suave);
}

.atalhos-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

/* Menos peso visual que .opcao: sao acesso de bastidor, nao o caminho do
   municipio -- nao devem competir com a busca. */
.atalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .625rem .75rem;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
}

.atalho:hover,
.atalho:focus-visible {
    background: var(--destaque-fundo);
    outline: none;
}

.atalho:focus-visible { outline: 2px solid var(--destaque); outline-offset: 1px; }

.atalho-nome {
    font-size: .875rem;
    font-weight: 600;
}

.atalho-descricao {
    display: block;
    font-size: .75rem;
    font-weight: 400;
    color: var(--texto-suave);
}

.atalho .seta {
    flex-shrink: 0;
    color: var(--texto-suave);
    transition: transform .15s ease;
}

.atalho:hover .seta {
    color: var(--destaque);
    transform: translateX(3px);
}

/* ------------------------------------------------------------------ rodape */

.rodape {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--borda);
    font-size: .8125rem;
    color: var(--texto-suave);
}

/* ------------------------------------------------------------------ ajustes */

@media (max-width: 26rem) {
    body { padding: 16px 12px; }
    .cartao { padding: 1.5rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
