.emi-page{
    padding:24px 0 40px;
    background:linear-gradient(180deg,#f4f7fb 0%,#edf3fa 100%);
}

.emi-page .container{
    width:min(1480px, calc(100% - 64px));
    max-width:1480px;
}

.page-title{
    font-size:40px;
    font-weight:700;
    color:#0a2c5e;
    text-align:center;
}

.page-sub{
    text-align:center;
    margin:12px auto 42px;
    color:#66758d;
    max-width:620px;
}

.emi-top{
    display:grid;
    grid-template-columns:minmax(320px,420px) minmax(720px,1fr);
    gap:28px;
    align-items:start;
}

.emi-controls,
.emi-result,
.emi-table-wrap,
.emi-card{
    background:rgba(255,255,255,.92);
    border:1px solid rgba(221,229,238,.9);
    box-shadow:0 18px 42px rgba(17,43,80,.08);
}

.emi-controls{
    padding:26px;
    border-radius:24px;
    position:sticky;
    top:110px;
}

.emi-controls label{
    font-size:14px;
    margin-top:18px;
    display:block;
    color:#102f5d;
    font-weight:600;
}

.range-val{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding-top:8px;
    font-weight:700;
    color:#ff7a00;
    margin-bottom:6px;
    min-height:24px;
}

.emi-controls input[type=range]{
    width:100%;
    appearance:none;
    -webkit-appearance:none;
    height:8px;
    border-radius:999px;
    background:linear-gradient(to right,#0a66ff 50%,#dbe3ef 50%);
    outline:none;
}

.emi-controls input[type=range]::-webkit-slider-runnable-track{
    height:8px;
    border-radius:999px;
    background:transparent;
}

.emi-controls input[type=range]::-webkit-slider-thumb{
    -webkit-appearance:none;
    appearance:none;
    width:22px;
    height:22px;
    margin-top:-7px;
    border-radius:50%;
    background:linear-gradient(135deg,#ff7a00,#ff9a3d);
    border:4px solid #fff;
    box-shadow:0 10px 20px rgba(255,122,0,.25);
    cursor:pointer;
}

.emi-controls input[type=range]::-moz-range-track{
    height:8px;
    border-radius:999px;
    background:transparent;
}

.emi-controls input[type=range]::-moz-range-thumb{
    width:22px;
    height:22px;
    border:none;
    border-radius:50%;
    background:linear-gradient(135deg,#ff7a00,#ff9a3d);
    box-shadow:0 10px 20px rgba(255,122,0,.25);
    cursor:pointer;
}

#loanTypeSelect{
    width:100%;
    padding:12px 14px;
    border-radius:16px;
    border:1px solid #dce3ec;
    font-size:14px;
    background:white;
    transition:.25s;
    margin-bottom:4px;
}

#loanTypeSelect:focus{
    outline:none;
    border-color:#0b3c6f;
    box-shadow:0 0 0 3px rgba(11,60,111,.12);
}

.apply-btn{
    display:block;
    background:linear-gradient(135deg,#ff7a00 0%,#ff9a3d 100%);
    color:white;
    text-align:center;
    padding:13px 18px;
    border-radius:999px;
    margin-top:22px;
    text-decoration:none;
    border:none;
}

.apply-btn.is-disabled{
    background:#dbe3ef;
    color:#6b7890;
    cursor:not-allowed;
    box-shadow:none;
    pointer-events:auto;
}

.download-btn{
    width:100%;
    margin-top:12px;
    padding:13px 18px;
    border-radius:999px;
    border:1.5px solid #0a2c5e;
    background:white;
    color:#0a2c5e;
    cursor:pointer;
    font-weight:600;
}

.emi-result{
    padding:30px;
    border-radius:26px;
    overflow:hidden;
    width:100%;
    min-width:0;
    box-sizing:border-box;
}

.emi-chart-box{
    display:grid;
    grid-template-columns:minmax(330px,1fr) minmax(240px,260px);
    align-items:center;
    gap:24px;
    width:100%;
    min-width:0;
    overflow:hidden;
}

.emi-result-left{
    min-width:0;
}

.emi-result-left h3{
    color:#5f6f86;
    font-size:15px;
    font-weight:600;
}

.emi-big{
    font-size:clamp(32px,3.2vw,44px);
    font-weight:700;
    color:#0a2c5e;
    margin:10px 0 24px;
    line-height:1.08;
    overflow-wrap:anywhere;
}

.emi-stats{
    display:grid;
    grid-template-columns:repeat(2,minmax(170px,1fr));
    gap:12px;
}

.emi-stats div{
    padding:14px 16px;
    border-radius:18px;
    background:#f4f7fb;
    min-width:0;
}

.emi-stats label{
    font-size:13px;
    color:#777;
}

.emi-stats p{
    font-size:clamp(16px,1.5vw,18px);
    font-weight:600;
    margin-top:8px;
    overflow-wrap:anywhere;
}

.emi-chart-right{
    width:250px;
    height:250px;
    justify-self:end;
    margin-left:0;
    max-width:100%;
}

.emi-chart-right canvas{
    width:100% !important;
    height:100% !important;
}

.emi-table-wrap{
    margin-top:32px;
    padding:24px;
    border-radius:24px;
    overflow-x:auto;
}

#emiTable{
    width:100%;
    border-collapse:collapse;
    margin-top:20px;
    min-width:640px;
}

#emiTable th,
#emiTable td{
    padding:12px 10px;
    border-bottom:1px solid #eee;
    text-align:center;
}

#emiTable th{
    background:#f4f7fb;
}

.emi-section{
    padding:60px 0;
    background:#f5f7fb;
}

.emi-card{
    display:flex;
    gap:50px;
    padding:35px;
    border-radius:24px;
}

.emi-form{
    width:40%;
}

.emi-form label{
    display:block;
    margin-top:15px;
    font-weight:600;
}

.emi-form input,
.emi-form select{
    width:100%;
    max-width:100%;
    box-sizing:border-box;
    padding:12px;
    border-radius:12px;
    border:1px solid #ddd;
    margin-top:6px;
}

.emi-form button{
    margin-top:20px;
    background:#0b3c6f;
    color:white;
    border:none;
    padding:14px;
    width:100%;
    border-radius:25px;
    cursor:pointer;
}

.emi-card .emi-result{
    width:60%;
    text-align:center;
}

.metrics{
    display:flex;
    justify-content:space-between;
    margin-top:30px;
    gap:15px;
}

.metrics div{
    background:#f4f7fb;
    padding:18px;
    border-radius:12px;
    width:30%;
}

@media(max-width:1180px){

    .emi-top{
        grid-template-columns:1fr;
    }

    .emi-controls{
        width:100%;
        position:static;
    }

    .emi-chart-box,
    .emi-card{
        grid-template-columns:1fr;
        flex-direction:column;
    }

    .emi-form,
    .emi-result{
        width:100%;
    }

    .emi-chart-right{
        margin:0 auto;
        justify-self:center;
    }

}

@media(max-width:1024px){
    .emi-page .container{
        width:min(980px, calc(100% - 40px));
    }
}

@media(max-width:768px){

    .page-title{
        font-size:30px;
    }

    .page-sub{
        margin-bottom:28px;
    }

    .emi-controls,
    .emi-result,
    .emi-table-wrap,
    .emi-card{
        padding:20px;
        border-radius:20px;
    }

    .emi-big{
        font-size:32px;
    }

    .emi-stats,
    .metrics{
        grid-template-columns:1fr;
        flex-direction:column;
    }

    .metrics div{
        width:100%;
    }

    .emi-chart-right{
        width:220px;
        height:220px;
    }

}

@media(max-width:500px){
    html,
    body{
        overflow-x:hidden;
    }

    .emi-section{
        padding:28px 10px 54px;
    }

    .page-title{
        font-size:22px;
        line-height:1.18;
        padding:0 10px;
    }

    .page-sub{
        font-size:14px;
        padding:0 12px;
    }

    .emi-big{
        font-size:26px;
        overflow-wrap:anywhere;
    }

    .range-val{
        font-size:14px;
    }

    .emi-top,
    .emi-card,
    .emi-chart-box{
        width:100%;
        max-width:100%;
        gap:16px;
    }

    .emi-controls,
    .emi-result,
    .emi-table-wrap,
    .emi-card{
        width:100%;
        max-width:100%;
        padding:16px;
        border-radius:16px;
        box-sizing:border-box;
        overflow:hidden;
    }

    .emi-controls label,
    .emi-form label{
        font-size:12px;
    }

    #loanTypeSelect,
    .emi-form input,
    .emi-form select{
        min-width:0;
        width:100%;
        max-width:100%;
        box-sizing:border-box;
        font-size:12px;
        padding:10px;
        border-radius:12px;
    }

    .emi-form{
        width:100%;
        min-width:0;
    }

    .emi-form button,
    .apply-btn,
    .download-btn{
        width:100%;
        max-width:100%;
        box-sizing:border-box;
        font-size:12px;
        padding:12px 14px;
    }

    .emi-result{
        width:100%;
        min-width:0;
    }

    .metrics{
        gap:10px;
        margin-top:18px;
    }

    .metrics div{
        width:100%;
        padding:14px;
        box-sizing:border-box;
    }

    .emi-chart-right{
        width:min(210px, 78vw);
        height:min(210px, 78vw);
    }

    #emiTable{
        min-width:0;
        font-size:12px;
    }

}
