:root {
  --bg: #f5f6fa;
  --superficie: #ffffff;
  --superficie-2: #f0f2f8;
  --borda: #e3e6ef;
  --texto: #1b2033;
  --texto-2: #5b6380;
  --marca: #4f46e5;
  --marca-2: #eef0ff;
  --ok: #138a5b;
  --ok-bg: #e4f6ee;
  --erro: #c93a3a;
  --erro-bg: #fdeaea;
  --aviso: #a8650a;
  --aviso-bg: #fff3df;
  --info: #1d6fb8;
  --info-bg: #e5f1fb;
  --prov: #4f46e5;
  --desc: #e08a2e;
  --sombra: 0 1px 2px rgba(20, 24, 50, .05), 0 4px 16px rgba(20, 24, 50, .06);
  --raio: 12px;
  --lateral: 244px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --bg: #0f1220; --superficie: #171b2e; --superficie-2: #1f2438; --borda: #2a3050;
    --texto: #e8eaf6; --texto-2: #98a1c4; --marca: #8b84ff; --marca-2: #262a52;
    --ok: #4cd29a; --ok-bg: #12332a; --erro: #ff7b7b; --erro-bg: #3a1c24;
    --aviso: #f0b45a; --aviso-bg: #3a2c14; --info: #6db8ff; --info-bg: #14283c;
    --prov: #8b84ff; --desc: #f0a14d; --sombra: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--texto); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.muted { color: var(--texto-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- marca / login ---- */
.marca { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 500; }
.marca b { color: var(--marca); font-weight: 700; }
.marca-logo { width: 30px; height: 30px; border-radius: 9px; background: var(--marca); position: relative; flex: none; }
.marca-logo::after { content: ""; position: absolute; inset: 7px; border: solid #fff; border-width: 0 0 3px 3px; transform: skewX(-20deg) scaleY(.7); border-radius: 2px; }
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 70% -10%, var(--marca-2), transparent), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--superficie); border: 1px solid var(--borda); border-radius: 16px; padding: 28px; box-shadow: var(--sombra); display: grid; gap: 14px; }
.login-card label, .form label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--texto-2); }

input, select { font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borda); border-radius: 9px; padding: 8px 11px; min-height: 36px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: var(--marca); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marca) 22%, transparent); }
.erro { color: var(--erro); font-size: 13px; min-height: 18px; }

.btn { font: inherit; font-weight: 600; border-radius: 9px; border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); padding: 8px 14px; min-height: 36px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--superficie-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--marca); border-color: var(--marca); color: #fff; }
.btn.primario:hover { filter: brightness(1.08); background: var(--marca); }
.btn.fantasma { border-color: transparent; background: transparent; color: var(--texto-2); }
.btn.fantasma:hover { background: var(--superficie-2); color: var(--texto); }
.btn.icone { padding: 0; width: 36px; justify-content: center; }
:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); min-height: 100%; }
.lateral { background: var(--superficie); border-right: 1px solid var(--borda); padding: 18px 12px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.lateral .marca { padding: 0 8px; }
#menu { display: grid; gap: 2px; align-content: start; flex: 1; overflow: auto; }
#menu .grupo { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-2); padding: 14px 10px 6px; }
#menu a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--texto-2); text-decoration: none; font-weight: 550; }
#menu a:hover { background: var(--superficie-2); color: var(--texto); }
#menu a.ativo { background: var(--marca-2); color: var(--marca); }
.lateral-rodape { padding: 0 8px; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.topo { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borda); }
.topo h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-filtros { display: flex; gap: 10px; flex-wrap: wrap; }
.campo-inline { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--texto-2); }
.campo-inline select { max-width: 230px; }
.menu-toggle { display: none; }
.conteudo { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; max-width: 1400px; width: 100%; margin: 0 auto; outline: none; }

/* ---- componentes ---- */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.card-corpo { padding: 18px; }
.grade { display: grid; gap: 14px; }
.grade.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grade.duas { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.kpi { padding: 16px 18px; display: grid; gap: 4px; }
.kpi .rotulo { font-size: 12px; font-weight: 600; color: var(--texto-2); }
.kpi .valor { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.delta.sobe { color: var(--ok); } .delta.desce { color: var(--erro); } .delta.neutro { color: var(--texto-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--superficie-2); color: var(--texto-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.erro { background: var(--erro-bg); color: var(--erro); }
.badge.aviso { background: var(--aviso-bg); color: var(--aviso); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.marca { background: var(--marca-2); color: var(--marca); }

.barra { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--borda); }
.busca { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.busca svg { position: absolute; left: 10px; top: 8px; width: 18px; height: 18px; color: var(--texto-2); }
.busca input { width: 100%; padding-left: 36px; }
.chips { display: inline-flex; background: var(--superficie-2); border-radius: 10px; padding: 3px; gap: 2px; }
.chips button { font: inherit; font-weight: 600; font-size: 13px; border: 0; background: transparent; color: var(--texto-2); padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.chips button.ativo { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.contagem { margin-left: auto; font-size: 12px; color: var(--texto-2); }

.tabela-wrap { overflow: auto; max-height: calc(100vh - 290px); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--borda); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--superficie); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--texto-2); cursor: default; user-select: none; z-index: 1; }
th.ord { cursor: pointer; } th.ord:hover { color: var(--texto); }
th .seta { display: inline-block; width: 10px; opacity: .8; }
th.num, td.num { text-align: right; }
tbody tr { transition: background .1s; }
tbody tr.clicavel { cursor: pointer; }
tbody tr.clicavel:hover { background: var(--superficie-2); }
tfoot td { font-weight: 700; background: var(--superficie-2); position: sticky; bottom: 0; }
td .sub { display: block; font-size: 12px; color: var(--texto-2); }
.vazio { padding: 48px 18px; text-align: center; color: var(--texto-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--marca-2); color: var(--marca); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; margin-right: 10px; vertical-align: middle; flex: none; }
.pessoa { display: flex; align-items: center; }
.pessoa .avatar { margin-right: 10px; }
.pessoa b { font-weight: 600; } .pessoa small { display: block; color: var(--texto-2); font-size: 12px; }

.skeleton { background: linear-gradient(90deg, var(--superficie-2), var(--borda), var(--superficie-2)); background-size: 200% 100%; animation: brilho 1.2s infinite; border-radius: 8px; height: 18px; }
@keyframes brilho { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- grafico ---- */
.grafico { width: 100%; height: 240px; display: block; }
.grafico rect, .grafico text { stroke: none; }
.grafico text { fill: var(--texto-2); font-size: 11px; font-family: inherit; }
.grafico .grade-h { stroke: var(--borda); stroke-width: 1; }
.grafico rect.barra-p { fill: var(--prov); } .grafico rect.barra-d { fill: var(--desc); }
.grafico g.col:hover rect.hover { fill: var(--superficie-2); }
.legenda { display: flex; gap: 16px; font-size: 12px; color: var(--texto-2); }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.dica { position: fixed; z-index: 90; pointer-events: none; background: var(--texto); color: var(--bg); padding: 8px 11px; border-radius: 8px; font-size: 12px; box-shadow: var(--sombra); }
.dica b { display: block; margin-bottom: 3px; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--borda); }
.lista li:last-child { border: 0; }
.lista a { color: inherit; text-decoration: none; font-weight: 550; } .lista a:hover { color: var(--marca); }

/* ---- detalhes (pares rotulo/valor) ---- */
.pares { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 22px; margin: 0; }
.pares div { min-width: 0; }
.pares dt { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--texto-2); }
.pares dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.pares dd.vazio-v { color: var(--texto-2); }

.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); padding: 0 18px; overflow-x: auto; }
.abas button { font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--texto-2); padding: 12px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.abas button:hover { color: var(--texto); }
.abas button.ativo { color: var(--marca); border-color: var(--marca); }

/* ---- drawer / modal ---- */
.fundo { position: fixed; inset: 0; background: rgba(10, 12, 28, .45); z-index: 50; animation: aparece .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); z-index: 60; box-shadow: -8px 0 30px rgba(0,0,0,.25); display: flex; flex-direction: column; animation: entra .2s ease-out; }
.drawer-cab { display: flex; gap: 14px; align-items: center; padding: 18px 20px; background: var(--superficie); border-bottom: 1px solid var(--borda); }
.drawer-cab .avatar { width: 48px; height: 48px; font-size: 17px; margin: 0; }
.drawer-cab h2 { font-size: 18px; } .drawer-cab .meta { flex: 1; min-width: 0; }
.drawer-corpo { overflow: auto; padding: 18px 20px 40px; display: grid; gap: 16px; align-content: start; flex: 1; }
.modal { position: fixed; z-index: 70; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--superficie); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: sobe .18s ease-out; }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--borda); }
.modal-corpo { padding: 18px 20px 22px; display: grid; gap: 16px; }
@keyframes aparece { from { opacity: 0; } }
@keyframes entra { from { transform: translateX(40px); opacity: 0; } }
@keyframes sobe { from { transform: translate(-50%, -46%); opacity: 0; } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--texto); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 99; box-shadow: var(--sombra); }

/* ---- holerite ---- */
.holerite { display: grid; gap: 14px; }
.holerite-grade { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.holerite td, .holerite th { white-space: normal; }
.holerite td.num, .holerite th.num { white-space: nowrap; }
.modal-corpo { min-width: 0; }
.modal { overflow-x: hidden; }
.holerite .card { overflow: hidden; }
.abas { scrollbar-width: none; }
.holerite table th, .holerite table td { padding: 7px 10px; }
.holerite .totais { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.holerite .totais div { background: var(--superficie-2); border-radius: 10px; padding: 10px 14px; }
.holerite .totais span { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); }
.holerite .totais b { font-size: 18px; font-variant-numeric: tabular-nums; }
.holerite .totais .liq b { color: var(--ok); }

/* ---- formularios de edicao ---- */
.cabecalho-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cabecalho-form-info { flex: 1; min-width: 220px; } .cabecalho-form-info h2 { font-size: 18px; }
.oculto { display: none; }
.form-corpo { padding: 16px 18px 90px; display: grid; gap: 12px; }
.grupo-form { border: 1px solid var(--borda); border-radius: 10px; background: var(--superficie); }
.grupo-form > summary { cursor: pointer; padding: 12px 14px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; user-select: none; }
.grupo-form > summary::-webkit-details-marker { display: none; }
.grupo-form > summary::before { content: "▸"; color: var(--texto-2); margin-right: 8px; transition: transform .15s; display: inline-block; }
.grupo-form[open] > summary::before { transform: rotate(90deg); }
.grupo-form > summary > span:first-child { flex: 1; }
.grupo-n { font-size: 11.5px; font-weight: 700; color: var(--texto-2); }
.grupo-n.ativo { color: var(--aviso); background: var(--aviso-bg); padding: 2px 9px; border-radius: 999px; }
.campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; padding: 4px 14px 16px; }
.campo { display: grid; gap: 4px; align-content: start; min-width: 0; }
.campo.largo { grid-column: 1 / -1; }
.campo label { font-size: 12px; font-weight: 600; color: var(--texto-2); }
.campo .req { color: var(--erro); margin-left: 3px; }
.campo input, .campo select, .campo textarea { width: 100%; }
.campo textarea { font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borda); border-radius: 9px; padding: 8px 11px; resize: vertical; }
.campo input:disabled, .campo select:disabled, .campo textarea:disabled { opacity: .65; cursor: not-allowed; }
.campo.invalido input, .campo.invalido select, .campo.invalido textarea { border-color: var(--erro); }
.erro-campo { color: var(--erro); font-size: 12px; min-height: 0; }
.campo-matricula { max-width: 260px; margin-bottom: 4px; }
.ac { position: relative; }
.ac-lista { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--superficie); border: 1px solid var(--borda); border-radius: 10px; box-shadow: var(--sombra); max-height: 240px; overflow: auto; }
.ac-lista li { padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.ac-lista li:hover { background: var(--marca-2); color: var(--marca); }
.ac-lista .vazio-li { color: var(--texto-2); cursor: default; } .ac-lista .vazio-li:hover { background: none; color: var(--texto-2); }
.barra-salvar { position: sticky; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: color-mix(in srgb, var(--superficie) 94%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra); }
.espaco { flex: 1; }
.modal-rodape { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
#modal .campos { padding: 0; }

/* ---- lancamentos ---- */
.faixa { padding: 11px 16px; border-radius: 10px; font-size: 13.5px; border: 1px solid transparent; }
.faixa.info { background: var(--info-bg); color: var(--info); }
.faixa.neutra { background: var(--superficie-2); color: var(--texto-2); border-color: var(--borda); }
.acoes { display: inline-flex; gap: 2px; }
.acoes .btn.icone { width: 32px; min-height: 32px; }
.dica-campo { color: var(--texto-2); font-size: 12px; }

.barra-vig { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

a.card-link { text-decoration: none; color: inherit; transition: transform .1s, border-color .15s; }
a.card-link:hover { border-color: var(--marca); transform: translateY(-1px); }
a.card-link p { margin: 6px 0 12px; }
.cab-impressao { padding: 10px 18px; font-size: 12.5px; color: var(--texto-2); border-bottom: 1px solid var(--borda); }
@media print {
  body.imp-rel * { visibility: visible; }
  body.imp-rel .lateral, body.imp-rel .topo, body.imp-rel .barra, body.imp-rel .no-print, body.imp-rel .toast { display: none !important; }
  body.imp-rel .app { display: block; }
  body.imp-rel .conteudo { padding: 0; max-width: none; }
  body.imp-rel .card { box-shadow: none; border: 0; }
  body.imp-rel .tabela-wrap { max-height: none; overflow: visible; }
  body.imp-rel th, body.imp-rel td { padding: 5px 8px; font-size: 11px; position: static; }
  body.imp-rel tfoot td { position: static; }
}

/* ---- tabelas fiscais ---- */
.faixa-barra { height: 8px; border-radius: 99px; background: var(--superficie-2); overflow: hidden; min-width: 90px; }
.faixa-barra i { display: block; height: 100%; background: var(--marca); border-radius: 99px; }

@media (max-width: 1180px) {
  .topo { flex-wrap: wrap; }
  .topo h1 { flex-basis: calc(100% - 190px); }
  .topo-filtros { order: 3; width: 100%; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 55; transform: translateX(-105%); transition: transform .2s; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .lateral.aberta { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topo { padding: 10px 14px; flex-wrap: wrap; }
  .topo h1 { order: 1; flex-basis: calc(100% - 140px); }
  .topo-filtros { order: 3; width: 100%; }
  .conteudo { padding: 14px; }
  .holerite-grade { grid-template-columns: minmax(0, 1fr); }
  .tabela-wrap { max-height: none; }
}
@media print {
  body * { visibility: hidden; }
  #modal, #modal * { visibility: visible; }
  #modal { position: absolute; inset: 0; transform: none; width: 100%; box-shadow: none; max-height: none; }
  .no-print { display: none !important; }
}

/* eSocial: previa do XML */
.xml-pre { margin: 0; padding: 12px 14px; background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 10px; font: 12px/1.5 ui-monospace, Consolas, monospace; max-height: 380px; overflow: auto; white-space: pre; }

/* eSocial: escolha do certificado */
.opcoes-cert { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcao-cert { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--borda); border-radius: 12px; cursor: pointer; background: var(--superficie); }
.opcao-cert.ativa { border-color: var(--marca); background: var(--marca-2); }
.opcao-cert input { margin-top: 3px; }
.opcao-cert b { display: block; font-size: 13.5px; }
.opcao-cert small { display: block; color: var(--texto-2); font-size: 12px; margin-top: 2px; }
@media (max-width: 600px) { .opcoes-cert { grid-template-columns: 1fr; } }

/* calculo da folha */
tr.linha-dif td { background: var(--aviso-bg); }

/* formulas de calculo */
.grade-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
code.formula { font: 12.5px/1.4 ui-monospace, Consolas, monospace; background: var(--superficie-2); border-radius: 6px; padding: 2px 6px; display: inline-block; max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
textarea.formula-edit { font: 13px/1.5 ui-monospace, Consolas, monospace; width: 100%; resize: vertical; }
.ajuda-formula { font-size: 12.5px; color: var(--texto-2); margin-top: 6px; }
.ajuda-formula code { background: var(--superficie-2); border-radius: 4px; padding: 0 4px; }

/* ---- contracheque (layout do Sispoli) ---- */
.cc-corpo { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.cc-folha { background: #fff; color: #111; width: 210mm; max-width: 100%; box-sizing: border-box; padding: 10mm; border: 1px solid var(--borda); border-radius: 6px; font-size: 11px; line-height: 1.25; page-break-after: always; }
.cc-topo { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #111; padding-bottom: 6px; margin-bottom: 6px; }
.cc-topo img { height: 44px; width: auto; }
.cc-tit { text-align: right; }
.cc-tit h1 { margin: 0; font-size: 18px; letter-spacing: .08em; }
.cc-tit span { font-size: 11px; color: #444; }
.cc-grade { display: grid; gap: 0; border: 1px solid #999; border-bottom: 0; }
.cc-g4 { grid-template-columns: repeat(4, 1fr); }
.cc-campo { border-bottom: 1px solid #999; border-right: 1px solid #ccc; padding: 2px 5px; min-height: 28px; min-width: 0; }
.cc-campo span { display: block; font-size: 8.5px; color: #555; text-transform: uppercase; }
.cc-campo b { display: block; font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-s2 { grid-column: span 2; }
.cc-s3 { grid-column: span 3; }
.cc-tab { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cc-tab th { text-align: left; font-size: 9px; text-transform: uppercase; background: #eee; border: 1px solid #999; padding: 3px 5px; position: static; }
.cc-tab td { padding: 2px 5px; border-left: 1px solid #999; border-right: 1px solid #999; font-size: 11px; }
.cc-tab tbody { display: table-row-group; }
.cc-tab tbody tr:last-child td { border-bottom: 1px solid #999; }
.cc-tab .n { text-align: right; font-variant-numeric: tabular-nums; }
.cc-tab .c { width: 40px; text-align: center; }
.cc-rodape { margin-top: 10px; }
.cc-caixas { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #999; border-right: 0; border-bottom: 0; }
.cc-caixa { border-right: 1px solid #999; border-bottom: 1px solid #999; padding: 3px 6px; }
.cc-caixa span { display: block; font-size: 8.5px; color: #555; text-transform: uppercase; }
.cc-caixa b { display: block; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.cc-liq { background: #e8e8e8; }
.cc-liq b { font-size: 14px; }
.cc-msg { margin-top: 8px; border: 1px solid #999; padding: 5px 8px; min-height: 24px; font-weight: 600; font-size: 11px; }
.cc-ass { margin-top: 28px; text-align: center; }
.cc-ass div { border-top: 1px solid #111; width: 70%; margin: 0 auto 3px; }
.cc-ass p { margin: 0; font-size: 10.5px; }
.cc-ass small { color: #555; }
@media (max-width: 900px) { .cc-g4, .cc-caixas { grid-template-columns: repeat(2, 1fr); } .cc-folha { padding: 8px; } }
@media print {
  body.imp-cc * { visibility: visible; }
  body.imp-cc .lateral, body.imp-cc .topo, body.imp-cc .barra, body.imp-cc .no-print, body.imp-cc .toast { display: none !important; }
  body.imp-cc .app { display: block; }
  body.imp-cc .conteudo { padding: 0; max-width: none; }
  body.imp-cc .cc-corpo { display: block; }
  body.imp-cc .cc-folha { border: 0; border-radius: 0; width: auto; padding: 0; margin: 0; }
  body.imp-cc .cc-folha:last-child { page-break-after: auto; }
}

/* ---- resumo da folha geral (layout do Sispoli) ---- */
.rf-opcoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.rf-opcoes fieldset { border: 1px solid var(--borda); border-radius: 8px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.rf-opcoes legend { font-size: 12px; font-weight: 700; color: var(--texto-2); padding: 0 6px; }
.rf-opcoes label { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.rf-valores { max-height: 150px; overflow: auto; border: 1px solid var(--borda); border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.rf-corpo { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.rf-pagina { background: #fff; color: #000; width: 297mm; max-width: 100%; box-sizing: border-box; padding: 10mm 8mm; border: 1px solid var(--borda); border-radius: 6px; font-family: "Times New Roman", Times, serif; font-size: 11px; line-height: 1.3; overflow-x: auto; }
.rf-topo { font-family: "Segoe UI", Arial, sans-serif; display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: center; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 3px solid #1f4e79; }
.rf-marca { display: flex; align-items: center; gap: 14px; }
.rf-marca img { height: 46px; width: auto; }
.rf-titulos { display: grid; line-height: 1.1; padding-left: 14px; border-left: 3px solid #1f4e79; }
.rf-nome { display: flex; align-items: center; gap: 9px; }
.rf-icone { width: 26px; height: 26px; border-radius: 8px; background: #1f4e79; position: relative; flex: none; }
.rf-icone::after { content: ""; position: absolute; inset: 6px; border: solid #fff; border-width: 0 0 3px 3px; transform: skewX(-20deg) scaleY(.7); border-radius: 2px; }
.rf-titulos b { font-size: 22px; letter-spacing: .14em; color: #1f4e79; }
.rf-titulos span { font-size: 13px; font-weight: 600; color: #333; margin-top: 3px; }
.rf-meta { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.rf-meta div { background: #eef3f8; border: 1px solid #c7d6e6; border-radius: 6px; padding: 3px 10px; min-width: 70px; }
.rf-meta span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .06em; color: #5a6b7d; }
.rf-meta b { font-size: 11.5px; color: #111; white-space: nowrap; }
.rf-empresa { grid-column: 1 / -1; display: flex; align-items: center; font-size: 12px; }
.rf-grupo { background: #1f4e79; color: #fff; border-radius: 99px; padding: 3px 14px; font-size: 12px; font-weight: 600; max-width: 100%; }
.rf-tab { width: 100%; border-collapse: collapse; margin-top: 4px; }
.rf-tab thead th { text-align: left; font-weight: 600; border-top: 2px solid #1f4e79; border-bottom: 2px solid #1f4e79; padding: 4px 3px; font-size: 10.5px; position: static; background: #fff; color: #000; text-transform: none; }
.rf-tab td { padding: 1px 3px; border: 0; font-size: 11px; color: #000; }
.rf-tab .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rf-tab .c { text-align: center; width: 24px; }
.rf-tab thead th.n, .rf-tab thead th.c { text-align: right; }
.rf-tab thead th.c { text-align: center; }
.rf-tab tr.rf-sec td { font-weight: 700; padding-top: 7px; color: #1f4e79; }
.rf-tab tr.rf-tot td { font-weight: 700; }
.rf-zebra .rf-tab tr.rf-ev:nth-of-type(even) td { background: #edf2f8; }
.rf-nota { margin-top: 8px; font-size: 9.5px; color: #333; }
.rf-enc-tit { background: #eef3f8; border: 1px solid #1f4e79; color: #1f4e79; padding: 4px 10px; font-family: Arial, sans-serif; font-size: 11px; font-weight: 700; display: flex; gap: 28px; flex-wrap: wrap; margin-top: 6px; }
.rf-enc { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 6px; margin-top: 8px; align-items: start; }
.rf-enc table { width: 100%; border-collapse: collapse; border: 1px solid #000; }
.rf-enc th { font-weight: 700; font-size: 10.5px; border: 1px solid #000; padding: 2px 4px; text-align: left; background: #fff; color: #000; position: static; text-transform: none; }
.rf-enc td { padding: 0 4px; font-size: 10.5px; border: 0; border-left: 1px solid #000; color: #000; white-space: nowrap; }
.rf-enc td:first-child { border-left: 0; white-space: normal; }
.rf-enc .n { text-align: right; font-variant-numeric: tabular-nums; }
.rf-sub { font-weight: 700; margin: 10px 0 3px; font-size: 11.5px; }
.rf-gps, .rf-grf { width: 100%; border-collapse: collapse; }
.rf-gps th, .rf-gps td, .rf-grf th, .rf-grf td { border: 1px solid #000; padding: 2px 5px; font-size: 10.5px; text-align: center; color: #000; background: #fff; position: static; text-transform: none; }
.rf-gps th, .rf-grf th { font-weight: 700; }
.rf-gps td { background: #eee; text-align: right; }
.rf-grf td.n { text-align: right; }
.rf-grf .ouro { background: #d9d4a8; }
.rf-grf .azul { background: #edf2f8; }
@page rf { size: A4 landscape; margin: 10mm; }
@media print {
  body.imp-rf * { visibility: visible; }
  body.imp-rf .lateral, body.imp-rf .topo, body.imp-rf .barra, body.imp-rf .no-print, body.imp-rf .toast { display: none !important; }
  body.imp-rf .app { display: block; }
  body.imp-rf .conteudo { padding: 0; max-width: none; }
  body.imp-rf .rf-corpo { display: block; }
  body.imp-rf .rf-pagina { page: rf; border: 0; border-radius: 0; width: auto; padding: 0; margin: 0; overflow: visible; page-break-after: always; }
  body.imp-rf .rf-pagina:last-child { page-break-after: auto; }
  body.imp-rf .rf-zebra .rf-tab tr.rf-ev:nth-of-type(even) td, body.imp-rf .rf-enc-tit, body.imp-rf .rf-meta div, body.imp-rf .rf-grupo, body.imp-rf .rf-icone, body.imp-rf .rf-icone::after, body.imp-cc .rf-meta div, body.imp-cc .rf-icone, body.imp-cc .rf-icone::after, body.imp-rf .rf-gps td, body.imp-rf .rf-grf .ouro, body.imp-rf .rf-grf .azul { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- navegacao entre competencias ---- */
.nav-comp { display: inline-flex; align-items: center; gap: 4px; }
.nav-comp select { min-width: 150px; }
.nav-comp .btn.icone { width: 32px; min-height: 32px; font-size: 18px; line-height: 1; padding: 0; }
.campo-inline #comp-ant, .campo-inline #comp-prox { width: 28px; min-height: 28px; font-size: 17px; line-height: 1; padding: 0; }

.link-mes { color: var(--marca); text-decoration: none; }
.link-mes:hover { text-decoration: underline; }
tr.mes-sel td { background: var(--marca-2); }

/* ---- documentos de pessoal (aviso/recibo de ferias, termo de rescisao) ---- */
.dc-corpo { display: flex; flex-direction: column; gap: 16px; align-items: center; margin-top: 12px; }
.dc-pagina { background: #fff; color: #111; width: 210mm; max-width: 100%; box-sizing: border-box; padding: 10mm; border: 1px solid var(--borda); border-radius: 6px; font-size: 11.5px; line-height: 1.35; page-break-after: always; }
.dc-titulo { text-align: center; font-size: 16px; letter-spacing: .06em; margin: 6px 0 10px; color: #1f4e79; }
.dc-sec { background: #eef3f8; border: 1px solid #c7d6e6; border-bottom: 0; color: #1f4e79; font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; margin-top: 8px; }
.dc-sec + .cc-grade, .dc-sec + .cc-tab { margin-top: 0; }
.dc-texto { margin: 10px 0; font-size: 12px; text-align: justify; }
.dc-liquido { display: flex; justify-content: space-between; align-items: center; background: #eef3f8; border: 1px solid #1f4e79; padding: 6px 12px; margin-top: 6px; font-weight: 700; }
.dc-liquido b { font-size: 15px; color: #1f4e79; }
.cc-tab tr.dc-tot td { font-weight: 700; background: #f4f6f9; border-top: 1px solid #999; }
.dc-assinaturas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 28px; margin-top: 46px; }
.dc-ass { text-align: center; }
.dc-ass div { border-top: 1px solid #111; margin-bottom: 3px; }
.dc-ass b { display: block; font-size: 11px; }
.dc-ass small { color: #444; font-size: 10px; }
.dc-rodape { margin-top: 16px; font-size: 9.5px; color: #555; text-align: center; }
@media print {
  body.imp-dc * { visibility: visible; }
  body.imp-dc .lateral, body.imp-dc .topo, body.imp-dc .barra, body.imp-dc .no-print, body.imp-dc .toast { display: none !important; }
  body.imp-dc .app { display: block; }
  body.imp-dc .conteudo { padding: 0; max-width: none; }
  body.imp-dc .dc-corpo { display: block; margin: 0; }
  body.imp-dc .dc-pagina { border: 0; border-radius: 0; width: auto; padding: 0; margin: 0; }
  body.imp-dc .dc-pagina:last-child { page-break-after: auto; }
  body.imp-dc .rf-meta div, body.imp-dc .rf-icone, body.imp-dc .rf-icone::after, body.imp-dc .dc-sec, body.imp-dc .dc-liquido, body.imp-dc .cc-tab tr.dc-tot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* envio ao eSocial de producao: destaque de aviso */
.faixa.aviso { background: var(--aviso-bg); color: var(--aviso); border-color: var(--aviso); }
.btn.aviso-prod { color: var(--aviso); border-color: var(--aviso); }

/* ---- tela inicial de acesso (escolha da empresa) ---- */
.acesso { min-height: 100%; padding: 24px; background: radial-gradient(1200px 500px at 70% -10%, var(--marca-2), transparent), var(--bg); }
.acesso-miolo { width: min(1080px, 100%); margin: 0 auto; display: grid; gap: 20px; }
.acesso-topo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acesso-titulo { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.acesso-titulo h1 { margin: 0; font-size: 22px; }
.acesso-titulo p { margin: 0; }
.acesso-admin { display: flex; gap: 8px; flex-wrap: wrap; }
.acesso-grupo h2 { margin: 6px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--texto-2); }
.acesso-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.acesso-cartao { display: grid; gap: 4px; text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); cursor: pointer; font: inherit; box-shadow: var(--sombra); transition: transform .12s, border-color .12s; }
.acesso-cartao:hover, .acesso-cartao:focus-visible { border-color: var(--marca); transform: translateY(-2px); }
.acesso-cartao b { font-size: 16px; }
.acesso-cartao.inativa { opacity: .65; }
.acesso-cartao.indisponivel { cursor: default; opacity: .7; }
.acesso-tipo { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--marca); }
.acesso-razao { font-size: 12px; color: var(--texto-2); }
.acesso-rodape { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.acesso .card { margin-top: 4px; }


/* tabela que se ajusta a largura (sem rolagem horizontal): o texto quebra em vez de alargar a coluna */
.tabela-wrap.ajustada th, .tabela-wrap.ajustada td { white-space: normal; padding: 10px 10px; }
.tabela-wrap.ajustada th { white-space: nowrap; }
.tabela-wrap.ajustada td.num, .tabela-wrap.ajustada .acoes { white-space: nowrap; }
.tabela-wrap.ajustada .badge { white-space: nowrap; vertical-align: middle; }
.tabela-wrap.ajustada th:first-child, .tabela-wrap.ajustada td:first-child { padding-left: 16px; }
.tabela-wrap.ajustada th:last-child, .tabela-wrap.ajustada td:last-child { padding-right: 16px; }
@media (max-width: 1150px) {
  .tabela-wrap.ajustada table { font-size: 13px; }
  .tabela-wrap.ajustada th, .tabela-wrap.ajustada td { padding: 8px 6px; }
  .tabela-wrap.ajustada th { white-space: normal; letter-spacing: 0; }
  .tabela-wrap.ajustada th:first-child, .tabela-wrap.ajustada td:first-child { padding-left: 10px; }
  .tabela-wrap.ajustada th:last-child, .tabela-wrap.ajustada td:last-child { padding-right: 10px; }
}

/* celula de grupo (rowspan): o conteudo fica fixo logo abaixo do cabecalho enquanto o grupo rola e cede ao proximo grupo */
.tabela-wrap td.grupo-cel { vertical-align: top; border-right: 1px solid var(--borda); }
.grupo-fixo { position: sticky; top: calc(var(--cab-h, 38px) + 10px); }
tbody tr:hover td.grupo-cel { background: transparent; }

/* ---- mapa analitico da folha (formato do Sispoli, no padrao FOLPAG dos relatorios rf-*) ---- */
.ma-pagina { font-family: Arial, "Segoe UI", sans-serif; font-size: 10.5px; }
.ma-pagina td, .ma-pagina th { padding: 1px 3px; border: 0; white-space: normal; color: #000; position: static; background: transparent; }
.ma-corpo { width: 100%; border-collapse: collapse; }
.ma-corpo > thead > tr > td, .ma-corpo > tbody > tr > td { padding: 0; }
.ma-bloco { break-inside: avoid; page-break-inside: avoid; }
.ma-lot { margin-left: 18px; font-size: 12px; }
.ma-func { border-top: 2px solid #1f4e79; padding: 6px 0 3px; display: grid; gap: 2px; }
.ma-l1, .ma-l2 { display: flex; flex-wrap: wrap; gap: 2px 26px; align-items: baseline; }
.ma-nome { font-size: 12px; margin-right: 8px; }
.ma-func i { font-style: normal; font-size: 9px; color: #444; margin-right: 3px; }
.ma-ev { width: 100%; border-collapse: collapse; margin-top: 4px; }
.ma-ev thead th { text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 2px 3px; color: #000; }
.ma-ev td, .ma-ev th { white-space: nowrap; }
.ma-ev td:nth-child(2), .ma-ev td:nth-child(7), .ma-ev th:nth-child(2), .ma-ev th:nth-child(7) { white-space: normal; width: 24%; }
.ma-ev .n { text-align: right; font-variant-numeric: tabular-nums; }
.ma-ev .c { text-align: center; width: 34px; }
.ma-ev td:nth-child(6), .ma-ev th:nth-child(6) { border-left: 1px solid #bbb; padding-left: 10px; }
.ma-ev tbody tr:nth-child(even) td { background: #f3f6fa; }
.ma-tot { display: flex; gap: 48px; flex-wrap: wrap; margin-top: 5px; padding: 3px 6px; border-top: 1px solid #000; border-bottom: 2px solid #1f4e79; font-size: 11.5px; }
.ma-tot b { margin-left: 6px; }
.ma-tot-lot { background: #eef3f8; border: 1px solid #1f4e79; font-weight: 700; color: #1f4e79; margin-top: 10px; }
@media print {
  body.imp-rf .ma-pagina { font-size: 9.5px; }
  body.imp-rf .ma-ev tbody tr:nth-child(even) td, body.imp-rf .ma-tot-lot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.imp-rf .ma-corpo > thead { display: table-header-group; }
}

/* ---- liquido a pagar: secoes com e sem vinculo e totais ---- */
.rel-sub { padding: 12px 18px 4px; font-weight: 700; font-size: 13px; color: var(--marca); border-top: 1px solid var(--borda); }
.rel-total { display: flex; gap: 28px; flex-wrap: wrap; justify-content: flex-end; padding: 12px 18px; border-top: 2px solid var(--borda); font-size: 13px; }
.rel-total b { font-variant-numeric: tabular-nums; margin-left: 6px; }
.rel-total .rel-total-geral { font-weight: 700; font-size: 14px; }
.ma-sv { display: inline-block; margin-left: 8px; padding: 0 7px; border: 1px solid #1f4e79; border-radius: 99px; font-size: 8.5px; font-weight: 700; letter-spacing: .05em; color: #1f4e79; vertical-align: middle; }

/* cabecalho padrao dos relatorios do menu Relatorios (folha branca de timbre, como nos demais relatorios) */
.rel-folha { background: #fff; color: #000; padding: 12px 18px 4px; border-bottom: 1px solid var(--borda); }
.rel-folha .rf-topo { margin-bottom: 4px; }
@media print { body.imp-rel .rel-folha { padding: 0 0 6px; border: 0; } body.imp-rel .rel-folha .rf-meta div, body.imp-rel .rel-folha .rf-grupo, body.imp-rel .rel-folha .rf-icone, body.imp-rel .rel-folha .rf-icone::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.tabela-wrap table.fixa { table-layout: fixed; }
.tabela-wrap table.fixa td, .tabela-wrap table.fixa th { overflow-wrap: anywhere; }
