/* Portal do cliente: mobile-first, sem biblioteca de UI. Identidade do site institucional da JáCredita (tema "ardosia"):
   botão em ardósia, dourado só como destaque (progresso, foco, ponto do símbolo). Montserrat vem do Google Fonts (App.razor). */

/* ---------- Tokens da marca (mesmos nomes do site; iguais aos do portal-admin) ---------- */
:root {
    --brand: #334155;       /* ardósia: botões primários, símbolo, links */
    --brand-900: #1E293B;   /* ardósia escura */
    --brand-50: #F1F4F8;
    --brand-100: #E2E8F0;
    --on-brand: #FFFFFF;
    --accent: #D9A441;      /* dourado: SÓ destaque (progresso, foco, atenção). Nunca botão. */
    --accent-50: #FBF4E4;
    --accent-ink: #8A6212;  /* dourado para texto sobre fundo claro */
    --ink: #1E293B;         /* texto */
    --muted: #64748B;       /* texto secundário */
    --line: #E2E8F0;        /* bordas */
    --bg: #FFFFFF;          /* superfície */
    --alt: #F1F4F8;         /* fundo da página */
    --ok: #2F7D5B;          /* verde de sucesso */
    --ok-50: #E6F2EC;
    --perigo: #B42318;      /* erro */
    --perigo-50: #FDEBE9;
    --r: 14px;              /* raio de cartões */
    --r-controle: 10px;     /* raio de campos */
    --fonte: "Montserrat", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
/* Regras de uso: Montserrat em tudo (títulos 700 a 800, letter-spacing -.01em); valores em tabular-nums; cartões com borda
   1px --line e raio --r, sem sombra; botão principal --brand com texto --on-brand; foco visível com outline --accent;
   progresso e etapas em --accent. */

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--fonte);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--alt);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; margin-top: .5rem; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration-color: var(--accent); text-underline-offset: 3px; }
code { font-size: .85em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Estrutura: cabeçalho branco com o símbolo, como no site */
.topo { background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line); }
.topo-conteudo {
    max-width: 560px; margin: 0 auto; padding: .8rem 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.marca { display: inline-flex; align-items: center; gap: 9px; font-size: 1.1rem; font-weight: 700; line-height: 1; letter-spacing: -.01em; color: var(--ink); }
.marca svg { flex-shrink: 0; }
.topo-produto { font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: .16em; text-transform: uppercase; text-align: right; }

.conteudo { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 1rem; }

.rodape { text-align: center; font-size: .8rem; color: var(--muted); padding: 1rem 1rem 1.5rem; }
.rodape p { margin: 0; display: inline-flex; align-items: center; gap: .4rem; }
.rodape svg { flex-shrink: 0; }

.cartao {
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
    padding: 1.25rem; margin-bottom: 1rem;
}
.centro { text-align: center; }
.suave { color: var(--muted); }
.pequeno { font-size: .85rem; }

/* Formulários */
.formulario { display: block; }
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; flex: 1; min-width: 0; }
.campo label { font-weight: 600; font-size: .95rem; }
.linha { display: flex; gap: .75rem; }
.linha > .campo { flex: 1; }
.linha-conta > .campo:last-child { flex: 0 0 4.5rem; }
@media (max-width: 380px) { .linha:not(.linha-conta) { flex-direction: column; gap: 0; } }

input[type=text], input[type=tel], input[type=email], input:not([type]), select {
    width: 100%; min-height: 48px; padding: .65rem .8rem;
    font: inherit; font-size: 1rem; color: var(--ink);
    background: var(--bg); border: 1px solid #CBD5E1; border-radius: var(--r-controle);
    appearance: none; -webkit-appearance: none;
}
select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem;
}
input:focus, select:focus, summary:focus-visible, .botao:focus-visible {
    outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--brand);
}
.campo-erro input, .campo-erro select { border-color: var(--perigo); background: var(--perigo-50); }
.ajuda { color: var(--muted); font-size: .8rem; }
.mensagem-erro { color: var(--perigo); font-size: .85rem; font-weight: 600; }

/* Botões grandes */
.botao {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    width: 100%; min-height: 52px; padding: .8rem 1rem; margin-top: .5rem;
    font: inherit; font-size: 1.02rem; font-weight: 700; text-decoration: none; text-align: center;
    color: var(--on-brand); background: var(--brand); border: 2px solid var(--brand); border-radius: 12px;
    cursor: pointer; transition: background-color .15s, border-color .15s;
}
.botao:hover { background: var(--brand-900); border-color: var(--brand-900); }
.botao:disabled { opacity: .6; cursor: progress; }
.botao-secundario { color: var(--brand); background: var(--bg); border-color: var(--line); }
.botao-secundario:hover { background: var(--alt); border-color: var(--line); }
.link { display: block; text-align: center; margin-top: .75rem; font-weight: 600; }

/* Alertas */
.alerta { border-radius: var(--r-controle); padding: .75rem .9rem; margin: .75rem 0; font-size: .95rem; }
.alerta-erro { color: var(--perigo); background: var(--perigo-50); border: 1px solid #F4B7B0; }
.alerta-info { color: var(--ink); background: var(--accent-50); border: 1px solid var(--accent); }

/* Documentos legais */
.documento { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .75rem; overflow: hidden; }
.documento details summary {
    cursor: pointer; padding: .8rem .9rem; font-weight: 600; list-style: none;
    display: flex; justify-content: space-between; align-items: center; gap: .5rem;
}
.documento details summary::-webkit-details-marker { display: none; }
.documento details summary::after { content: "Ler"; font-size: .85rem; color: var(--brand); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.documento details[open] summary::after { content: "Fechar"; }
.texto-legal { max-height: 50vh; overflow-y: auto; padding: 0 .9rem .5rem; font-size: .9rem; color: var(--muted); }
.texto-legal h3 { color: var(--ink); margin-top: .75rem; }
.texto-legal ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.aceite {
    display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .9rem;
    background: var(--alt); border-top: 1px solid var(--line); cursor: pointer; font-size: .95rem;
}
.aceite input { width: 22px; height: 22px; margin: 0; flex: 0 0 22px; accent-color: var(--brand); }

/* Resumo da proposta */
.destaque {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: 1rem; margin: 1rem 0;
    background: var(--bg); border: 1px solid var(--line); border-radius: 18px; color: var(--muted); font-size: .9rem;
    box-shadow: inset 0 -3px 0 var(--accent);
}
.destaque strong { font-size: 2rem; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.resumo { margin: 0 0 .75rem; text-align: left; }
.resumo > div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.resumo > div:last-child { border-bottom: 0; }
.resumo dt { color: var(--muted); }
.resumo dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.resumo small { display: block; font-weight: 400; color: var(--muted); }
.acoes-pdf { margin-top: 1rem; }
.aviso-selfie { font-size: .9rem; color: var(--muted); background: var(--alt); border-radius: var(--r-controle); padding: .75rem .9rem; }
.aviso { font-size: .92rem; color: var(--ink); background: var(--accent-50); border-left: 3px solid var(--accent); border-radius: var(--r-controle); padding: .75rem .9rem; text-align: left; }

/* Estados */
.icone-grande {
    width: 64px; height: 64px; margin: .25rem auto 1rem; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 700; color: var(--brand); background: var(--brand-50);
}
.icone-grande.sucesso { color: #fff; background: var(--ok); }
.carregando {
    width: 44px; height: 44px; margin: .5rem auto 1rem; border-radius: 50%;
    border: 4px solid var(--brand-100); border-top-color: var(--accent);
    animation: girar .9s linear infinite;
}
.carregando-pequeno { width: 20px; height: 20px; margin: 0; border-width: 3px; border-color: rgba(255, 255, 255, .35); border-top-color: var(--accent); }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .carregando { animation-duration: 3s; } }

/* Erro do Blazor */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    padding: .8rem 1rem; background: var(--accent-50); border-top: 1px solid var(--accent);
}
#blazor-error-ui .dismiss { position: absolute; right: 1rem; top: .5rem; cursor: pointer; font-size: 1.3rem; }
