.refi-calc {
max-width: 560px;
margin: 40px auto;
padding: 32px 28px;
background: #141a24;
border-radius: 28px;
border: 1px solid rgba(255,255,255,0.04);
color: #f0f2f7;
font-family: ‘Inter’, -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, sans-serif;
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.04);
}
.refi-calc h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.refi-calc .sub { font-size: 13px; color: #6b7a90; margin-bottom: 28px; }
.refi-calc .section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #6b7a90; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid #1e2836; }
.refi-calc .section-label:first-of-type { margin-top: 0; }
.refi-calc .field-group { margin-bottom: 18px; }
.refi-calc .field-group label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: #c8d0dc; margin-bottom: 4px; }
.refi-calc .field-group label span:last-child { font-weight: 400; color: #6b7a90; }
.refi-calc .field-group input[type=»number»] { width: 100%; padding: 12px 16px; background: #0f151f; border: 1px solid #262f3d; border-radius: 14px; color: #f0f2f7; font-size: 17px; font-weight: 500; outline: none; transition: 0.2s; margin-top: 4px; }
.refi-calc .field-group input[type=»number»]:focus { border-color: #4a7cf7; box-shadow: 0 0 0 3px rgba(74,124,247,0.15); background: #131b28; }
.refi-calc .field-group input[type=»range»] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: #262f3d; border-radius: 2px; outline: none; margin: 8px 0 4px; }
.refi-calc .field-group input[type=»range»]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: #4a7cf7; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 4px rgba(74,124,247,0.15); transition: 0.15s; }
.refi-calc .field-group input[type=»range»]::-webkit-slider-thumb:hover { transform: scale(1.1); background: #5f8af8; }
.refi-calc .field-group input[type=»range»]::-moz-range-thumb { width: 18px; height: 18px; background: #4a7cf7; border: none; border-radius: 50%; cursor: pointer; }
.refi-calc .comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
.refi-calc .compare-card { background: #0f151f; border: 1px solid #1e2836; border-radius: 16px; padding: 16px; }
.refi-calc .compare-card .card-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7a90; margin-bottom: 12px; text-align: center; }
.refi-calc .compare-card .row { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; border-bottom: 1px solid #141a24; }
.refi-calc .compare-card .row:last-child { border-bottom: none; }
.refi-calc .compare-card .row .label { color: #6b7a90; }
.refi-calc .compare-card .row .val { color: #c8d0dc; font-weight: 500; }
.refi-calc .compare-card .row .val.accent { color: #4a7cf7; }
.refi-calc .savings-box { background: linear-gradient(135deg, #1a2a1e 0%, #0f1f14 100%); border: 1px solid #2d4a35; border-radius: 16px; padding: 20px; margin: 20px 0; text-align: center; }
.refi-calc .savings-box .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #6b9a7a; margin-bottom: 6px; }
.refi-calc .savings-box .value { font-size: 28px; font-weight: 700; color: #4caf7a; }
.refi-calc .savings-box .sub-value { font-size: 13px; color: #6b7a90; margin-top: 4px; }
.refi-calc .savings-box.warn { background: linear-gradient(135deg, #2a1a1a 0%, #1f0f0f 100%); border-color: #4a2d2d; }
.refi-calc .savings-box.warn .label { color: #9a6b6b; }
.refi-calc .savings-box.warn .value { color: #c0392b; }
.refi-calc .btn-primary { width: 100%; padding: 14px; background: #4a7cf7; border: none; border-radius: 16px; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: 8px; }
.refi-calc .btn-primary:hover { background: #5f8af8; }
.refi-calc .btn-primary:active { transform: scale(0.98); }
.refi-calc input[type=number]::-webkit-inner-spin-button,
.refi-calc input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.refi-calc input[type=number] { -moz-appearance: textfield; }
@media (max-width: 480px) { .refi-calc { padding: 24px 16px; margin: 20px 12px; } .refi-calc .comparison-grid { gap: 8px; } .refi-calc .compare-card { padding: 12px; } .refi-calc .compare-card .row { font-size: 13px; } .refi-calc .savings-box .value { font-size: 22px; } }
Калькулятор рефинансирования
Сравните текущий кредит с новым и узнайте выгоду
📋 Текущий кредит
🆕 Новый кредит (рефинансирование)
Текущий
Платёж— ₽
Всего выплат— ₽
Переплата— ₽
Новый
Платёж— ₽
Всего выплат— ₽
Переплата— ₽
Ваша выгода
— ₽
Введите параметры для расчёта
(function() {
// Элементы текущего кредита
const curAmountSlider = document.getElementById(‘curAmountSlider’);
const curAmountInput = document.getElementById(‘curAmountInput’);
const curAmountDisplay = document.getElementById(‘curAmountDisplay’);
const curTermSlider = document.getElementById(‘curTermSlider’);
const curTermInput = document.getElementById(‘curTermInput’);
const curTermDisplay = document.getElementById(‘curTermDisplay’);
const curRateSlider = document.getElementById(‘curRateSlider’);
const curRateInput = document.getElementById(‘curRateInput’);
const curRateDisplay = document.getElementById(‘curRateDisplay’); // Элементы нового кредита
const newAmountSlider = document.getElementById(‘newAmountSlider’);
const newAmountInput = document.getElementById(‘newAmountInput’);
const newAmountDisplay = document.getElementById(‘newAmountDisplay’);
const newTermSlider = document.getElementById(‘newTermSlider’);
const newTermInput = document.getElementById(‘newTermInput’);
const newTermDisplay = document.getElementById(‘newTermDisplay’);
const newRateSlider = document.getElementById(‘newRateSlider’);
const newRateInput = document.getElementById(‘newRateInput’);
const newRateDisplay = document.getElementById(‘newRateDisplay’);
const feeSlider = document.getElementById(‘feeSlider’);
const feeInput = document.getElementById(‘feeInput’);
const feeDisplay = document.getElementById(‘feeDisplay’); // Результаты
const curPayment = document.getElementById(‘curPayment’);
const curTotal = document.getElementById(‘curTotal’);
const curOverpay = document.getElementById(‘curOverpay’);
const newPayment = document.getElementById(‘newPayment’);
const newTotal = document.getElementById(‘newTotal’);
const newOverpay = document.getElementById(‘newOverpay’);
const savingsBox = document.getElementById(‘savingsBox’);
const savingsValue = document.getElementById(‘savingsValue’);
const savingsDetail = document.getElementById(‘savingsDetail’);
const refiCalcBtn = document.getElementById(‘refiCalcBtn’); // Расчёт аннуитетного платежа
function annuity(amount, years, annualRate) {
const months = years * 12;
const monthlyRate = (annualRate / 100) / 12;
if (monthlyRate === 0) return amount / months;
const factor = Math.pow(1 + monthlyRate, months);
return amount * (monthlyRate * factor) / (factor — 1);
} // Основной расчёт
function calculate() {
const curAmount = parseFloat(curAmountInput.value) || 0;
const curYears = parseFloat(curTermInput.value) || 1;
const curRate = parseFloat(curRateInput.value) || 0; const newAmount = parseFloat(newAmountInput.value) || 0;
const newYears = parseFloat(newTermInput.value) || 1;
const newRate = parseFloat(newRateInput.value) || 0;
const fee = parseFloat(feeInput.value) || 0; // Текущий кредит
const curMonths = curYears * 12;
const curMonthly = annuity(curAmount, curYears, curRate);
const curTotalSum = curMonthly * curMonths;
const curOver = curTotalSum — curAmount; // Новый кредит
const newMonths = newYears * 12;
const newMonthly = annuity(newAmount, newYears, newRate);
const newTotalSum = newMonthly * newMonths + fee;
const newOver = newTotalSum — newAmount; // Обновление UI
curPayment.textContent = Math.round(curMonthly).toLocaleString(‘ru-RU’) + ‘ ₽’;
curTotal.textContent = Math.round(curTotalSum).toLocaleString(‘ru-RU’) + ‘ ₽’;
curOverpay.textContent = Math.round(curOver).toLocaleString(‘ru-RU’) + ‘ ₽’; newPayment.textContent = Math.round(newMonthly).toLocaleString(‘ru-RU’) + ‘ ₽’;
newTotal.textContent = Math.round(newTotalSum).toLocaleString(‘ru-RU’) + ‘ ₽’;
newOverpay.textContent = Math.round(newOver).toLocaleString(‘ru-RU’) + ‘ ₽’; // Выгода
const monthlySavings = curMonthly — newMonthly;
const totalSavings = curTotalSum — newTotalSum;
const effectiveSavings = totalSavings — fee; if (totalSavings > 0) {
savingsBox.className = ‘savings-box’;
savingsValue.textContent = ‘+’ + Math.round(totalSavings).toLocaleString(‘ru-RU’) + ‘ ₽’;
savingsDetail.textContent = `Платёж снизится на ${Math.round(monthlySavings).toLocaleString(‘ru-RU’)} ₽/мес. · Переплата меньше на ${Math.round(totalSavings).toLocaleString(‘ru-RU’)} ₽`;
} else if (totalSavings {
const val = parseFloat(slider.value);
input.value = val;
if (display) display.textContent = formatter ? formatter(val) : val;
calculate();
};
slider.addEventListener(‘input’, update);
input.addEventListener(‘input’, function() {
let val = parseFloat(this.value);
if (isNaN(val)) return;
const min = parseFloat(slider.min);
const max = parseFloat(slider.max);
const step = parseFloat(slider.step) || 1;
if (val max) val = max;
val = Math.round(val / step) * step;
slider.value = val;
this.value = val;
if (display) display.textContent = formatter ? formatter(val) : val;
calculate();
});
const initVal = parseFloat(slider.value);
input.value = initVal;
if (display) display.textContent = formatter ? formatter(initVal) : initVal;
} // Форматтеры
const rubFormatter = (v) => Number(v).toLocaleString(‘ru-RU’) + ‘ ₽’;
const termFormatter = (v) => v + ‘ ‘ + declOfNum(v, [‘год’, ‘года’, ‘лет’]);
const rateFormatter = (v) => v + ‘ %’; function declOfNum(num, forms) {
const n = Math.abs(num) % 100;
const n1 = n % 10;
if (n > 10 && n 1 && n1 < 5) return forms[1];
if (n1 === 1) return forms[0];
return forms[2];
} // Инициализация
sync(curAmountSlider, curAmountInput, curAmountDisplay, rubFormatter);
sync(curTermSlider, curTermInput, curTermDisplay, termFormatter);
sync(curRateSlider, curRateInput, curRateDisplay, rateFormatter); sync(newAmountSlider, newAmountInput, newAmountDisplay, rubFormatter);
sync(newTermSlider, newTermInput, newTermDisplay, termFormatter);
sync(newRateSlider, newRateInput, newRateDisplay, rateFormatter);
sync(feeSlider, feeInput, feeDisplay, rubFormatter); // Кнопка
refiCalcBtn.addEventListener('click', calculate); // Первоначальный расчёт
calculate();
})();