:root {
  --bg: #0b1220;
  --bg-soft: #0f1a2e;
  --surface: #ffffff;
  --surface-alt: #f5f8ff;
  --ink: #0f1a2e;
  --ink-soft: #52627a;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --principal: #2563eb;
  --interest: #f59e0b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 26, 46, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 26, 46, 0.12);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, #1e3a8a 0%, transparent 55%),
    linear-gradient(180deg, #0b1220 0%, #0f1a2e 100%);
  min-height: 100vh;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  padding: 22px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #22d3ee);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}
.brand-name {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand-tag {
  color: #9fb3d1;
  font-size: 14px;
}
a.brand { text-decoration: none; }

/* Navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.main-nav a {
  color: #c7d6ee;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color .15s;
}
.main-nav a:hover { color: #fff; }

/* Content sections (About / FAQ) */
.content-section { margin: 22px auto; }
.content-section p {
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.content-section p:last-child { margin-bottom: 0; }
.content-section code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 13px;
}
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 18px;
  color: var(--brand);
  font-weight: 800;
}
.faq-item[open] summary::before { content: "\2212"; }
.faq-item p {
  margin: 10px 0 0 18px;
}

/* Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 22px;
  padding-bottom: 10px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px;
}
.card-title {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* Form */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
input[type="number"], select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface-alt);
  transition: border-color .15s, box-shadow .15s;
}
input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #fff;
}
input.invalid { border-color: var(--danger); }
.tenure-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}
.error {
  display: block;
  min-height: 16px;
  margin-top: 6px;
  color: var(--danger);
  font-size: 12.5px;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost {
  background: #eef2f9;
  color: var(--ink);
}
.btn-ghost:hover { background: #e3e9f4; }

/* Result highlight */
.emi-highlight {
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  margin-bottom: 18px;
}
.emi-label {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
  font-weight: 600;
}
.emi-value {
  display: block;
  margin-top: 6px;
  font-size: 34px;
  font-weight: 800;
  color: var(--brand-dark);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.summary-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.summary-item--total {
  grid-column: 1 / -1;
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.summary-label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}
.summary-value {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* Donut chart */
.chart-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.donut {
  width: 150px;
  height: 150px;
  transform: rotate(-90deg);
}
.donut-ring {
  fill: none;
  stroke: #eef2f9;
  stroke-width: 5;
}
.donut-segment {
  fill: none;
  stroke-width: 5;
  transition: stroke-dasharray .6s ease;
}
.donut-principal { stroke: var(--principal); }
.donut-interest { stroke: var(--interest); }
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--ink-soft);
}
.legend b { color: var(--ink); }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot-principal { background: var(--principal); }
.dot-interest { background: var(--interest); }

/* Amortization */
.amort-section { margin: 22px auto; }
.amort-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.amort-header .card-title { margin: 0; }
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
}
.table-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}
.amort-table th, .amort-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.amort-table th:first-child, .amort-table td:first-child { text-align: left; }
.amort-table thead th {
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-weight: 700;
  position: sticky;
  top: 0;
}
.amort-table tbody tr:nth-child(even) { background: #fafbfe; }
.amort-table tbody tr:hover { background: #eff6ff; }
.amort-table .year-row { font-weight: 700; }

/* Ads */
.ad-section {
  margin: 22px auto;
  text-align: center;
}
.ad-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9fb3d1;
  margin-bottom: 8px;
}
.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  overflow: hidden;
}

/* Footer */
.site-footer {
  margin-top: 20px;
  padding: 40px 0 24px;
  background: rgba(3, 8, 18, 0.35);
  border-top: 1px solid rgba(159, 179, 209, 0.15);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 26px;
}
.footer-brand .brand { margin-bottom: 10px; }
.footer-desc {
  color: #9fb3d1;
  font-size: 14px;
  margin: 0;
  max-width: 340px;
}
.footer-col h3 {
  color: #fff;
  font-size: 15px;
  margin: 0 0 12px;
}
.footer-col a {
  display: block;
  color: #9fb3d1;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  transition: color .15s;
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(159, 179, 209, 0.15);
  padding-top: 18px;
  text-align: center;
}
.footer-bottom p {
  color: #9fb3d1;
  font-size: 13px;
  margin: 0;
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
}

/* Responsive */
@media (max-width: 860px) {
  .main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .card { padding: 20px; }
  .emi-value { font-size: 28px; }
  .summary-grid { grid-template-columns: 1fr; }
  .btn-row { flex-direction: column; }
  .brand-tag { display: none; }
}
