/* EMIFORMULA — UNIQUE PERSONAL LOAN / LOAN COST CALCULATOR */
.loan-page {
  box-sizing: border-box;
  --loan-ink: #172033;
  --loan-muted: #667085;
  --loan-line: #e5e7eb;
  --loan-accent: #0f766e;
  --loan-accent-2: #14b8a6;
  --loan-gold: #d97706;
  --loan-soft: #f0fdfa;
  --loan-error: #dc2626;
  color: var(--loan-ink);
}

.loan-page *,
.loan-page *::before,
.loan-page *::after {
  box-sizing: inherit;
}

.loan-wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0 64px;
}

.loan-hero {
  background: linear-gradient(135deg, #0b1324 0%, #0e3441 58%, #075e63 100%);
  color: #fff;
  border-radius: 28px;
  padding: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .16);
  margin-bottom: 20px;
}

.loan-hero::before {
  content: "";
  position: absolute;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  right: -120px;
  top: -170px;
  border: 58px solid rgba(45, 212, 191, .12);
}

.loan-hero::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  left: 48%;
  bottom: -125px;
  background: rgba(20, 184, 166, .08);
}

.loan-wrap .loan-hero h2 {
  color: #fff;
  margin: 0 0 10px;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  letter-spacing: -.035em;
  position: relative;
  z-index: 1;
}

.loan-wrap .loan-hero p {
  max-width: 760px;
  color: #d7e4ea;
  margin: 0;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.loan-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.loan-pill {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  font-size: .76rem;
  color: #fff;
}

/* Desktop/tablet: the calculator itself controls this grid. */
.loan-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(360px, 410px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.loan-grid > * {
  min-width: 0;
}

.loan-card {
  background: #fff;
  border: 1px solid var(--loan-line);
  border-radius: 24px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, .055);
}

.loan-input-card {
  padding: 24px;
}

.loan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.loan-card-head h3 {
  margin: 0 0 5px;
  color: var(--loan-ink);
}

.loan-card-head span {
  font-size: .78rem;
  color: var(--loan-muted);
}

.loan-field {
  margin-bottom: 20px;
}

.loan-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .83rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.loan-value {
  color: var(--loan-accent);
}

.loan-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--loan-line);
  border-radius: 14px;
  min-height: 52px;
  overflow: hidden;
  background: #fff;
}

.loan-input:focus-within {
  border-color: var(--loan-accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .08);
}

.loan-input > span {
  padding: 0 13px;
  color: var(--loan-muted);
  font-weight: 800;
}

.loan-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 2px solid transparent;
  outline-offset: 2px;
  height: 50px;
  font-size: 1rem;
  font-weight: 750;
  color: var(--loan-ink);
  background: #fff;
}

.loan-input input:focus-visible {
  outline-color: var(--loan-accent);
}

.loan-range {
  display: block;
  width: 100%;
  height: 7px;
  accent-color: var(--loan-accent);
  margin: 13px 0 0;
  cursor: pointer;
}

.loan-minmax {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: #667085;
  margin-top: 5px;
}

.loan-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.loan-advanced {
  border-top: 1px solid var(--loan-line);
  margin-top: 20px;
  padding-top: 16px;
}

.loan-advanced summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--loan-ink);
  list-style: none;
}

.loan-advanced summary::-webkit-details-marker {
  display: none;
}

.loan-advanced summary::after {
  content: "+";
  float: right;
  color: var(--loan-accent);
}

.loan-advanced[open] summary::after {
  content: "−";
}

.loan-advanced-body {
  padding-top: 16px;
}

.loan-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 22px;
}

.loan-btn {
  border: 0;
  border-radius: 13px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.loan-btn:hover {
  transform: translateY(-1px);
}

.loan-btn-primary {
  background: var(--loan-accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .2);
}

.loan-btn-secondary {
  background: #eef2f7;
  color: var(--loan-ink);
}

.loan-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -4px 0 18px;
}

.loan-preset {
  border: 1px solid #d7dee7;
  background: #fff;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .72rem;
  font-weight: 800;
  color: #344054;
  cursor: pointer;
}

.loan-preset.active,
.loan-preset:hover {
  border-color: #99d8d0;
  background: var(--loan-soft);
  color: #075e63;
}

.loan-note {
  font-size: .75rem;
  color: var(--loan-muted);
  line-height: 1.55;
  margin-top: 10px;
}

.loan-error {
  color: var(--loan-error);
  font-size: .76rem;
  min-height: 18px;
  margin-top: 8px;
}

.loan-results {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.loan-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.loan-kpi {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--loan-line);
  border-radius: 18px;
  background: #fff;
  transition: transform .25s ease, box-shadow .25s ease;
}

.loan-kpi.flash {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(15, 118, 110, .1);
}

.loan-kpi small {
  display: block;
  color: var(--loan-muted);
  font-size: .75rem;
  font-weight: 750;
}

.loan-kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
  color: var(--loan-ink);
  overflow-wrap: anywhere;
}

.loan-main-result {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
}

.loan-donut-box {
  display: grid;
  place-items: center;
}

.loan-donut {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: conic-gradient(var(--loan-accent) 0 75%, var(--loan-gold) 75% 100%);
  position: relative;
  transition: background .45s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .03);
}

.loan-donut::after {
  content: "";
  position: absolute;
  inset: 27px;
  background: #fff;
  border-radius: 50%;
}

.loan-donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  text-align: center;
}

.loan-donut-center strong {
  font-size: 1.1rem;
}

.loan-donut-center span {
  font-size: .7rem;
  color: var(--loan-muted);
}

.loan-breakdown {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 10px;
}

.loan-breakdown h3 {
  margin: 0 0 4px;
}

.loan-break-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: .83rem;
}

.loan-break-row strong {
  white-space: nowrap;
}

.loan-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--loan-accent);
}

.loan-dot.gold {
  background: var(--loan-gold);
}

.loan-bar {
  height: 9px;
  background: #eef2f7;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 2px;
}

.loan-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--loan-accent);
  border-radius: 99px;
  transition: width .55s ease;
}

.loan-bar.gold i {
  background: var(--loan-gold);
}

.loan-timeline {
  padding: 20px;
}

.loan-timeline h3 {
  margin: 0;
}

.loan-timeline-line {
  height: 11px;
  background: #e8eef0;
  border-radius: 99px;
  overflow: hidden;
  margin: 18px 0;
}

.loan-timeline-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--loan-accent), var(--loan-accent-2));
  transition: width .7s ease;
}

.loan-timeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: .76rem;
  color: var(--loan-muted);
}

.loan-analysis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.loan-panel {
  min-width: 0;
  padding: 20px;
}

.loan-panel h3 {
  margin: 0 0 14px;
  color: var(--loan-ink);
  font-size: 1rem;
}

.loan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}

.loan-table th,
.loan-table td {
  padding: 9px 6px;
  border-bottom: 1px solid #edf0f4;
  text-align: right;
  white-space: nowrap;
}

.loan-table th:first-child,
.loan-table td:first-child {
  text-align: left;
}

.loan-table th {
  color: var(--loan-muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.loan-table tr.current td {
  font-weight: 850;
  background: #f0fdfa;
}

.loan-bars {
  display: grid;
  gap: 11px;
}

.loan-bar-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 86px;
  gap: 8px;
  align-items: center;
  font-size: .75rem;
}

.loan-bar-track {
  height: 10px;
  background: #eef2f7;
  border-radius: 99px;
  overflow: hidden;
}

.loan-bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--loan-accent), var(--loan-accent-2));
  border-radius: 99px;
  width: 0;
  transition: width .6s ease;
}

.loan-chart-wrap {
  overflow: hidden;
}

.loan-chart {
  width: 100%;
  height: 210px;
  display: block;
}

.loan-chart-grid {
  stroke: #e8edf2;
  stroke-width: 1;
}

.loan-chart-line {
  fill: none;
  stroke: var(--loan-accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 700;
  stroke-dashoffset: 700;
  animation: loanDraw .9s ease forwards;
}

.loan-chart-area {
  fill: rgba(20, 184, 166, .09);
}

@keyframes loanDraw {
  to { stroke-dashoffset: 0; }
}

.loan-chart-label {
  font-size: 11px;
  fill: #667085;
}

.loan-section {
  margin-top: 28px;
}

.loan-section > h2 {
  color: var(--loan-ink);
}

.loan-section p {
  color: #4b5563;
  line-height: 1.75;
}

.loan-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.loan-info-card {
  padding: 22px;
}

.loan-info-card h3 {
  color: var(--loan-ink);
}

.loan-formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #0f172a;
  color: #e2e8f0;
  padding: 17px;
  border-radius: 14px;
  overflow: auto;
  font-size: .8rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.loan-example {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 16px;
  border-radius: 15px;
}

.loan-faq {
  display: grid;
  gap: 10px;
}

.loan-faq details {
  background: #fff;
  border: 1px solid var(--loan-line);
  border-radius: 14px;
  padding: 15px 17px;
}

.loan-faq summary {
  font-weight: 800;
  cursor: pointer;
}

.loan-faq p {
  margin: 9px 0 0;
  font-size: .88rem;
}

/* Search glyph fallback: avoids missing-glyph squares in older browsers. */
.loan-page ~ * {}
.header-icon-button > span[aria-hidden="true"] {
  display: inline-block;
  width: 16px;
  height: 16px;
  position: relative;
  font-size: 0;
}

.header-icon-button > span[aria-hidden="true"]::before {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
  left: 0;
  top: 0;
}

.header-icon-button > span[aria-hidden="true"]::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
  left: 10px;
  top: 11px;
  border-radius: 2px;
}

/* Keep input and results side-by-side on desktop and wider tablets. */
@media (min-width: 601px) {
  .loan-grid {
    grid-template-columns: minmax(300px, 38%) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  /* Desktop: keep the same direction as the other calculators. */
  .loan-input-card {
    grid-column: 1;
    grid-row: 1;
  }

  .loan-results {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .loan-grid {
    grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
    gap: 14px;
  }

  .loan-input-card,
  .loan-panel,
  .loan-timeline,
  .loan-main-result {
    padding: 18px;
  }

  .loan-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loan-main-result {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
  }

  .loan-donut {
    width: 150px;
    height: 150px;
  }

  .loan-donut::after {
    inset: 22px;
  }
}

@media (max-width: 600px) {
  .loan-input-card,
  .loan-results {
    grid-column: auto;
    grid-row: auto;
  }
  .loan-grid {
    grid-template-columns: 1fr;
  }

  .loan-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loan-main-result,
  .loan-analysis,
  .loan-guide-grid {
    grid-template-columns: 1fr;
  }

  .loan-donut-box {
    padding: 5px;
  }
}

@media (max-width: 560px) {
  .loan-hero,
  .loan-input-card,
  .loan-panel,
  .loan-timeline,
  .loan-main-result {
    padding: 18px;
    border-radius: 20px;
  }

  .loan-kpis {
    gap: 8px;
  }

  .loan-kpi {
    padding: 13px;
  }

  .loan-kpi strong {
    font-size: .95rem;
  }

  .loan-two,
  .loan-actions {
    grid-template-columns: 1fr;
  }

  .loan-bar-row {
    grid-template-columns: 40px minmax(0, 1fr) 72px;
  }

  .loan-donut {
    width: 165px;
    height: 165px;
  }

  .loan-chart {
    height: 175px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loan-page *,
  .loan-page *::before,
  .loan-page *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
