:root {
    --primary: #0a2a66;--primary-light: #1a4282;--accent: #00d2ff;
    --bg-body: #f4f7fa;--bg-card: #ffffff;--text-main: #1f2937;--text-muted: #6b7280;
    --border: #e5e7eb;--error: #ef4444;--success: #10b981;--radius: 12px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
* { box-sizing: border-box; outline: none; }
body { font-family: 'Inter', sans-serif; background: var(--bg-body); color: var(--text-main); margin: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
header { background: var(--primary); color: #fff; padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); position: relative; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.25rem; }
.brand img { background: #fff; padding: 4px; border-radius: 8px; width: 40px; height: 40px; object-fit: cover; }
.secure-badge { font-size: 0.85rem; background: rgba(255,255,255,0.15); padding: 6px 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; }

/* Main */
main { flex: 1; display: flex; justify-content: center; align-items: center; padding: 40px 20px; }
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 750px; overflow: hidden; position: relative; }

/* Stepper */
.stepper { display: flex; justify-content: space-between; padding: 30px 40px 10px; position: relative; }
.stepper::before { content: ''; position: absolute; top: 45px; left: 50px; right: 50px; height: 2px; background: var(--border); z-index: 0; }
.step-indicator { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 80px; }
.step-circle { width: 32px; height: 32px; background: var(--bg-card); border: 2px solid var(--border); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: 600; color: var(--text-muted); transition: var(--transition); }
.step-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; transition: var(--transition); }
.step-indicator.active .step-circle { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(10, 42, 102, 0.15); }
.step-indicator.active .step-label { color: var(--primary); font-weight: 700; }
.step-indicator.completed .step-circle { background: var(--success); border-color: var(--success); color: #fff; }
.step-indicator.completed .step-label { color: var(--success); }

/* Form */
.form-container { padding: 30px 40px 50px; position: relative; min-height: 320px; }
.form-step { display: none; animation: fadeIn 0.4s ease-out; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
h2 { margin: 0 0 8px; font-size: 1.5rem; color: var(--primary); }
p.subtitle { margin: 0 0 24px; color: var(--text-muted); font-size: 0.95rem; }

/* Inputs */
.input-group { margin-bottom: 20px; position: relative; }
label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
input, select, textarea { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; font-family: inherit; transition: var(--transition); background: #fafafa; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(10, 42, 102, 0.1); }
input.error, select.error, textarea.error { border-color: var(--error); animation: shake 0.3s ease-in-out; }
.error-msg { color: var(--error); font-size: 0.8rem; margin-top: 5px; display: none; }
input.error + .error-msg, select.error + .error-msg { display: block; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Buttons */
.btn-group { display: flex; justify-content: space-between; margin-top: 30px; }
button { border: none; border-radius: 8px; padding: 12px 24px; font-weight: 600; cursor: pointer; font-size: 0.95rem; transition: var(--transition); display: flex; align-items: center; gap: 8px; }
.btn-prev { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-prev:hover { background: #f3f4f6; color: var(--text-main); }
.btn-next { background: var(--primary); color: #fff; box-shadow: 0 4px 6px -1px rgba(10, 42, 102, 0.2); }
.btn-next:hover { background: var(--primary-light); transform: translateY(-1px); }
.btn-next:disabled { opacity: 0.7; cursor: not-allowed; }

/* Calculator */
.calculator-container { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 25px; }
.calc-grid { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.calc-inputs { display: flex; flex-direction: column; gap: 20px; }
.range-control { display: flex; flex-direction: column; gap: 8px; }
.range-header { display: flex; justify-content: space-between; align-items: center; }
input[type=range] { width: 100%; height: 6px; background: #cbd5e1; border-radius: 5px; outline: none; -webkit-appearance: none; padding: 0; border: none; background: #fafafa; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.calc-value-input { width: 100px !important; text-align: right; padding: 6px 10px !important; font-size: 0.9rem !important; }

/* Visual Results */
.calc-results { background: #fff; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.monthly-payment-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.monthly-payment-amount { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 15px; }
canvas { max-width: 180px; max-height: 180px; margin-bottom: 10px; }
.calc-legend { display: flex; gap: 15px; font-size: 0.8rem; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }

/* Utilities */
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-wrapper { text-align: center; padding: 20px 0; animation: scaleIn 0.5s ease; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.success-icon { width: 80px; height: 80px; background: #d1fae5; color: var(--success); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 40px; margin: 0 auto 20px; }
.ref-box { background: #f3f4f6; padding: 15px; border-radius: 8px; font-family: monospace; font-size: 1.1rem; color: var(--primary); margin: 20px 0; border: 1px dashed var(--primary-light); }
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; padding: 16px 20px; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); display: flex; align-items: center; gap: 12px; min-width: 300px; transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); border-left: 4px solid transparent; }
.toast.visible { transform: translateX(0); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

/* Mobile Responsive */
@media (max-width: 700px) {
    .calc-grid { grid-template-columns: 1fr; }
    .calc-results { order: -1; flex-direction: row; justify-content: space-around; padding: 15px; }
    .monthly-payment-amount { font-size: 1.5rem; }
    canvas { width: 60px; height: 60px; margin: 0; }
    .calc-legend { display: none; }
}