* { box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
background-color: #f0f2f5;
padding: 20px;
}
.container {
max-width: 480px;
margin: auto;
background: #fff;
padding: 25px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
h1 {
font-size: 22px;
margin-bottom: 20px;
text-align: center;
color: #333;
}
label {
font-weight: bold;
margin-top: 10px;
display: block;
}
input {
width: 100%;
padding: 10px;
margin-top: 5px;
margin-bottom: 15px;
font-size: 16px;
border-radius: 5px;
border: 1px solid #ccc;
}
a.botao {
display: block;
text-align: center;
background-color: #28a745;
color: white;
padding: 12px;
font-size: 16px;
font-weight: bold;
border-radius: 5px;
text-decoration: none;
}
a.botao:hover {
background-color: #218838;
color: white;
}
#resultado {
margin-top: 20px;
font-size: 16px;
line-height: 1.6;
color: #222;
}
@media (max-width: 500px) {
h1 { font-size: 20px; }
}
function calcularINSS(salario) {
let inss = 0;
const faixas = [
{ limite: 1412.00, aliquota: 0.075 },
{ limite: 2666.68, aliquota: 0.09 },
{ limite: 4000.03, aliquota: 0.12 },
{ limite: 7786.02, aliquota: 0.14 }
];
let base = salario;
let acumulado = 0;
for (let i = 0; i faixa.limite) {
acumulado += (faixa.limite – limiteAnterior) * faixa.aliquota;
} else {
acumulado += (salario – limiteAnterior) * faixa.aliquota;
break;
}
}
return Math.min(acumulado, 908.86); // Teto do INSS 2025
}
function calcularIRRF(baseIR, dependentes = 0) {
const deducaoDependente = 189.59;
const base = baseIR – (dependentes * deducaoDependente);
if (base <= 2259.20) return 0;
else if (base <= 2826.65) return base * 0.075 – 169.44;
else if (base <= 3751.05) return base * 0.15 – 381.44;
else if (base <= 4664.68) return base * 0.225 – 662.77;
else return base * 0.275 – 896.00;
}
function calcular() {
const salario = parseFloat(document.getElementById('salario').value);
const meses = parseInt(document.getElementById('meses').value);
const dependentes = parseInt(document.getElementById('dependentes').value) || 0;
const resultado = document.getElementById('resultado');
if (isNaN(salario) || salario <= 0 || isNaN(meses) || meses 12) {
resultado.innerHTML = “⚠️ Preencha todos os campos corretamente.“;
return;
}
const decimoBruto = (salario * meses) / 12;
const inss = calcularINSS(decimoBruto);
const baseIR = decimoBruto – inss;
const irrf = calcularIRRF(baseIR, dependentes);
const liquido = decimoBruto – inss – irrf;
resultado.innerHTML = `
💰 13º Bruto: R$ ${decimoBruto.toFixed(2)}
🧾 INSS: R$ ${inss.toFixed(2)}
🧾 IRRF: R$ ${irrf.toFixed(2)}
👨👩👧👦 Dependentes: ${dependentes}
✅ 13º Líquido: R$ ${liquido.toFixed(2)}
`; }