/* Folha de Pagamento · SR da Contabilidade
   Mesma família de cores do emissor (azul-marinho), com a marca d'água da logomarca ao fundo de cada tela */
:root {
    color-scheme: light;
    --marinho: #0a1f44;
    --marinho-2: #12336e;
    --marinho-3: #1b4a9c;
    --azul-marca: #0b4fb3;
    --marinho-suave: #e8eef9;
    --fundo: #f2f5fb;
    --superficie: #ffffff;
    --texto: #0a1f44;
    --texto-2: #50607d;
    --texto-lateral: #d5e0f5;
    --rotulo-lateral: #8fa8d4;
    --linha: #dde4f0;
    --acao: #0b4fb3;
    --acao-escura: #093e8c;
    --acao-texto: #ffffff;
    --ok: #0b6b3f;
    --ok-fundo: #dff5ea;
    --erro: #b3261e;
    --erro-fundo: #fde7e5;
    --espera: #8a5a00;
    --espera-fundo: #fff3d1;
    --neutro-fundo: #e9edf4;
    --raio: 14px;
    --sombra: 0 1px 2px rgba(10, 31, 68, .05), 0 8px 24px rgba(10, 31, 68, .06);
    --sombra-alta: 0 12px 32px rgba(10, 31, 68, .16);
    --largura-menu: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--fundo);
    color: var(--texto);
    font: 15.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--azul-marca); }
.icone { width: 20px; height: 20px; flex: 0 0 auto; }

#app { display: flex; min-height: 100vh; }

/* Menu lateral */
.lateral {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--largura-menu);
    height: 100vh;
    padding: 18px 12px 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, #0b2a63 0%, var(--marinho) 100%);
    color: var(--acao-texto);
}
.marca { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; }
.marca img { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.marca b { display: block; font-size: 16px; line-height: 1.2; }
.marca span { color: var(--rotulo-lateral); font-size: 12.5px; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--texto-lateral);
    font-size: 14.5px;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.lateral nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.lateral nav a.ativo { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #7fb0ff; }
.quem { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; align-items: center; gap: 10px; }
.quem .avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .16); font-weight: 700; }
.quem div { flex: 1; min-width: 0; font-size: 14px; }
.quem .nota { color: var(--rotulo-lateral); font-size: 12px; }
.quem button { display: grid; place-items: center; padding: 8px; border-radius: 9px; background: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.quem button:hover { background: rgba(255, 255, 255, .2); }

/* Área principal com a marca d'água: por cima do conteúdo, porque atrás dos cartões brancos ficaria escondida */
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.principal::after {
    content: "";
    position: fixed;
    inset: 0 0 0 var(--largura-menu);
    z-index: 4;
    pointer-events: none;
    background: url("marca-dagua.png") center / min(560px, 60%) no-repeat;
    opacity: .08;
}

/* Barra superior: título, empresa e atalhos */
.topo {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 12px 32px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--linha);
}
.topo h1 { flex: 1; min-width: 180px; margin: 0; font-size: 22px; letter-spacing: -.01em; }
.topo form { display: flex; }
.topo select { min-width: 240px; padding: 8px 12px; border-radius: 999px; background: var(--marinho-suave); border-color: transparent; font-weight: 600; }
.atalhos-topo { display: flex; gap: 6px; }
.atalhos-topo a, .atalhos-topo button {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 11px;
    background: var(--marinho-suave);
    color: var(--marinho-2);
    text-decoration: none;
    box-shadow: none;
    transition: background .15s, color .15s, transform .15s;
}
.atalhos-topo a:hover, .atalhos-topo button:hover { background: var(--acao); color: #fff; transform: translateY(-1px); }
/* Dica com o nome do atalho */
.atalhos-topo [data-dica]:hover::after {
    content: attr(data-dica);
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    padding: 5px 9px;
    border-radius: 7px;
    background: var(--marinho);
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
}

main { flex: 1; padding: 24px 32px 40px; }
h1 { margin: 0 0 4px; font-size: 26px; }
.sub { margin: 0 0 20px; color: var(--texto-2); }
h2 { margin: 0 0 12px; font-size: 16.5px; }

.cartao {
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    background: var(--superficie);
    box-shadow: var(--sombra);
}
.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.numeros .cartao { margin: 0; }
.numero { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.rotulo { color: var(--texto-2); font-size: 13.5px; }

/* Tarefas rápidas do painel */
.tarefas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tarefa {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    background: var(--superficie);
    box-shadow: var(--sombra);
    color: var(--texto);
    font: inherit;
    align-items: flex-start;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tarefa:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); border-color: #b9cbec; background: var(--superficie); }
.tarefa .icone { width: 26px; height: 26px; }
.tarefa .selo-icone { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: #fff; }
.tarefa b { font-size: 15px; }
.tarefa span { color: var(--texto-2); font-size: 13px; line-height: 1.35; }
.cor-folha { background: linear-gradient(135deg, #0b4fb3, #3b82f6); }
.cor-ferias { background: linear-gradient(135deg, #0e7490, #22b8cf); }
.cor-rescisao { background: linear-gradient(135deg, #b42318, #f0645a); }
.cor-decimo { background: linear-gradient(135deg, #7a3ce0, #a77bf3); }
.cor-admissao { background: linear-gradient(135deg, #0b6b3f, #2fb36d); }
.cor-holerite { background: linear-gradient(135deg, #12336e, #4a6fb0); }
.cor-convencao { background: linear-gradient(135deg, #8a5a00, #e0a21b); }
.cor-esocial { background: linear-gradient(135deg, #0b5d4b, #1fa37f); }
.cor-assistente { background: linear-gradient(135deg, #0a1f44, #1b4a9c); }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { padding: 9px 10px; border-bottom: 2px solid var(--linha); color: var(--texto-2); font-size: 12.5px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .03em; }
td { padding: 10px; border-bottom: 1px solid var(--linha); vertical-align: top; }
tr:hover td { background: #f7f9fd; }
td.valor, th.valor { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rolagem { overflow-x: auto; }
.vazio { padding: 18px 4px; color: var(--texto-2); }

.selo { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.selo.ok { background: var(--ok-fundo); color: var(--ok); }
.selo.erro { background: var(--erro-fundo); color: var(--erro); }
.selo.espera { background: var(--espera-fundo); color: var(--espera); }
.selo.neutro { background: var(--neutro-fundo); color: var(--texto-2); }

form.linha, .linha { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: 5px; color: var(--texto-2); font-size: 13.5px; font-weight: 500; }
input, select, textarea {
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid var(--linha);
    border-radius: 10px;
    background: #fff;
    color: var(--texto);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul-marca); box-shadow: 0 0 0 3px rgba(11, 79, 179, .15); }
button, a.botao {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--acao);
    color: var(--acao-texto);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(11, 79, 179, .25);
    transition: background .15s, transform .15s;
}
button:hover, a.botao:hover { background: var(--acao-escura); }
button:active { transform: translateY(1px); }
button.secundario, a.botao.secundario { background: var(--neutro-fundo); color: var(--texto); box-shadow: none; }
button.secundario:hover, a.botao.secundario:hover { background: #dbe2ee; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.total td { border-top: 2px solid var(--linha); font-weight: 800; }
.nota { color: var(--texto-2); font-size: 13.5px; }

/* Convenções */
.passos { margin: 0; padding-left: 20px; }
.passos li { margin-bottom: 4px; }
.cartao.aviso { background: var(--espera-fundo); color: var(--espera); }
.cartao.destaque { border-color: #b9cbec; background: linear-gradient(135deg, #f2f7ff, #fff); }
label.marcar { flex-direction: row; align-items: center; gap: 7px; color: var(--texto); }
label.marcar input { min-width: 0; }
td input { min-width: 0; }

/* Cadastros e folha */
.cartao.mensagem { padding: 12px 16px; }
fieldset.sem-borda { margin: 0; padding: 0; border: 0; min-width: 0; }
table.grade th { white-space: nowrap; text-transform: none; letter-spacing: 0; }
table.grade input { width: 86px; padding: 6px 8px; text-align: right; }

/* Espera de formulários demorados */
#aguarde { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(10, 31, 68, .35); }
#aguarde .cartao { display: flex; align-items: center; gap: 14px; max-width: 420px; }
.girando { flex: 0 0 26px; height: 26px; border: 3px solid var(--marinho-suave); border-top-color: var(--marinho-3); border-radius: 50%; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Assistente */
#abrir-assistente {
    position: fixed; right: 22px; bottom: 22px; z-index: 20;
    padding: 13px 20px; border-radius: 999px; box-shadow: var(--sombra-alta);
    background: linear-gradient(135deg, var(--marinho-2), var(--azul-marca));
}
#assistente {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 25;
    display: flex; flex-direction: column;
    width: min(420px, 100vw);
    background: var(--superficie);
    box-shadow: -8px 0 28px rgba(10, 31, 68, .18);
}
#assistente header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--linha); }
#assistente header > div { flex: 1; }
#assistente header button { padding: 6px 12px; }
#assistente .fechar { background: none; color: var(--texto); font-size: 22px; line-height: 1; padding: 4px 8px; box-shadow: none; }
#mensagens { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 15px; overflow-wrap: anywhere; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 8px; padding-left: 20px; }
.msg.user { align-self: flex-end; background: var(--marinho-2); color: #fff; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--marinho-suave); }
.msg.sistema { align-self: stretch; max-width: none; background: none; color: var(--texto-2); font-size: 14px; padding: 0; }
.msg.falha { background: var(--erro-fundo); color: var(--erro); }
.msg code { padding: 1px 4px; border-radius: 4px; background: rgba(10, 31, 68, .08); font-size: 13px; }
#perguntar { display: flex; gap: 8px; padding: 12px 16px 6px; border-top: 1px solid var(--linha); }
#perguntar textarea { flex: 1; min-width: 0; resize: none; }
#perguntar button:disabled { opacity: .5; cursor: wait; }
.aviso-ia { margin: 0; padding: 0 16px 12px; font-size: 12px; }

/* Login */
body.tela-login {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 16px;
    background: radial-gradient(circle at 20% 10%, #1b4a9c 0%, var(--marinho) 60%);
}
body.tela-login::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: url("marca-dagua.png") center / min(640px, 80%) no-repeat;
    opacity: .06;
    filter: invert(1);
}
.entrada { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; width: min(400px, 100%); padding: 28px; }
.entrada .logo { display: block; width: 88px; height: 88px; margin: 0 auto 4px; border-radius: 20px; box-shadow: var(--sombra-alta); }
.entrada h1 { margin: 0; font-size: 22px; text-align: center; }
.entrada .nota { margin: 0; text-align: center; }
.entrada input { min-width: 0; }
.entrada button { justify-content: center; padding: 12px; }

@media (max-width: 860px) {
    #app { flex-direction: column; }
    .lateral { position: static; height: auto; flex-basis: auto; }
    .lateral nav { flex-direction: row; flex-wrap: wrap; }
    .quem { margin-top: 10px; }
    .principal::after { inset: 0; }
    .topo { position: static; padding: 12px 16px; }
    .topo select { min-width: 0; width: 100%; }
    main { padding: 20px 16px 32px; }
}

/* Documentos do funcionário */
.documentos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.documento {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border: 1px solid var(--linha); border-radius: 12px; background: #fbfcfe; color: var(--texto); text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.documento:hover { border-color: #b9cbec; box-shadow: var(--sombra); }
.documento > .icone { width: 26px; height: 26px; color: var(--azul-marca); }
.documento span { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--texto-2); }
.documento span b { color: var(--texto); font-size: 14.5px; }
.documento input, .documento select { min-width: 0; padding: 6px 8px; font-size: 13.5px; }
.documento button { padding: 8px 12px; }
.clausula textarea { font: inherit; }
