@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root{
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --green: #16a34a;
  --ink: #1e293b;
  --muted: #64748b;
  --border: #e5e7eb;
  --bg-soft: #f8fafc;
}

*{
  margin:0;
  padding:0;
  font-family:'Poppins',sans-serif;
}

*,
*::before,
*::after{
    box-sizing:border-box;
}

html,
body{
    width:100%;
    overflow-x:hidden;
}

body{
  background:linear-gradient(180deg,#f1f5fb 0%,#eef2f7 100%);
  /*padding:30px 18px 60px;*/
  color:var(--ink);
}

.page{
    max-width:1280px;
    margin:0 auto;
    width:100%;
    overflow-x:hidden;
}
.canvas-wrap{
    width:100%;
    overflow:hidden;
}

canvas{
    max-width:100% !important;
}
.table-wrap{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

/* HERO */

.hero{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:16px;
  background:linear-gradient(120deg,#1d4ed8,#2563eb 55%,#3b82f6);
  color:#fff;
  padding:30px 36px;
  border-radius:16px;
  margin-bottom:24px;
  box-shadow:0 10px 30px rgba(37,99,235,.25);
}

.hero-text h1{
  font-size:26px;
  font-weight:700;
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:6px;
  color: #fff;
}

.badge{
  background:rgba(255,255,255,.2);
  border:1px solid rgba(255,255,255,.5);
  font-size:11px;
  font-weight:700;
  padding:3px 10px;
  border-radius:20px;
  letter-spacing:1px;
}

.hero-text p{
  font-size:14px;
  color:#dbeafe;
}

.hero button{
  background:#fff;
  color:var(--primary-dark);
  border:none;
  padding:12px 20px;
  border-radius:10px;
  font-weight:600;
  font-size:14px;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:8px;
  transition:.2s;
}

.hero button:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,.15);
}

/* LAYOUT */

.layout{
  display:grid;
  grid-template-columns:360px 1fr;
  gap:22px;
  align-items:start;
}

.panel{
  background:#fff;
  border-radius:16px;
  padding:28px;
  box-shadow:0 6px 24px rgba(15,23,42,.06);
}
.panel{
    width:100%;
    max-width:100%;
    min-width:0;
}

/* INPUTS */

.field{
  margin-bottom:26px;
}

.field-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;

}

.field-top label{
  font-weight:600;
  font-size:14.5px;
  color:var(--ink);
}

.value-pill{
  display:flex;
  align-items:center;
  gap:4px;
  background:var(--bg-soft);
  border:1px solid var(--border);
  border-radius:8px;
  padding:6px 12px;
  min-width:120px;
  justify-content:center;
  width: 60px;
}

.value-pill.small{
  min-width:110px;
}

.value-pill span{
  font-size:14px;
  font-weight:600;
  color:var(--muted);
}

.value-pill input, .value-pill select{
  border:none;
  outline:none;
  background:transparent;
  font-size:15px;
  font-weight:700;
  color:var(--ink);
  width:100%;
  text-align:right;
}

.select-pill select{
  text-align:left;
  cursor:pointer;
}

input[type="range"]{
  -webkit-appearance:none;
  width:100%;
  height:6px;
  border-radius:4px;
  background:linear-gradient(90deg,var(--primary),var(--primary) var(--fill,50%),#e2e8f0 var(--fill,50%));
  outline:none;
  margin-bottom:8px;
}

input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  border:4px solid var(--primary);
  box-shadow:0 2px 6px rgba(0,0,0,.25);
  cursor:pointer;
}

input[type="range"]::-moz-range-thumb{
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  border:4px solid var(--primary);
  box-shadow:0 2px 6px rgba(0,0,0,.25);
  cursor:pointer;
}

.range-labels{
  display:flex;
  justify-content:space-between;
  font-size:12px;
  color:var(--muted);
}

.down-pct{
  font-size:12.5px;
  color:var(--primary-dark);
  font-weight:600;
}

.loan-amount-field{
  background:#f0f7ff;
  border:1px dashed #93c5fd;
  border-radius:10px;
  padding:14px 16px;
}

.loan-amount-field label{
  display:block;
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  margin-bottom:4px;
}

.loan-amount-display{
  font-size:22px;
  font-weight:800;
  color:var(--primary-dark);
}

.inline-field label{
  display:flex;
  align-items:center;
  gap:6px;
  font-weight:600;
  font-size:14.5px;
  margin-bottom:10px;
}

.segmented{
  display:flex;
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
}

.seg-btn{
  flex:1;
  padding:10px;
  border:none;
  background:#fff;
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  cursor:pointer;
  transition:.2s;
}

.seg-btn.active{
  background:var(--primary);
  color:#fff;
}

.prepay-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.prepay-header label i{
  color:var(--accent);
}

.switch{
  position:relative;
  display:inline-block;
  width:42px;
  height:24px;
  flex-shrink:0;
}

.switch input{
  opacity:0;
  width:0;
  height:0;
}

.slider-toggle{
  position:absolute;
  cursor:pointer;
  inset:0;
  background:#cbd5e1;
  border-radius:24px;
  transition:.2s;
}

.slider-toggle::before{
  content:"";
  position:absolute;
  width:18px;
  height:18px;
  left:3px;
  bottom:3px;
  background:#fff;
  border-radius:50%;
  transition:.2s;
}

.switch input:checked + .slider-toggle{
  background:var(--primary);
}

.switch input:checked + .slider-toggle::before{
  transform:translateX(18px);
}

.prepay-fields{
  margin-top:14px;
  transition:.2s;
}

.prepay-fields.disabled{
  opacity:.4;
  pointer-events:none;
}

.prepay-row{
  display:flex;
  gap:10px;
}

.hint{
  font-size:12px;
  color:var(--muted);
  margin-top:8px;
}

/* SUMMARY CARDS */

.summary-cards{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:20px;
}

.summary-card{
  background:var(--bg-soft);
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.summary-card .label{
  font-size:12.5px;
  color:var(--muted);
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.3px;
}

.summary-card .value{
  font-size:20px;
  font-weight:700;
  color:var(--ink);
}

.highlight-card{
  background:linear-gradient(135deg,#1d4ed8,#3b82f6);
  border:none;
}

.highlight-card .label{
  color:#dbeafe;
}

.highlight-card .value{
  color:#fff;
  font-size:24px;
}

.prepay-summary{
  display:flex;
  align-items:flex-start;
  gap:10px;
  background:#f0fdf4;
  border:1px solid #bbf7d0;
  color:#166534;
  padding:14px 16px;
  border-radius:10px;
  font-size:13.5px;
  margin-bottom:24px;
  line-height:1.5;
}

.prepay-summary i{
  color:var(--green);
  margin-top:2px;
}

/* CHARTS */

.charts-row{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:20px;
  margin-bottom:20px;
}

.chart-box{
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
}

.chart-box.full{
  margin-bottom:30px;
}

.chart-box h3{
  font-size:14px;
  font-weight:600;
  margin-bottom:14px;
  color:var(--ink);
}

.canvas-wrap{
  position:relative;
  width:100%;
}

.pie-wrap{
  height:210px;
}

.line-wrap{
  height:240px;
}

.bar-wrap{
  height:220px;
}

.legend-custom{
  display:flex;
  justify-content:center;
  gap:18px;
  margin-top:14px;
  font-size:12.5px;
  color:var(--muted);
}

.legend-custom span{
  display:flex;
  align-items:center;
  gap:6px;
}

.legend-custom i{
  width:10px;
  height:10px;
  border-radius:3px;
  display:inline-block;
}

.legend-custom b{
  color:var(--ink);
}

/* TABLE */

.table-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:14px;
}

.table-header h3{
  font-size:15px;
  font-weight:600;
}

.table-toggle{
  display:flex;
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
}

.table-toggle .toggle-btn{
  padding:7px 16px;
  border:none;
  background:#fff;
  font-size:12.5px;
  font-weight:600;
  color:var(--muted);
  cursor:pointer;
}

.table-toggle .toggle-btn.active{
  background:var(--primary);
  color:#fff;
}

.table-wrap{
  max-height:340px;
  overflow-y:auto;
  border:1px solid var(--border);
  border-radius:10px;
}

table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

thead th{
  position:sticky;
  top:0;
  background:var(--bg-soft);
  color:var(--ink);
  padding:12px 10px;
  text-align:right;
  font-weight:600;
  border-bottom:2px solid var(--border);
}

thead th:first-child, tbody td:first-child{
  text-align:left;
  padding-left:14px;
}

tbody td{
  padding:9px 10px;
  text-align:right;
  border-bottom:1px solid #f1f5f9;
}

tbody tr:hover{
  background:var(--bg-soft);
}

/* RESPONSIVE */

@media(max-width:1000px){
  .panel 
  {
    padding: 10px;
  }
  .layout{
    grid-template-columns:1fr;
  }
  .charts-row{
    grid-template-columns:1fr;
  }
  .summary-cards{
    grid-template-columns:repeat(2,1fr);
  }
}
@media(max-width:576px){
  .panel{
    padding:10px;
    width:100%;      /* 100vw ki jagah */
    max-width:100%;
  }

  .segmented{
    flex-direction:column;
  }
}

@media print{
  .hero button, .table-toggle, .segmented, input[type="range"], .switch{
    display:none;
  }
}

