/*
 * GovMath site layer: the parts every calculator, guide and content page
 * needs that the supplied design package does not draw itself. Loaded after
 * the package's own stylesheets and uses only its palette and patterns
 * (wine #510b38, focus #73164c, gold #c79a4b, grey #faf7f9, borders #e6d8e1).
 */

:root {
  /* Guide chart colours: wine, gold, mauve, slate, sand. */
  --g-c1: #73164c;
  --g-c2: #c79a4b;
  --g-c3: #ad7198;
  --g-c4: #909aab;
  --g-c5: #e0b27a;
  --g-track: #efe6ec;
}

/* ── Form groups and labels ─────────────────────────────── */
.gm-group {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.gm-group + .gm-group {
  margin-top: 4px;
}
.gm-labelwrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.gm-labelwrap label,
.gm-label {
  font-weight: 700;
}
.gm-aside {
  font-size: 13px;
  color: var(--muted);
}
.gm-optional {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #faf3f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}
.field > .hint {
  margin: 8px 0 0;
}
.field > .labelrow + .hint {
  margin: -4px 0 10px;
}
.field .number input {
  font-size: 16px;
}

/* Choices: the design's underlined tabs, left aligned inside a form. */
.ax-calctabs.gm-choice {
  justify-content: flex-start;
  flex-wrap: wrap;
  width: auto;
  margin: 0;
}
.ax-calctabs.gm-choice button {
  font-size: 15px;
  padding: 10px 16px;
}
@media (max-width: 650px) {
  .ax-calctabs.gm-choice button {
    flex: 1 1 auto;
  }
}

/* Quick picks: chips selected like the design's current rate row. */
.chips button[aria-pressed="true"] {
  background: #510b38;
  border-color: #510b38;
  color: #fff;
}
.field .chips {
  margin: 12px 0 0;
}

/* More options: keep the money boxes and sliders in their normal shape. */
.moreoptions summary {
  cursor: pointer;
}
.moreoptions summary .gm-changed {
  font-style: normal;
  font-weight: 400;
  color: var(--focus);
}
.moreoptions .number input,
.moreoptions .ax-select > select {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.moreoptions input[type="range"] {
  padding: 0;
  margin: 13px 0 14px;
  border: 0;
  border-radius: 8px;
}
.moreoptions .labelrow label,
.moreoptions .gm-switchrow label {
  display: inline;
  margin: 0;
}
.moreoptions .ax-select-field > label {
  display: block;
}
.moreoptions > div > .textbutton {
  margin-top: 4px;
}

/* Switch */
.gm-switchrow {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gm-switchrow label {
  font-weight: 700;
  cursor: pointer;
}
.gm-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #d8dce0;
  cursor: pointer;
  transition: background 0.15s;
}
.gm-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0003;
  transition: transform 0.15s;
}
.gm-switch[aria-checked="true"] {
  background: #510b38;
}
.gm-switch[aria-checked="true"]::after {
  transform: translateX(20px);
}
.gm-switch:focus-visible {
  outline: 2px solid #73164c;
  outline-offset: 2px;
}

/* Text and date inputs in the design's box style. */
.gm-input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}
.gm-input:focus {
  outline: none;
  border-color: #510b38;
  box-shadow: 0 0 0 1px #510b38;
}
.moreoptions .gm-input {
  margin: 0;
}

/* ── Results panel ──────────────────────────────────────── */
.ax-chartpanel .loan-summary:last-child {
  margin-bottom: 0;
}
.gm-share-link {
  cursor: pointer;
}
.gm-answer {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 24px;
  text-align: center;
  margin: 22px 0;
}

/* Facts: tones and notes. */
.facts {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.facts b {
  display: block;
  overflow-wrap: anywhere;
}
.facts > div[data-tone="good"] {
  border-top-color: #73164c;
}
.facts > div[data-tone="warn"] {
  border-top-color: #e0b27a;
}
.facts > div[data-tone="bad"] {
  border-top-color: #b42318;
}
.gm-factnote {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
@media (max-width: 650px) {
  .facts {
    grid-template-columns: 1fr 1fr;
  }
}

/* Result cards: tables and charts take the full row. */
.resultgrid > .resultcard {
  min-width: 0;
}
.resultgrid > .resultcard:has(table, .gm-chart, .tablewrap, .gm-compare, svg[role="img"]) {
  grid-column: 1 / -1;
}
.resultcard > .sectionheading {
  align-items: flex-start;
  margin-bottom: 10px;
}
.resultcard > .sectionheading h3 {
  margin-bottom: 6px;
}
.resultcard > .sectionheading p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.resultcard > :last-child {
  margin-bottom: 0;
}
.resultcard .tablewrap,
.resultcard .schedule {
  margin-top: 16px;
}
.resultcard .gm-insight {
  margin-top: 16px;
}

/* Split bar list: share after the amount. */
.allocation b {
  white-space: nowrap;
}
.gm-share {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.allocation > div + div {
  border-top: 1px solid var(--border);
}

/* Compare rows */
.gm-compare {
  margin: 14px 0 0;
}
.gm-rate-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
  padding-top: 0;
}
.gm-rate-head strong {
  font-weight: 700;
}
.rate-row small[data-tone="up"] {
  color: #b42318;
}
.rate-row small[data-tone="down"] {
  color: #0f7a52;
}

/* Insight boxes (as the design's guide callouts). */
.gm-insight {
  background: #faf3f7;
  border-left: 3px solid #510b38;
  border-radius: 0 8px 8px 0;
  padding: 18px 20px;
  margin: 22px 0;
}
.gm-insight[data-tone="good"] {
  border-left-color: #73164c;
}
.gm-insight[data-tone="warn"] {
  border-left-color: #c79a4b;
  background: #fbf6ee;
}
.gm-insight h3 {
  font-size: 17px;
  margin: 0 0 8px;
}
.gm-insight p,
.gm-insight li {
  font-size: 15px;
  line-height: 1.7;
  color: #4d5663;
}
.gm-insight > div > :last-child {
  margin-bottom: 0;
}
.gm-insight-action {
  margin-top: 12px;
}

/* Tables */
.schedule {
  margin: 10px 0;
}
.schedule > summary {
  cursor: pointer;
}
.tablewrap {
  overflow-x: auto;
}
.tablewrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tablewrap th,
.tablewrap td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.tablewrap th:first-child,
.tablewrap td:first-child {
  text-align: left;
  white-space: normal;
}
.tablewrap th {
  background: #faf3f7;
  color: #510b38;
  font-size: 13px;
}
.gm-statement {
  border: 1px solid var(--border);
  border-radius: 8px;
}
.gm-statement tr[data-kind="deduction"] td:not(:first-child) {
  color: #8a3b2e;
}
.gm-statement tr[data-kind="total"] td {
  background: #faf3f7;
  color: #510b38;
  font-weight: 700;
  border-bottom: 0;
}
.gm-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

/* What we assumed */
.gm-details .ax-assumptions {
  margin: 22px 0;
}
.ax-assumptions > summary {
  cursor: pointer;
  font-weight: 700;
  color: #510b38;
}
.gm-assumed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 24px;
  margin: 14px 0 6px;
}
.gm-assumed > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.gm-assumed dt {
  color: var(--muted);
}
.gm-assumed dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}
.ax-assumptions > p {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ── Area chart (as the design's balance chart) ─────────── */
.gm-chart {
  margin: 16px 0 0;
}
.gm-chart .chartlegend {
  margin: 0 0 14px;
}
.gm-chart .chartlegend span i {
  height: 3px;
  width: 14px;
}
.gm-chart .chartlegend i[data-dashed] {
  background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important;
  color: #909aab;
}
.gm-readout {
  background: #faf3f7;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 0 0 14px;
  min-height: 46px;
}
.gm-plot {
  position: relative;
  height: 240px;
  margin-left: 52px;
  cursor: crosshair;
  touch-action: pan-y;
}
.gm-plot:focus-visible {
  outline: 2px solid #73164c;
  outline-offset: 4px;
}
.gm-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.gm-gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #efe6ec;
}
.gm-gridline em {
  position: absolute;
  right: calc(100% + 8px);
  top: -9px;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.gm-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed #b9a6b2;
  pointer-events: none;
}
.gm-cursor i {
  position: absolute;
  left: -6px;
  width: 11px;
  height: 11px;
  margin-top: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #0002;
}
.gm-xaxis {
  position: relative;
  height: 22px;
  margin: 8px 0 0 52px;
  font-size: 12px;
  color: var(--muted);
}
.gm-xaxis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.gm-xaxis span:first-child {
  transform: none;
}
.gm-xaxis span:last-child {
  transform: translateX(-100%);
}
.gm-charthint {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 0;
}
@media (max-width: 650px) {
  .gm-plot {
    height: 200px;
    margin-left: 44px;
  }
  .gm-xaxis {
    margin-left: 44px;
  }
  .gm-gridline em {
    font-size: 11px;
  }
}

/* ── Guide blocks the package does not include ──────────── */
.g-sectionKicker {
  font-weight: 700;
}
.g-figure {
  margin: 22px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.g-figLabel {
  margin-bottom: 16px;
  color: #2b2028;
  font-size: 15px;
  font-weight: 700;
}
.g-figCaption {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px !important;
  line-height: 1.55 !important;
}
.g-bandBar {
  display: flex;
  gap: 2px;
  height: 46px;
}
.g-band {
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.g-band[data-light] {
  color: #2b2028;
}
.g-ticks {
  position: relative;
  height: 20px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.g-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.g-ticks span:first-child {
  transform: none;
}
.g-ticks span:last-child {
  transform: translateX(-100%);
}
.g-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 14px;
}
.g-legend span {
  display: inline-flex;
  align-items: center;
}
.g-barName {
  color: #2b2028;
  font-weight: 700;
}
.g-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.g-chart text {
  fill: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}
.g-chart .g-chartLabel {
  fill: #2b2028;
  font-size: 13px;
}
.g-chart .g-grid {
  stroke: #efe6ec;
  stroke-width: 1;
}
.g-chart .g-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.g-chart .g-area {
  opacity: 0.12;
}
.g-chart .g-hit {
  fill: transparent;
}
.g-chart .g-hit:hover {
  fill: rgba(81, 11, 56, 0.06);
}
.g-stepLabel {
  color: #2b2028;
}
.g-numCell {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.g-table {
  width: 100%;
  border-collapse: collapse;
}
.g-table th,
.g-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.g-table thead th {
  background: #faf7f9;
  font-size: 13px;
}
.g-table tr:last-child td {
  border-bottom: 0;
}
.g-stats {
  margin: 20px 0;
}
.g-timeline {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.g-compareCol ul {
  margin: 10px 0 0;
}
.g-compareCol li {
  font-size: 14px !important;
}
.g-callout > :last-child {
  margin-bottom: 0;
}
.g-section .g-callout p {
  margin: 0;
}

/* ── Content pages ──────────────────────────────────────── */
.gm-prose {
  max-width: 820px;
}
.gm-prose h2 {
  font-size: 26px;
  margin: 34px 0 14px;
}
.gm-prose h3 {
  font-size: 19px;
  margin: 24px 0 10px;
}
.gm-prose p,
.gm-prose li {
  font-size: 16px;
  line-height: 1.8;
  color: #4d5663;
}
.gm-prose ul,
.gm-prose ol {
  padding-left: 22px;
}
.gm-prose a {
  color: var(--brand);
  text-decoration: underline;
}
.gm-prose blockquote {
  margin: 20px 0;
  padding: 18px 20px;
  background: #faf3f7;
  border-left: 3px solid var(--brand);
}
.gm-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 20px 0;
}
.gm-prose th,
.gm-prose td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.gm-prose th {
  background: #faf3f7;
  color: #510b38;
}
.gm-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 25px;
}
.gm-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 23px;
  background: #fff;
}
a.gm-card:hover {
  background: #faf3f7;
}
.gm-card strong {
  font-size: 18px;
  color: #510b38;
}
.gm-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.gm-card small {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.gm-card .gm-go {
  margin-top: auto;
  color: var(--wine);
  font-size: 13px;
  font-weight: 700;
}
.gm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
}
@media (max-width: 900px) {
  .gm-cards {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 650px) {
  .gm-cards {
    grid-template-columns: 1fr;
  }
  .gm-prose h2 {
    font-size: 23px;
  }
}
.categoryhero > p:not(.eyebrow) {
  color: var(--muted);
  margin: 0;
}
.categoryhero .gm-meta {
  margin-top: 16px;
}
.categorytool h3 {
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 8px;
}
.section .fullcategory {
  margin-bottom: 0;
}
.gm-postlist {
  margin: 10px 0 50px;
}
.gm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  margin: 10px 0 60px;
}
.gm-prose.section {
  border-top: 0;
  padding-top: 10px;
}
.g-compare {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.gm-notfound {
  margin-top: 30px;
}
/* A lone last card fills the row rather than leaving a gap. */
.resultgrid > .resultcard:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.gm-compare .rate-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(70px, auto);
  gap: 18px;
}
