/* RH Senior — Relatórios. Identidade do PCCS: azul #4581bf, amarelo #fdbe2d, laranja #ff8300, Poppins.
   Sem estilos inline: a CSP da aplicação só aceita este arquivo. */

@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('../fonts/poppins-v5-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('../fonts/poppins-v5-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('../fonts/poppins-v5-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-display: swap; src: url('../fonts/poppins-v5-latin-700.woff2') format('woff2'); }

:root {
    --azul: #4581bf;
    --azul-escuro: #34689e;
    --azul-fundo: #eaf1f9;
    --amarelo: #fdbe2d;
    --laranja: #ff8300;
    --texto: #1f2937;
    --texto-2: #5b6675;
    --borda: #d9e1ea;
    --fundo: #f4f7fb;
    --branco: #fff;
    --erro: #c5221f;
    --erro-fundo: #fdecea;
    --ok: #1e7b45;
    --ok-fundo: #e6f4ea;
    --aviso: #8a5300;
    --aviso-fundo: #fff4e0;
    --raio: 10px;
    --sombra: 0 1px 2px rgba(16, 38, 66, .06), 0 4px 16px rgba(16, 38, 66, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: 'Poppins', system-ui, sans-serif; font-size: 15px; line-height: 1.5;
    color: var(--texto); background: var(--fundo);
}
a { color: var(--azul); }
a:hover { color: var(--azul-escuro); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
[hidden] { display: none !important; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Formulários ────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
    width: 100%; height: 46px; padding: 0 14px; font: inherit; font-size: 16px; /* 16px: iOS não dá zoom */
    color: var(--texto); background: var(--branco); border: 1px solid var(--borda); border-radius: 8px;
    transition: border-color .12s, box-shadow .12s;
}
input[type=file] { width: 100%; font: inherit; font-size: 14px; padding: 10px; border: 1px dashed var(--borda); border-radius: 8px; background: var(--branco); }
input:focus, select:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(69, 129, 191, .25); }
.campo { margin-bottom: 16px; }
.campo--erro input { border-color: var(--erro); }
.campo__ajuda { margin: 6px 0 0; font-size: 12.5px; color: var(--texto-2); }
.campo__erro { margin: 6px 0 0; font-size: 13px; color: var(--erro); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--azul); }

.senha { position: relative; }
.senha input { padding-right: 52px; }
.senha__ver {
    position: absolute; right: 4px; top: 4px; height: 38px; padding: 0 10px; border: 0; background: none;
    font: inherit; font-size: 12.5px; font-weight: 600; color: var(--azul); cursor: pointer; border-radius: 6px;
}
.senha__ver:hover { background: var(--azul-fundo); }

/* ── Botões ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
    padding: 0 18px; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
    color: var(--branco); background: var(--azul); border: 1px solid var(--azul); border-radius: 8px; cursor: pointer;
    transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--azul-escuro); border-color: var(--azul-escuro); color: var(--branco); }
.btn:focus-visible { outline: 3px solid rgba(69, 129, 191, .45); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn--bloco { width: 100%; min-height: 48px; font-size: 15px; }
.btn--sec { color: var(--azul); background: var(--branco); border-color: var(--borda); }
.btn--sec:hover { color: var(--azul-escuro); background: var(--azul-fundo); border-color: var(--azul); }
.btn--perigo { color: var(--erro); background: var(--branco); border-color: #f0c4c2; }
.btn--perigo:hover { color: var(--branco); background: var(--erro); border-color: var(--erro); }
.btn--peq { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--link { min-height: 0; padding: 0; background: none; border: 0; color: var(--azul); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.btn--link:hover { background: none; color: var(--azul-escuro); }

/* ── Mensagens ──────────────────────────────────────────────────────────── */
.msg { padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; }
.msg--ok { color: var(--ok); background: var(--ok-fundo); border-color: #bfe3cb; }
.msg--erro { color: var(--erro); background: var(--erro-fundo); border-color: #f5c6c3; }
.msg--aviso { color: var(--aviso); background: var(--aviso-fundo); border-color: #f6d9a6; }
.msg ul { margin: 0; padding-left: 18px; }

/* ── Tela de login (auth) ───────────────────────────────────────────────── */
.auth {
    min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
    background:
        radial-gradient(1200px 500px at 110% -10%, rgba(253, 190, 45, .22), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(69, 129, 191, .20), transparent 60%),
        var(--fundo);
}
.auth__caixa { width: 100%; max-width: 420px; }
.auth__cartao { background: var(--branco); border-radius: 14px; box-shadow: var(--sombra); padding: 32px 28px; border-top: 4px solid var(--azul); }
.auth__logo { display: block; width: 92px; height: 92px; margin: 0 auto 14px; }
.auth__titulo { font-size: 21px; font-weight: 700; text-align: center; color: #0f1d2e; }
.auth__sub { margin: 6px 0 24px; text-align: center; color: var(--texto-2); font-size: 14px; }
.auth__rodape { margin-top: 18px; text-align: center; font-size: 12.5px; color: var(--texto-2); }
.auth__seguro { display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth__seguro svg { width: 14px; height: 14px; color: var(--ok); }
.auth__alt { margin-top: 16px; text-align: center; font-size: 14px; color: var(--texto-2); }

.codigo {
    width: 100%; height: 64px; text-align: center; font: inherit; font-size: 32px; font-weight: 700;
    letter-spacing: .45em; text-indent: .45em; font-variant-numeric: tabular-nums;
    border: 1px solid var(--borda); border-radius: 10px; background: var(--branco); color: var(--texto);
}
.codigo:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(69, 129, 191, .25); }
.codigo::placeholder { color: #c6d0dc; letter-spacing: .45em; }
.codigo-info { margin: 10px 0 18px; text-align: center; font-size: 13px; color: var(--texto-2); }
.icone-circulo {
    display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin: 0 auto 14px;
    border-radius: 50%; background: var(--azul-fundo); color: var(--azul);
}
.icone-circulo svg { width: 26px; height: 26px; }
.reenviar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin-top: 18px; font-size: 14px; color: var(--texto-2); }
.reenviar .btn--link { color: var(--laranja); font-size: 14px; }
.reenviar .btn--link:hover { color: #d96f00; }

.regras { margin: 0 0 18px; padding: 12px 14px; list-style: none; background: var(--fundo); border-radius: 8px; font-size: 13px; color: var(--texto-2); }
.regras li { padding: 2px 0 2px 22px; position: relative; }
.regras li::before { content: ''; position: absolute; left: 4px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: #c6d0dc; }
.regras li.ok { color: var(--ok); }
.regras li.ok::before { background: var(--ok); }

/* ── Painel (admin) ─────────────────────────────────────────────────────── */
.topo { background: var(--branco); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 10; }
.topo__in { max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 64px; display: flex; align-items: center; gap: 24px; }
.topo__marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texto); flex-shrink: 0; }
.topo__marca img { width: 38px; height: 38px; }
.topo__marca span { font-weight: 700; font-size: 15px; line-height: 1.1; }
.topo__marca small { display: block; font-weight: 500; font-size: 11.5px; color: var(--texto-2); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--texto-2); }
.nav a:hover { background: var(--fundo); color: var(--texto); }
.nav a.ativo { color: var(--azul); background: var(--azul-fundo); }
.topo__user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--texto-2); }
.topo__user form { margin: 0; }
.topo__menu-btn { display: none; }

.pagina { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; }
.cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.cab h1 { font-size: 24px; font-weight: 700; }
.cab__sub { margin: 4px 0 0; color: var(--texto-2); font-size: 14px; }
.cab__acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.voltar { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13px; text-decoration: none; color: var(--texto-2); }
.voltar:hover { color: var(--azul); }

.cartao { background: var(--branco); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); }
.cartao + .cartao { margin-top: 20px; }
.cartao__cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--borda); }
.cartao__cab h2 { font-size: 16px; font-weight: 700; }
.cartao__cab p { margin: 2px 0 0; font-size: 13px; color: var(--texto-2); }
.cartao__corpo { padding: 20px; }
.cartao__rodape { padding: 14px 20px; border-top: 1px solid var(--borda); background: #fafcfe; border-radius: 0 0 var(--raio) var(--raio); }

.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-estreito { max-width: 640px; }
.acoes-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

.tabela-wrap { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); padding: 10px 16px; background: #fafcfe; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.tabela td { padding: 12px 16px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover td { background: #fbfcfe; }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela .acoes { text-align: right; white-space: nowrap; }
.tabela .acoes > * { margin-left: 4px; }
.tabela a.nome { font-weight: 600; text-decoration: none; color: var(--texto); }
.tabela a.nome:hover { color: var(--azul); }
.tabela .sub { display: block; font-size: 12.5px; color: var(--texto-2); }
.tabela form { display: inline; }

.vazio { padding: 36px 20px; text-align: center; color: var(--texto-2); font-size: 14px; }

.selo { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.selo::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.selo--ok { color: var(--ok); background: var(--ok-fundo); }
.selo--off { color: #5b6675; background: #eef1f5; }
.selo--aviso { color: var(--aviso); background: var(--aviso-fundo); }
.selo--erro { color: var(--erro); background: var(--erro-fundo); }

.busca { display: flex; gap: 8px; }
.busca input { max-width: 320px; height: 42px; }

.menu-acoes { position: relative; display: inline-block; }
.menu-acoes > summary { list-style: none; }
.menu-acoes > summary::-webkit-details-marker { display: none; }
.menu-acoes__lista {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 220px; padding: 6px;
    background: var(--branco); border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 38, 66, .14); text-align: left;
}
.menu-acoes__lista form { display: block; margin: 0; }
.menu-acoes__lista a, .menu-acoes__lista button {
    display: block; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px;
    font: inherit; font-size: 13.5px; color: var(--texto); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-acoes__lista a:hover, .menu-acoes__lista button:hover { background: var(--fundo); }
.menu-acoes__lista .perigo { color: var(--erro); }
.menu-acoes__lista hr { border: 0; border-top: 1px solid var(--borda); margin: 4px 0; }

.paginacao { display: flex; justify-content: center; gap: 4px; padding: 16px; flex-wrap: wrap; }
.paginacao a, .paginacao span { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 8px; font-size: 14px; text-decoration: none; border: 1px solid var(--borda); background: var(--branco); color: var(--texto); }
.paginacao .atual { background: var(--azul); border-color: var(--azul); color: var(--branco); }
.paginacao .off { color: #b5bfcb; }

.zona-perigo { border-color: #f3cfcd; }
.zona-perigo .cartao__cab h2 { color: var(--erro); }

.filtros { display: flex; justify-content: flex-start !important; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filtros > div { min-width: 200px; }
.filtros select { height: 42px; }
.muted { color: var(--texto-2); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }

/* ── Cliente: lista de relatórios ───────────────────────────────────────── */
.lista-rel { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.rel {
    display: flex; gap: 14px; align-items: center; padding: 18px; text-decoration: none; color: var(--texto);
    background: var(--branco); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra);
    transition: border-color .12s, transform .12s;
}
.rel:hover { border-color: var(--azul); transform: translateY(-1px); color: var(--texto); }
.rel__icone { flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--azul-fundo); color: var(--azul); }
.rel__icone svg { width: 22px; height: 22px; }
.rel strong { display: block; font-size: 15px; }
.rel small { color: var(--texto-2); font-size: 12.5px; }

/* ── Cliente: visualizador (HTML em tela cheia) ─────────────────────────── */
.visor { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--branco); }
.visor__barra {
    flex: 0 0 40px; display: flex; align-items: center; gap: 12px; padding: 0 12px;
    background: #0f2236; color: #dce6f1; font-size: 13px;
}
.visor__barra img { width: 24px; height: 24px; border-radius: 4px; background: var(--branco); }
.visor__titulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--branco); }
.visor__barra a, .visor__barra button {
    display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .18);
    background: transparent; color: #dce6f1; font: inherit; font-size: 12.5px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.visor__barra a:hover, .visor__barra button:hover { background: rgba(255, 255, 255, .1); color: var(--branco); }
.visor__barra form { margin: 0; }
.visor__previa { padding: 2px 8px; border-radius: 4px; background: var(--amarelo); color: #3b2a00; font-size: 11.5px; font-weight: 700; }
.visor__frame { flex: 1; width: 100%; border: 0; display: block; }

/* ── Celular ────────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
    .topo__in { height: 58px; gap: 12px; }
    .topo__marca small { display: none; }
    .topo__menu-btn { display: inline-flex; margin-left: auto; }
    .nav, .topo__user { display: none; }
    .topo.aberto .nav, .topo.aberto .topo__user {
        display: flex; flex-direction: column; align-items: stretch; position: absolute; left: 0; right: 0;
        background: var(--branco); padding: 8px 16px; border-bottom: 1px solid var(--borda);
    }
    .topo.aberto .nav { top: 58px; }
    .topo.aberto .topo__user { top: calc(58px + 3 * 40px + 16px); flex-direction: row; justify-content: space-between; box-shadow: 0 8px 16px rgba(16, 38, 66, .08); }
    .pagina { padding-top: 20px; }
    .cab h1 { font-size: 21px; }
    .grade-2 { grid-template-columns: 1fr; }
    .busca input { max-width: none; }
    .busca { width: 100%; }
    .filtros > div { min-width: 0; flex: 1 1 100%; }

    /* Tabelas viram cartões */
    .tabela-wrap { overflow: visible; }
    table.tabela, .tabela tbody, .tabela tr, .tabela td { display: block; width: 100%; }
    .tabela thead { display: none; }
    .tabela tr { padding: 12px 16px; border-bottom: 1px solid #edf1f5; }
    .tabela tr:last-child { border-bottom: 0; }
    .tabela td { padding: 3px 0; border: 0; }
    .tabela td[data-rot]::before { content: attr(data-rot) ': '; font-size: 12px; color: var(--texto-2); }
    .tabela .num, .tabela .acoes { text-align: left; }
    .tabela .acoes { padding-top: 8px; }
    .tabela .acoes > *:first-child { margin-left: 0; }
    .menu-acoes__lista { left: 0; right: auto; }
}
@media (max-width: 480px) {
    .auth__cartao { padding: 26px 20px; }
    .visor__barra { gap: 8px; padding: 0 8px; }
    .visor__barra .some-cel { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
