:root {
  --navy: #002654;
  --gold: #c89200;
  --bg: #f5f7fb;
  --text: #17243a;
  --border: #dfe5ee;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
/* header {
  background: var(--navy);
  color: white;
  padding: 22px 5%;
}
header h1 { margin: 0; font-size: 25px; }
header p { margin: 8px 0 0; color: #dce6f3; } */
nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px 5%;
  background: #000;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

nav button {
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--navy);
  cursor: pointer;
  font-weight: bold;
}
nav button.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
}
main {
  max-width: 950px;
  margin: 35px auto;
  padding: 0 18px;
}
.calculator {
  display: none;
  background: white;
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 28px;
  box-shadow: 0 10px 30px #0026540d;
}
.calculator.active { display: block; }
h2 { margin-top: 0; color: var(--navy); }
.description { color: #657287; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
label { font-weight: bold; font-size: 14px; }
input, select {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: white;
}
input:focus, select:focus {
  outline: 2px solid #c8920066;
  border-color: var(--gold);
}
.result {
  margin-top: 24px;
  padding: 20px;
  border-radius: 10px;
  background: #fff8e5;
  border: 1px solid #f0d88c;
}
.result small { display: block; color: #695827; }
.result strong {
  display: block;
  margin-top: 7px;
  font-size: 29px;
  color: var(--navy);
  overflow-wrap: anywhere;
}
.note { color: #6c7685; font-size: 13px; line-height: 1.6; }
.loan-amount-words {
  color: #997000;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.emi-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.emi-breakdown-item {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f5f7fb;
}
.emi-breakdown-item span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #657287;
}
.emi-breakdown-item strong {
  display: block;
  color: var(--navy);
  font-size: 20px;
  overflow-wrap: anywhere;
}
.emi-total {
  background: #fff8e5;
  border-color: #f0d88c;
}

.emi-advanced { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: #fafbfd; }
.emi-advanced summary { cursor: pointer; color: var(--navy); font-weight: 700; }
.emi-advanced summary span { font-size: 12px; font-weight: 400; color: #69768a; margin-left: 8px; }
.emi-additional { margin-top: 14px; }
.emi-visuals { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; margin-top: 24px; }
.emi-chart-card { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.emi-chart-card h3, .emi-schedule-heading h3 { margin: 0 0 16px; color: var(--navy); font-size: 17px; }
.emi-chart-layout { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.emi-chart-layout canvas { width: 190px; height: 190px; max-width: 100%; }
#emiBalanceChart { width: 100%; height: 220px; }
.emi-legend p { margin: 10px 0; color: #566176; font-size: 13px; }
.emi-legend strong { display: block; color: var(--navy); padding-left: 19px; }
.emi-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; }
.principal-dot { background: #002654; }
.interest-dot { background: #c89200; }
.emi-schedule-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 30px; }
.emi-schedule-heading h3 { margin-bottom: 5px; }
.emi-download { padding: 12px 18px; border: 0; border-radius: 8px; background: var(--navy); color: white; font-weight: 700; cursor: pointer; white-space: nowrap; }
.emi-download:hover { background: #c89200; color: #111; }
.emi-download:disabled { opacity: .5; cursor: not-allowed; }
.emi-table-wrap { overflow: auto; max-height: 520px; margin-top: 15px; border: 1px solid var(--border); border-radius: 10px; }
.emi-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.emi-table th { position: sticky; top: 0; background: var(--navy); color: white; text-align: right; padding: 13px 12px; }
.emi-table td { text-align: right; padding: 11px 12px; border-bottom: 1px solid #edf0f5; }
.emi-table th:nth-child(-n+2), .emi-table td:nth-child(-n+2) { text-align: left; }
.emi-table tbody tr:nth-child(even) { background: #f8fafd; }
@media (max-width: 760px) {
  .emi-visuals { grid-template-columns: 1fr; }
  .emi-schedule-heading { align-items: flex-start; flex-direction: column; }
}
.metric-list { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.metric-list:empty { display: none; }
.metric-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.metric-list > div:last-child { border-bottom: 0; }
.metric-list span { color: #657287; }
.metric-list strong { text-align: right; color: var(--navy); }
.field[hidden] { display: none !important; }
footer {
  padding: 28px;
  text-align: center;
  color: #687386;
}
@media (max-width: 600px) {
  .grid, .emi-breakdown { grid-template-columns: 1fr; }
  .calculator { padding: 20px; }
  header h1 { font-size: 21px; }
  .result strong { font-size: 24px; } 
}