/* Relojinho: tokens e peças comuns. Todas as páginas carregam este arquivo.
   Os tokens --rj-* abaixo (contrato §9) são os únicos nomes que o painel usa.
   Peças com classe levam o prefixo rj-, para não esbarrar nas classes de cada página.
   Sem fonte externa, sem CDN. */

:root {
    --rj-bg: #F6F3EC;
    --rj-surface: #FFFFFF;
    --rj-ink: #1F1D1A;
    --rj-muted: #6B665E;
    --rj-line: #E3DDD0;
    --rj-brand: #1F4D3F;
    --rj-brand-ink: #FFFFFF;
    --rj-accent: #E2492F;
    --rj-ok: #2E7D4F;
    --rj-warn: #9A5F0D;
    --rj-danger: #B3261E;
    --rj-radius: 12px;
    --rj-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Extras (fora do contrato): títulos de página e números de hora. */
    --rj-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --rj-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    color-scheme: light;
}

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

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

body {
    margin: 0;
    font: 400 1rem/1.5 var(--rj-font);
    color: var(--rj-ink);
    background: var(--rj-bg);
    -webkit-font-smoothing: antialiased;
}

:where(h1, h2, h3, h4, p, ul, ol, figure) { margin: 0; }
:where(h1, h2, h3, h4) { line-height: 1.15; text-wrap: balance; }
:where(img, svg, video, canvas) { max-width: 100%; }
:where(a) { color: var(--rj-brand); text-underline-offset: 0.18em; }
:where(a:hover) { color: var(--rj-ink); }

[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid var(--rj-brand);   /* foco na cor da marca: vermelho parece erro */
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- botões ---------- */
.rj-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.6rem 1.35rem;
    font: 700 1rem/1.2 var(--rj-font);
    text-decoration: none;
    text-align: center;
    color: var(--rj-brand-ink);
    background: var(--rj-brand);
    border: 2px solid var(--rj-brand);
    border-radius: var(--rj-radius);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.rj-btn:hover { background: #163a30; border-color: #163a30; color: var(--rj-brand-ink); }
.rj-btn:active { transform: translateY(1px); }
.rj-btn:disabled, .rj-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.rj-btn--sec { color: var(--rj-brand); background: var(--rj-surface); }
.rj-btn--sec:hover { color: var(--rj-brand); background: var(--rj-bg); border-color: var(--rj-brand); }
.rj-btn--perigo { background: var(--rj-danger); border-color: var(--rj-danger); }
.rj-btn--perigo:hover { background: #8f1d17; border-color: #8f1d17; }
.rj-btn--txt { color: var(--rj-brand); background: none; border-color: transparent; }
.rj-btn--txt:hover { color: var(--rj-ink); background: var(--rj-line); border-color: transparent; }
.rj-btn--txt:disabled { opacity: 1; color: var(--rj-muted); }   /* "Reenviar código em 27s": a contagem tem que ler */
/* Pequeno só no visual: o alvo de toque continua de 44px no celular e aperta no desktop (mouse). */
.rj-btn--sm { min-height: 44px; padding: 0.3rem 0.85rem; font-size: 0.9rem; }
@media (min-width: 769px) and (pointer: fine) { .rj-btn--sm { min-height: 36px; } }
.rj-btn--block { display: flex; width: 100%; }

/* ---------- campos ---------- */
.rj-campo { display: block; margin-bottom: 1rem; }
.rj-campo > label { display: block; margin-bottom: 0.35rem; font-weight: 600; }
.rj-campo .rj-opcional { font-weight: 400; color: var(--rj-muted); }

.rj-campo :is(input:not([type="checkbox"], [type="radio"]), select, textarea) {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.6rem 0.8rem;
    font: inherit;
    color: var(--rj-ink);
    background-color: var(--rj-surface);   /* só a cor: o shorthand apagaria a seta do select abaixo */
    border: 1.5px solid #8C8575;   /* 3,67:1 no branco (limite de componente, WCAG 1.4.11) */
    border-radius: var(--rj-radius);
    appearance: none;
    -webkit-appearance: none;
}
.rj-campo select {
    padding-right: 2.2rem;
    background: var(--rj-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%231F1D1A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.85rem center;
}
@media (forced-colors: active) { .rj-campo select { appearance: auto !important; background-image: none; } }   /* a seta em url() some no alto contraste; !important: o :is() acima pesa mais e manteria appearance: none */
.rj-campo :is(input, select, textarea):hover { border-color: var(--rj-muted); }
.rj-campo :is(input, select, textarea):focus {
    outline: 3px solid color-mix(in srgb, var(--rj-brand) 35%, transparent);
    outline-offset: 0;
    border-color: var(--rj-brand);
}
.rj-campo :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--rj-danger); }   /* depois do hover/foco, com a mesma especificidade: vence por ordem */
.rj-campo ::placeholder { color: #767066; }
.rj-ajuda { margin-top: 0.3rem; font-size: 0.875rem; color: var(--rj-muted); }
.rj-erro-campo { margin-top: 0.3rem; font-size: 0.875rem; font-weight: 600; color: var(--rj-danger); }

/* O código de 6 dígitos (entrar e cadastro): grande, centrado, números separados. */
.rj-campo input.rj-codigo {
    font: 700 clamp(1.9rem, 9vw, 2.3rem)/1 var(--rj-mono);
    letter-spacing: 0.35em;
    text-align: center;
    text-indent: 0.35em;   /* o espaço depois do último número desloca o texto: isto devolve o centro */
    min-height: 64px;
}

/* Caixa de marcar: o alvo de toque inclui o texto. */
.rj-marcar { display: flex; gap: 0.7rem; align-items: flex-start; min-height: 44px; margin-bottom: 1rem; cursor: pointer; }
.rj-marcar input { flex: none; width: 1.4rem; height: 1.4rem; margin: 0.1rem 0 0; accent-color: var(--rj-brand); }

/* ---------- cartão e avisos ---------- */
.rj-cartao {
    background: var(--rj-surface);
    border: 1px solid var(--rj-line);
    border-radius: calc(var(--rj-radius) + 4px);
    padding: clamp(1.1rem, 4vw, 1.75rem);
}

.rj-aviso {
    padding: 0.75rem 1rem;
    border-radius: var(--rj-radius);
    border: 1px solid var(--rj-line);
    background: var(--rj-bg);
    font-size: 0.95rem;
}
.rj-aviso--erro { color: #7d1812; background: #FBEAE8; border-color: #EBB9B4; }
.rj-aviso--ok { color: #1d5535; background: #E6F2EA; border-color: #B3D6C0; }

/* ---------- peças pequenas ---------- */
.rj-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Página de conta (cadastro, entrar): caixa estreita no meio. */
.rj-auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: clamp(1.25rem, 5vh, 3rem) 1rem 2rem; }
.rj-auth__logo { display: flex; align-items: center; min-height: 44px; margin: 0 0 1.25rem; }
.rj-auth__logo img { display: block; flex-shrink: 0; height: 34px; width: 123px; min-width: 123px; }
.rj-auth__caixa { width: 100%; max-width: 460px; }
.rj-auth h1 { font: 700 clamp(1.7rem, 6vw, 2.15rem)/1.12 var(--rj-display); letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.rj-auth .rj-sub { color: var(--rj-muted); margin-bottom: 1.4rem; overflow-wrap: anywhere; }   /* e-mail comprido no texto não estoura o celular */
.rj-auth .rj-rodape { margin-top: 1.25rem; text-align: center; color: var(--rj-muted); font-size: 0.95rem; }
.rj-auth .rj-rodape a { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.rj-auth .rj-aviso { margin-bottom: 1rem; overflow-wrap: anywhere; }
.rj-auth .rj-aviso a { color: inherit; font-weight: 700; }
.rj-auth .rj-aviso a.rj-btn { color: var(--rj-brand-ink); }

/* ---------- aviso de cookies (assets/analytics.js, só nas páginas públicas) ---------- */
.rj-com-cookiebar { padding-bottom: var(--rj-cookie-h, 0px); }   /* o aviso nunca cobre o fim da página */
.rj-cookiebar {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 44rem;
    margin-left: auto;
    padding: 0.5rem 0.65rem;
    color: #E9E4D6;
    background: var(--rj-ink);
    border: 1px solid #4a463f;
    border-radius: var(--rj-radius);
    box-shadow: 0 8px 28px rgb(31 29 26 / 0.35);
}
.rj-cookiebar:focus { outline: none; }
.rj-cookiebar:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rj-cookiebar p { font-size: 0.8125rem; line-height: 1.35; }
.rj-cookiebar p a { display: inline-block; margin: -0.35rem 0; padding: 0.35rem 0.25rem; color: #fff; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }   /* a área de toque passa de 24 px sem aumentar o aviso (a margem negativa compensa o padding) */
.rj-cookiebar p a:hover { color: #EF6A52; }
.rj-cookiebar__acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.rj-cookiebar__btn {
    min-height: 44px;
    padding: 0.4rem 1rem;
    font: 700 0.95rem/1.2 var(--rj-font);
    color: #fff;
    background: none;
    border: 1.5px solid #A39B8A;
    border-radius: calc(var(--rj-radius) - 2px);
    cursor: pointer;
}
.rj-cookiebar__btn:hover { background: #2c2a26; }
.rj-cookiebar :focus-visible { outline-color: #fff; }
@media (min-width: 641px) {
    .rj-cookiebar { left: auto; right: 1.25rem; bottom: 1.25rem; flex-direction: row; align-items: center; gap: 1rem; padding: 0.6rem 0.9rem; }
    .rj-cookiebar p { flex: 1; }
    .rj-cookiebar__acoes { grid-template-columns: auto auto; }
}

/* Botão com cara de link (o "Cookies" do rodapé das páginas públicas). */
.rj-cookies {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0;
    font: inherit;
    color: var(--rj-brand);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    background: none;
    border: 0;
    cursor: pointer;
}
.rj-cookies:hover { color: var(--rj-ink); }

/* A escolha da conta no /entrar/: um botão grande por conta (celular primeiro). */
.rj-contas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.rj-conta-opcao {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    min-height: 56px;
    padding: 0.7rem 1rem;
    font: inherit;
    text-align: left;
    color: var(--rj-ink);
    background: var(--rj-surface);
    border: 2px solid var(--rj-line);
    border-radius: var(--rj-radius);
    cursor: pointer;
}
.rj-conta-opcao:hover:not(:disabled) { border-color: var(--rj-brand); }
.rj-conta-opcao:disabled { opacity: 0.55; cursor: not-allowed; }
.rj-conta-nome { font-weight: 700; overflow-wrap: anywhere; }
.rj-conta-papel { font-size: 0.875rem; color: var(--rj-muted); }

/* Os convites pendentes no /entrar/: um cartão por convite, com Aceitar e Recusar lado a lado (cabem em 375 px). */
.rj-convites { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.rj-convite {
    display: grid;
    gap: 0.35rem;
    padding: 0.85rem 1rem;
    background: var(--rj-surface);
    border: 2px solid var(--rj-line);
    border-radius: var(--rj-radius);
}
.rj-convite p { margin: 0; overflow-wrap: anywhere; }
.rj-convite small { font-size: 0.875rem; color: var(--rj-muted); }
.rj-convite__acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.4rem; }
