:root {
  color-scheme: light;
  --ink: #17213d;
  --quiet: #485570;
  --border: #d9e2f4;
  --purple: #5620c4;
  --aqua: #14bed0;
  --paper: #f4f7ff;
  font-family: Inter,system-ui,sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--purple);
}

a:hover {
  text-decoration-thickness: 2px;
}

button,input,select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible,.scroll:focus-visible {
  outline: 3px solid #7863ed;
  outline-offset: 3px;
}

[hidden] {
  display: none!important;
}

.frame {
  width: min(1080px,100% - 36px);
  margin-inline: auto;
}

.masthead {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 66px;
  gap: 24px;
}

.nav a:last-child {
  font-weight: 700;
  text-decoration: none;
}

.brand {
  font-size: 1.67rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.08em;
  text-decoration: none;
  color: var(--ink);
}

.brand span {
  color: var(--purple);
}

.lead {
  padding: clamp(36px,7vw,84px) 0 28px;
}

.lead p {
  font-size: 1.2rem;
  margin: 10px 0 0;
  color: var(--quiet);
}

h1,h2,p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.55rem,6vw,4.9rem);
  line-height: .98;
  letter-spacing: -.07em;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.3rem;
  line-height: 1.2;
  letter-spacing: -.035em;
  margin-bottom: 12px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(270px,1fr) minmax(0,1.38fr);
  gap: 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(18px,3vw,32px);
  box-shadow: 0 12px 26px -24px #2534707a;
}

.inputs label {
  display: block;
  margin: 13px 0 5px;
  font-weight: 650;
}

.field,.term-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field {
  border: 1px solid #a6b3d0;
  border-radius: 8px;
  padding: 0 12px;
}

.field span {
  font-weight: 700;
  color: var(--quiet);
}

.field input {
  width: 100%;
  border: 0;
  background: none;
  padding: 9px 0;
  color: var(--ink);
}

.field:focus-within {
  outline: 2px solid #7863ed;
  outline-offset: 2px;
}

.field input:focus-visible {
  outline: none;
}

.term-row input,.term-row select {
  min-width: 0;
  border: 1px solid #a6b3d0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
}

.term-row input {
  flex: 1;
  width: 100%;
}

.term-row select {
  padding-right: 30px;
  appearance: none;
  background: #fff linear-gradient(45deg,transparent 50%,var(--quiet) 50%) calc(100% - 14px) 52%/5px 5px no-repeat;
}

.primary,.secondary {
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 700;
}

.primary {
  background: var(--purple);
  color: #fff;
  border: 1px solid var(--purple);
  margin: 18px 0 9px;
  width: 100%;
}

.primary:hover {
  background: #4417a0;
}

.secondary {
  background: #fff;
  border: 1px solid #a6b3d0;
  color: var(--purple);
}

.secondary:hover {
  background: #f6f2ff;
}

.fine {
  color: var(--quiet);
  font-size: .93rem;
  margin: 0;
}

#error {
  color: #a42639;
  margin: .65rem 0 0;
}

.result {
  background: #eef0ff;
}

.monthly {
  font-size: clamp(2.8rem,7vw,5rem);
  letter-spacing: -.075em;
  font-weight: 820;
  line-height: .98;
  margin: 16px 0 11px;
  overflow-wrap: anywhere;
}

.split {
  height: 14px;
  border-radius: 100px;
  background: var(--aqua);
  margin: 23px 0 14px;
  overflow: hidden;
}

.split>div {
  width: 45%;
  height: 100%;
  background: var(--purple);
}

.totals {
  margin: 0 0 13px;
}

.totals>div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #d3d9f3;
}

.totals dt,.totals dd {
  margin: 0;
}

.totals dd {
  font-weight: 700;
  text-align: right;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 10px;
  margin-right: 5px;
}

.principal {
  background: var(--purple);
}

.interest {
  background: var(--aqua);
}

.assumptions {
  line-height: 1.45;
}

.schedule {
  margin-top: 16px;
}

.schedule-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.schedule-head .secondary {
  flex: none;
}

.scroll {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

thead {
  color: var(--quiet);
  background: #f4f6ff;
}

th:first-child {
  text-align: left;
}

.more {
  margin-top: 16px;
}

.explain {
  max-width: 720px;
  padding: 32px 0 10px;
}

.explain h2 {
  margin-top: 24px;
}

.explain p {
  margin-bottom: 13px;
}

.footer {
  border-top: 1px solid var(--border);
  margin-top: 28px;
  padding: 24px 0 38px;
  color: var(--quiet);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media(max-width:650px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .lead {
    padding-bottom: 22px;
  }
  .schedule-head {
    flex-wrap: wrap;
  }
  th,td {
    padding-inline: 9px;
  }
  .frame {
    width: min(100% - 28px,1080px);
  }
}
