:root {
  --bg: #020b16;
  --panel: #071626;
  --panel-2: #0a1d30;
  --border: rgba(25, 145, 255, 0.35);
  --blue: #1691ff;
  --blue-dark: #0875d8;
  --text: #ffffff;
  --muted: #91a7c0;
  --success: #3ddc97;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(22, 145, 255, 0.10), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

/* HEADER */

.calculator-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: rgba(2, 11, 22, 0.96);
}

.back-link {
  display: block;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.back-link:hover {
  color: var(--blue);
}

/* PAGE */

.calculator-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 70px 0 60px;
}

/* INTRO */

.calculator-intro {
  max-width: 760px;
  margin-bottom: 42px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.calculator-intro h1 {
  margin: 0 0 14px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.calculator-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

/* MAIN GRID */

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.9fr);
  gap: 28px;
  align-items: start;
}

.calculator-controls,
.payment-result,
.payoff-section {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(
    145deg,
    rgba(10, 29, 48, 0.96),
    rgba(5, 18, 32, 0.96)
  );
}

.calculator-controls {
  padding: 32px;
}

.payment-result {
  position: sticky;
  top: 24px;
  padding: 34px;
}

/* FORM */

.field-group {
  margin-bottom: 30px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group label {
  display: block;
  margin-bottom: 10px;
  color: #dbe8f5;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.025em;
}

.money-input,
.percent-input {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(144, 173, 202, 0.25);
  border-radius: 14px;
  background: rgba(1, 10, 20, 0.65);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.money-input:focus-within,
.percent-input:focus-within {
  border-color: var(--blue);
}

.money-input span,
.percent-input span {
  padding-left: 18px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.money-input input,
.percent-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 16px;
  font-size: 20px;
  font-weight: 800;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* SLIDER */

input[type="range"] {
  width: 100%;
  margin-top: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* TERM BUTTONS */

.term-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.term-button {
  min-height: 52px;
  border: 1px solid rgba(144, 173, 202, 0.25);
  border-radius: 12px;
  background: rgba(1, 10, 20, 0.55);
  color: #dce9f5;
  cursor: pointer;
  font-weight: 800;
  transition: 0.2s ease;
}

.term-button:hover {
  border-color: var(--blue);
}

.term-button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

/* ADVANCED */

.advanced-section {
  padding-top: 4px;
}

.advanced-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid rgba(144, 173, 202, 0.22);
  border-radius: 13px;
  background: rgba(1, 10, 20, 0.45);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.advanced-toggle span {
  color: var(--blue);
  font-size: 24px;
}

.advanced-options {
  display: none;
  padding-top: 24px;
}

.advanced-options.open {
  display: block;
}

.field-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* RESULT */

.result-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-range {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 12px;
  color: var(--text);
}

.payment-range > span:not(.payment-dash) {
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.payment-dash {
  padding-bottom: 4px;
  color: var(--blue);
  font-size: 30px;
}

.payment-range small {
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.payment-description {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.55;
}

/* BREAKDOWN */

.finance-breakdown {
  padding-top: 6px;
  border-top: 1px solid rgba(144, 173, 202, 0.18);
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(144, 173, 202, 0.10);
}

.breakdown-row span {
  color: var(--muted);
}

.breakdown-row strong {
  color: var(--text);
  text-align: right;
}

.total-row {
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

.total-row span,
.total-row strong {
  color: var(--blue);
  font-weight: 900;
}

/* PAYOFF */

.payoff-section {
  margin-top: 30px;
  padding: 38px;
}

.section-heading {
  max-width: 680px;
  margin-bottom: 32px;
}

.section-heading > span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.section-heading h2 {
  margin: 10px 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.03em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.payoff-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 28px;
}

.extra-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.extra-buttons button {
  min-height: 44px;
  border: 1px solid rgba(144, 173, 202, 0.25);
  border-radius: 10px;
  background: rgba(1, 10, 20, 0.55);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.extra-buttons button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.payoff-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.payoff-stat {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(144, 173, 202, 0.18);
  border-radius: 15px;
  background: rgba(1, 10, 20, 0.38);
}

.payoff-stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.payoff-stat strong {
  display: block;
  font-size: 21px;
}

.payoff-stat.highlight {
  border-color: rgba(22, 145, 255, 0.45);
}

.payoff-stat.highlight strong {
  color: var(--blue);
}

/* DISCLAIMER */

.calculator-disclaimer {
  max-width: 920px;
  margin: 30px auto 0;
  text-align: center;
}

.calculator-disclaimer p {
  color: #738aa3;
  font-size: 12px;
  line-height: 1.65;
}

/* MOBILE */

@media (max-width: 820px) {
  .calculator-page {
    width: min(100% - 28px, 700px);
    padding-top: 42px;
  }

  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .payment-result {
    position: static;
  }

  .payoff-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .calculator-header .back-link {
    width: calc(100% - 28px);
    padding: 19px 0;
  }

  .calculator-intro {
    margin-bottom: 28px;
  }

  .calculator-intro p {
    font-size: 16px;
  }

  .calculator-controls,
  .payment-result,
  .payoff-section {
    border-radius: 18px;
  }

  .calculator-controls,
  .payment-result {
    padding: 22px;
  }

  .payoff-section {
    padding: 24px 20px;
  }

  .term-options {
    grid-template-columns: 1fr;
  }

  .term-button {
    min-height: 48px;
  }

  .payment-range > span:not(.payment-dash) {
    font-size: 38px;
  }

  .payment-dash {
    font-size: 24px;
  }

  .breakdown-row {
    align-items: flex-start;
  }

  .extra-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .payoff-results {
    grid-template-columns: 1fr;
  }
}
.term-input {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(144, 173, 202, 0.25);
  border-radius: 14px;
  background: rgba(1, 10, 20, 0.65);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.term-input:focus-within {
  border-color: var(--blue);
}

.term-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 16px 18px;
  font-size: 20px;
  font-weight: 800;
}

.term-input span {
  padding-right: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
