body {
    background: #f8f9fb;
    font-family: 'Poppins', sans-serif;
}

/* ================= INPUT CARD ================= */

.emi-card-box {
    max-width: 1200px;
    margin: auto;
    background: #fff;
    padding: 30px;
    border-radius: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

/* Desktop: all inputs in one row */
.emi-input-boxes {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.emi-input,
.toggle-holder {
    width: 22%;
}

.emi-input label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.emi-input input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fafafa;
}

/* ================= TENURE TOGGLE ================= */

.toggle-box {
    display: flex;
    height: 40px;
    border: 2px solid #ff416c;
    border-radius: 10px;
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    background: #fff;
    color: #ff416c;
}

.toggle-btn.active {
    background: #ff416c;
    color: #fff;
}

/* ================= CALCULATE BUTTON ================= */

.emi-btn {
    margin: 22px auto 0;
    display: block;
    width: 220px;
}

/* ================= RESULTS ================= */

.results-wrapper {
    display: none;
}

.results-wrapper.show {
    display: block;
}

.emi-output-card {
    max-width: 1100px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.print-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 16px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* ================= RESULT CARDS ================= */

.emi-result {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.emi-card {
    width: 250px;
    background: #fafafa;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.emi-card h3 {
    color: #ff416c;
}

.emi-card p {
    font-size: 22px;
    font-weight: 700;
}

/* ================= CHARTS ================= */

.emi-charts {
    margin-top: 40px;
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.chart-box {
    width: 380px;
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

#donutChart {
    max-height: 300px !important;
}

/* ================= TABLE ================= */

.table-toggle {
    text-align: center;
    margin-top: 40px;
}

.table-btn {
    padding: 10px 18px;
    border: 2px solid #ff416c;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    margin: 0 5px;
    font-weight: 600;
}

.table-btn.active {
    background: #ff416c;
    color: #fff;
}

.emi-table-box {
    margin-top: 20px;
    overflow-x: auto;
}

#emiTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

#emiTable th {
    padding: 12px;
    background: #ff416c;
    color: #fff;
}

#emiTable td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* =====================================
   EMI MOBILE FINAL FIX
   Tenure label on top
   Input + MTH/YR on same row
===================================== */
@media (max-width: 768px) {

  /* Stack all fields */
  .emi-input-boxes {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* All normal inputs full width */
  .emi-input {
    width: 100%;
  }

  /* TENURE BLOCK */
  .emi-input:nth-of-type(3) {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  /* Row for input + toggle */
  .emi-input:nth-of-type(3) .tenure-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* Tenure input width */
  .emi-input:nth-of-type(3) input {
    flex: 1;
  }

  /* Toggle stays same size */
  .toggle-box.tiny-toggle {
    width: 80px;
    height: 38px;
    margin: 0;
    flex-shrink: 0;
  }

  /* Charts stack */
  .emi-charts {
    flex-direction: column;
    gap: 20px;
  }

  /* Table scroll */
  .emi-table-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #emiTable {
    min-width: 600px;
  }
}


/* ================= PRINT ================= */

@media print {
    header,
    footer,
    .emi-card-box,
    .info-bar,
    .print-btn {
        display: none !important;
    }

    .emi-output-card {
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        padding: 0;
    }
}
