.loan-calc-page {
  padding: clamp(1rem, 3vw, 1.5rem) 0 4rem;
  overflow: visible;
  scroll-margin-top: calc(var(--nav-height, 88px) + 0.75rem);
}

.loan-calc-page.container {
  overflow: visible;
}

#loan-calc-mount {
  scroll-margin-top: calc(var(--nav-height, 88px) + env(safe-area-inset-top, 0px) + 0.75rem);
}

#loan-calc-mount [data-bc-loan-calc="1"] .tpl-loan-calc__card {
  overflow: visible;
}

.loan-calc-hero {
  text-align: center;
  max-width: 44rem;
  margin: 0 auto 1.25rem;
  scroll-margin-top: calc(var(--nav-height, 88px) + 0.75rem);
}

@media (max-width: 820px) {
  .loan-calc-page {
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
  }

  .loan-calc-hero {
    margin-bottom: 0.85rem;
  }

  .loan-calc-hero h1 {
    font-size: clamp(1.45rem, 5vw, 1.85rem);
  }

  .loan-calc-hero p {
    font-size: 0.92rem;
  }
}

.loan-calc-hero__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 86, 210, 0.1);
  color: #0056d2;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.loan-calc-hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  line-height: 1.12;
}

.loan-calc-hero p {
  margin: 0;
  color: var(--muted, #5b6474);
  font-size: 1.02rem;
  line-height: 1.55;
}

.loan-calc-hero__jump {
  margin: 0.85rem 0 0;
}

.loan-calc-hero__jump-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 86, 210, 0.35);
  color: #0056d2;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  background: rgba(0, 86, 210, 0.06);
}

.loan-calc-shell {
  max-width: min(960px, 100%);
  margin: 0 auto;
  --tpl-brand: #0056d2;
  --tpl-brand-soft: rgba(0, 86, 210, 0.12);
  --tpl-line: rgba(15, 23, 42, 0.12);
  --tpl-muted: #64748b;
  --tpl-text: #0f172a;
}

.loan-calc-note {
  max-width: 44rem;
  margin: 1.35rem auto 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted, #5b6474);
  line-height: 1.5;
}

.loan-calc-note a {
  color: #0056d2;
  font-weight: 600;
}

/* —— Guide + sticky TOC (Bankrate-style) —— */
.loan-calc-guide-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: min(1100px, 100%);
  margin: 2.75rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid #e2e8f0;
  overflow: visible;
}

@media (min-width: 960px) {
  .loan-calc-guide-wrap {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 0 2.75rem;
    align-items: stretch;
  }

  .loan-calc-toc-mobile {
    display: none !important;
  }

  .loan-calc-guide {
    grid-column: 2;
    grid-row: 1;
  }
}

/* Desktop sidebar */
.loan-calc-toc--desktop {
  display: none;
}

@media (min-width: 960px) {
  .loan-calc-toc--desktop {
    display: block;
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    min-height: 100%;
    border-right: 1px solid #e8eef5;
    padding-right: 0.35rem;
  }
}

.loan-calc-toc__sticky {
  position: sticky;
  top: calc(var(--nav-height, 88px) + 1.25rem);
  max-height: calc(100vh - var(--nav-height, 88px) - 2.5rem);
  overflow-y: auto;
  padding-bottom: 1rem;
  scrollbar-width: thin;
}

.loan-calc-toc__label,
.loan-calc-toc-mobile__label {
  margin: 0 0 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
}

.loan-calc-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.loan-calc-toc__nav a,
.loan-calc-toc-mobile__track a {
  display: block;
  padding: 0.5rem 0 0.5rem 0.85rem;
  margin-left: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.loan-calc-toc__nav a:hover,
.loan-calc-toc-mobile__track a:hover {
  color: #0056d2;
}

.loan-calc-toc__nav a.is-active,
.loan-calc-toc-mobile__track a.is-active {
  color: #0056d2;
  font-weight: 700;
  border-left-color: #0056d2;
  background: rgba(0, 86, 210, 0.06);
}

/* Mobile sticky horizontal nav */
.loan-calc-toc-mobile {
  position: sticky;
  top: calc(var(--nav-height, 88px) + env(safe-area-inset-top, 0px));
  z-index: 40;
  margin: 0 0 1.25rem;
  padding: 0.75rem 0;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (min-width: 960px) {
  .loan-calc-toc-mobile {
    display: none;
  }
}

.loan-calc-toc-mobile__track {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
}

.loan-calc-toc-mobile__track::-webkit-scrollbar {
  display: none;
}

.loan-calc-toc-mobile__track a {
  flex: 0 0 auto;
  padding: 0.45rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  border-left: 1px solid #e2e8f0;
  font-size: 0.8rem;
  white-space: nowrap;
  background: #fff;
}

.loan-calc-toc-mobile__track a.is-active {
  border-color: #0056d2;
  background: rgba(0, 86, 210, 0.08);
  color: #0056d2;
  font-weight: 700;
}

/* Main article */
.loan-calc-guide {
  min-width: 0;
}

.loan-calc-guide__section {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--nav-height, 88px) + 5.5rem);
}

@media (min-width: 960px) {
  .loan-calc-guide__section {
    scroll-margin-top: calc(var(--nav-height, 88px) + 1.5rem);
  }
}

.loan-calc-guide__section h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0f172a;
  line-height: 1.2;
}

.loan-calc-guide__section h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.loan-calc-guide__section p {
  margin: 0 0 0.9rem;
  color: #475569;
  line-height: 1.65;
  font-size: 1rem;
}

.loan-calc-guide__list,
.loan-calc-step__body ul,
.loan-calc-guide__cta-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: #475569;
  line-height: 1.6;
  font-size: 0.98rem;
}

.loan-calc-guide__list li,
.loan-calc-step__body li {
  margin-bottom: 0.4rem;
}

/* Numbered steps */
.loan-calc-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eef2f7;
}

.loan-calc-step:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.loan-calc-step__num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0056d2;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.loan-calc-step__body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.loan-calc-step__body p {
  margin-bottom: 0.5rem;
}

.loan-calc-step__body ul {
  margin-bottom: 0;
}

/* Use your results cards */
.loan-calc-guide__card {
  margin-bottom: 0.85rem;
  padding: 1.1rem 1.2rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e8eef5;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.loan-calc-guide__card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.loan-calc-guide__card p {
  margin: 0;
  font-size: 0.95rem;
}

/* Comparison table (4 columns) */
.loan-calc-compare-wrap,
.loan-calc-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.loan-calc-compare-table,
.loan-calc-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.loan-calc-compare-table th,
.loan-calc-compare-table td,
.loan-calc-table th,
.loan-calc-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #eef2f7;
  line-height: 1.45;
}

.loan-calc-compare-table th,
.loan-calc-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  font-size: 0.8rem;
}

.loan-calc-compare-table tbody tr:last-child td,
.loan-calc-table tbody tr:last-child td {
  border-bottom: none;
}

.loan-calc-compare-table td strong {
  color: #0f172a;
}

/* FAQ — Bankrate row style */
.loan-calc-faq-list {
  border-top: 1px solid #e2e8f0;
}

.loan-calc-faq-item {
  border: none;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  background: transparent;
  margin: 0;
}

.loan-calc-faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  font-weight: 700;
  font-size: 0.98rem;
  color: #0f172a;
  cursor: pointer;
  list-style: none;
}

.loan-calc-faq-item summary::-webkit-details-marker {
  display: none;
}

.loan-calc-faq-item summary::after {
  content: "";
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid #0056d2;
  border-bottom: 2px solid #0056d2;
  transform: rotate(45deg);
  margin-top: -0.2rem;
  transition: transform 0.2s ease;
}

.loan-calc-faq-item[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.loan-calc-faq-item p {
  margin: 0 0 1rem;
  padding: 0;
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
}

/* CTA + tools */
.loan-calc-guide__cta-list {
  list-style: none;
  padding-left: 0;
}

.loan-calc-guide__cta-list li {
  margin-bottom: 0.5rem;
}

.loan-calc-guide__cta-list a {
  color: #0056d2;
  font-weight: 600;
  text-decoration: none;
}

.loan-calc-guide__cta-list a:hover {
  text-decoration: underline;
}

.loan-calc-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.loan-calc-tool-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 86, 210, 0.3);
  background: #fff;
  color: #0056d2;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.loan-calc-tool-link:hover {
  background: rgba(0, 86, 210, 0.06);
  border-color: #0056d2;
}
