/* ==========================================================================
   Finacing Tools: calculator components.
   Uses the theme's custom properties; fallbacks keep it readable elsewhere.
   ========================================================================== */

.fin-tool-head {
	margin: var(--s5, 24px) 0 var(--s5, 24px);
	max-width: 760px;
}

.fin-tool-title {
	margin-bottom: var(--s2, 8px);
}

.fin-lede {
	color: var(--ink-2, #4b535c);
	font-size: 1.0625rem;
	line-height: 1.5;
	max-width: 62ch;
}

.fin-pointer {
	margin-top: var(--s3, 12px);
	font-size: var(--fs-small, 0.875rem);
}

/* --------------------------------------------------------------------------
   Calculator frame
   -------------------------------------------------------------------------- */

.fin-calc {
	display: grid;
	background: var(--surface, #fff);
	border: 1px solid var(--rule, #dcd9d1);
	border-radius: var(--radius, 4px);
}

@media (min-width: 960px) {
	.fin-calc {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	}
}

.fin-calc__form {
	padding: var(--s5, 24px) var(--s4, 16px) var(--s4, 16px);
	min-width: 0;
}

@media (min-width: 600px) {
	.fin-calc__form {
		padding: var(--s5, 24px) var(--s5, 24px) var(--s4, 16px);
	}
}

@media (min-width: 960px) {
	.fin-calc__form {
		padding: var(--s6, 32px) var(--s6, 32px) var(--s5, 24px);
		border-right: 1px solid var(--rule, #dcd9d1);
	}
}

.fin-calc__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--s3, 12px);
	margin-bottom: var(--s5, 24px);
}

.fin-calc__title {
	font-family: var(--font-sans);
	font-size: 1.0625rem;
	font-weight: 600;
	letter-spacing: 0;
}

.fin-currency {
	display: flex;
	align-items: center;
	gap: var(--s2, 8px);
	font-size: var(--fs-small, 0.875rem);
	color: var(--ink-2, #4b535c);
}

.fin-currency select {
	height: var(--tap, 44px);
	max-width: 11.5rem;
	padding: 0 32px 0 10px;
	background: var(--surface, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234b535c' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
	border: 1px solid var(--rule-strong, #8c8a84);
	border-radius: var(--radius, 4px);
	appearance: none;
	font-size: var(--fs-small, 0.875rem);
	text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Fields
   -------------------------------------------------------------------------- */

.fin-field {
	margin-bottom: var(--s5, 24px);
	min-width: 0;
}

.fin-label {
	display: block;
	margin-bottom: 6px;
	padding: 0;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--ink, #1b1f23);
}

.fin-fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.fin-input {
	display: flex;
	align-items: stretch;
	min-height: 48px;
	background: var(--surface, #fff);
	border: 1px solid var(--rule-strong, #8c8a84);
	border-radius: var(--radius, 4px);
}

.fin-input:focus-within {
	border-color: var(--accent, #0b5d4b);
	outline: 3px solid var(--accent, #0b5d4b);
	outline-offset: 2px;
}

.fin-input input,
.fin-input select {
	flex: 1;
	min-width: 0;
	width: 100%;
	padding: 0 12px;
	background: transparent;
	border: 0;
	outline: none;
	font-size: 1.0625rem;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--ink, #1b1f23);
}

.fin-input input[type="date"] {
	font-size: 1rem;
	min-height: 46px;
}

.fin-input--select select {
	appearance: none;
	padding-right: 36px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234b535c' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
	font-weight: 500;
	cursor: pointer;
}

.fin-affix {
	display: flex;
	align-items: center;
	padding: 0 12px;
	color: var(--ink-3, #646c75);
	font-size: 1rem;
	white-space: nowrap;
	user-select: none;
}

.fin-affix--pre {
	padding-right: 0;
}

.fin-affix--pre + input {
	padding-left: 6px;
}

.fin-affix--post {
	padding-left: 0;
}

.fin-hint {
	margin-top: 6px;
	color: var(--ink-3, #646c75);
	font-size: var(--fs-small, 0.875rem);
	line-height: 1.45;
}

.fin-error {
	margin-top: 6px;
	color: var(--error, #b3261e);
	font-size: var(--fs-small, 0.875rem);
	font-weight: 500;
	line-height: 1.45;
}

.fin-error::before {
	content: "Error: ";
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.has-error .fin-input {
	border-color: var(--error, #b3261e);
	box-shadow: inset 0 0 0 1px var(--error, #b3261e);
}

.fin-term {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--s3, 12px);
}

.fin-row {
	display: grid;
	gap: 0 var(--s4, 16px);
}

@media (min-width: 420px) {
	.fin-row {
		grid-template-columns: 1fr 1fr;
	}
}

/* Segmented choice (radio group), e.g. a calculator's mode. */
.fin-choice {
	display: flex;
}

.fin-choice input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.fin-choice label {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--tap, 44px);
	padding: 6px 12px;
	background: var(--surface, #fff);
	border: 1px solid var(--rule-strong, #8c8a84);
	color: var(--ink-2, #4b535c);
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.25;
	text-align: center;
	cursor: pointer;
}

.fin-choice label:not(:first-of-type) {
	border-left: 0;
}

.fin-choice label:first-of-type {
	border-radius: var(--radius, 4px) 0 0 var(--radius, 4px);
}

.fin-choice label:last-of-type {
	border-radius: 0 var(--radius, 4px) var(--radius, 4px) 0;
}

.fin-choice input:checked + label {
	background: var(--ink, #1b1f23);
	border-color: var(--ink, #1b1f23);
	color: #fff;
}

.fin-choice input:focus-visible + label {
	position: relative;
	z-index: 1;
	outline: 3px solid var(--accent, #0b5d4b);
	outline-offset: 2px;
}

[data-show-when][hidden] {
	display: none !important;
}

/* Inputs that belong to one mode of a calculator. */
.fin-mode {
	margin: var(--s2, 8px) 0 var(--s4, 16px);
	padding-top: var(--s4, 16px);
	border-top: 1px solid var(--rule, #dcd9d1);
}

.fin-mode__title {
	margin-bottom: var(--s2, 8px);
	font-size: 1rem;
}

.fin-mode__intro {
	margin-bottom: var(--s4, 16px);
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-small, 0.875rem);
}

/* Repeatable rows (Fields::rows, ui/rows.js), e.g. one per debt */
.fin-rows {
	margin-bottom: var(--s4, 16px);
}

.fin-row-item {
	margin: 0 0 var(--s3, 12px);
	padding: var(--s3, 12px) 0 0;
	border: 0;
	border-top: 1px solid var(--rule, #dcd9d1);
	min-width: 0;
}

.fin-row-item__legend {
	float: left;
	width: 100%;
	margin-bottom: var(--s2, 8px);
	padding: 0;
	font-size: 1rem;
	font-weight: 600;
}

.fin-row-item__legend + * {
	clear: left;
}

.fin-row-item__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 var(--s3, 12px);
}

.fin-row-item__grid .fin-field {
	margin-bottom: var(--s3, 12px);
}

.fin-row-item__name {
	grid-column: 1 / -1;
}

.fin-label__optional {
	color: var(--ink-3, #6b7178);
	font-weight: 400;
}

.fin-row-item__remove {
	/* Sits in the grid cell beside the last field, level with its input. */
	align-self: end;
	justify-self: start;
	min-height: 44px;
	margin: 0 0 var(--s3, 12px) calc(-1 * var(--s2, 8px));
	padding: 0 var(--s2, 8px);
	background: none;
	border: 0;
	color: var(--ink-2, #4b535c);
	font: inherit;
	font-size: var(--fs-small, 0.875rem);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.fin-row-item__remove:hover {
	color: var(--ink, #1b1f23);
}

.fin-rows__limit {
	margin-top: var(--s2, 8px);
}

/* Comparisons of equals (e.g. two payoff orders): no column is emphasized. */
.fin-compare__table.fin-compare__table--even td:last-child {
	font-weight: 400;
}

/* Tables whose first column is a heading for the rows (e.g. "Debt"). */
.fin-compare__table thead th:first-child {
	padding-left: 0;
	text-align: left;
}

/* Optional sections */
.fin-more {
	border-top: 1px solid var(--rule, #dcd9d1);
}

.fin-more:last-of-type {
	border-bottom: 1px solid var(--rule, #dcd9d1);
}

.fin-more summary {
	display: flex;
	align-items: center;
	gap: var(--s2, 8px);
	min-height: 52px;
	font-weight: 500;
	cursor: pointer;
	list-style: none;
}

.fin-more summary::-webkit-details-marker {
	display: none;
}

.fin-more summary::before {
	content: "";
	width: 7px;
	height: 7px;
	margin: 0 6px 0 2px;
	border-right: 1.5px solid var(--ink-2, #4b535c);
	border-bottom: 1.5px solid var(--ink-2, #4b535c);
	transform: rotate(-45deg);
}

.fin-more[open] summary::before {
	transform: translateY(-2px) rotate(45deg);
}

.fin-more__hint {
	margin-left: auto;
	color: var(--ink-3, #646c75);
	font-size: var(--fs-small, 0.875rem);
	font-weight: 400;
}

.fin-more__body {
	padding: var(--s1, 4px) 0 var(--s2, 8px);
}

.fin-more__intro {
	margin-bottom: var(--s4, 16px);
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-small, 0.875rem);
}

.fin-calc__foot {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--s3, 12px);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.fin-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--tap, 44px);
	padding: 0 var(--s4, 16px);
	border-radius: var(--radius, 4px);
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
}

.fin-btn--secondary {
	background: var(--surface, #fff);
	border: 1px solid var(--rule-strong, #8c8a84);
	color: var(--ink, #1b1f23);
}

.fin-btn--secondary:hover {
	border-color: var(--ink, #1b1f23);
	background: var(--tint, #f2f1ec);
}

.fin-btn--quiet {
	padding: 0 var(--s2, 8px);
	background: none;
	border: 0;
	color: var(--ink-2, #4b535c);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.fin-btn--quiet:hover {
	color: var(--ink, #1b1f23);
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.fin-calc__results {
	padding: var(--s5, 24px) var(--s4, 16px);
	border-top: 1px solid var(--rule, #dcd9d1);
	min-width: 0;
}

.fin-calc__results:focus {
	outline: none;
}

@media (min-width: 600px) {
	.fin-calc__results {
		padding: var(--s5, 24px);
	}
}

@media (min-width: 960px) {
	.fin-calc__results {
		padding: var(--s6, 32px);
		border-top: 0;
	}
}

/* On wide screens the results stay in view while the (often taller) form is
   scrolled, so every change is visible as it's made. Only when there's room:
   a results panel taller than the window would otherwise be cut off. */
@media (min-width: 960px) and (min-height: 760px) {
	.fin-calc__results {
		position: sticky;
		top: 0;
		align-self: start;
	}
}

.fin-result {
	padding: var(--s4, 16px) var(--s5, 24px) var(--s5, 24px);
	background: var(--wash, #eef4f1);
	border-radius: var(--radius, 4px);
}

.fin-result__label {
	color: var(--ink-2, #4b535c);
	font-size: 0.9375rem;
	font-weight: 500;
}

.fin-result__figure {
	min-height: 1.15em;
	margin-top: 2px;
	font-size: var(--fs-display, 2.5rem);
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.015em;
	font-variant-numeric: tabular-nums lining-nums;
	color: var(--ink, #1b1f23);
}

.fin-result[data-state="invalid"] .fin-result__figure {
	color: var(--ink-3, #646c75);
}

/* Incomplete details: show the explanation, not a panel of dashes. */
.fin-calc__results .fin-result[data-state="invalid"] ~ .fin-facts,
.fin-calc__results .fin-result[data-state="invalid"] ~ .fin-split,
.fin-calc__results .fin-result[data-state="invalid"] ~ .fin-split__legend,
.fin-calc__results .fin-result[data-state="invalid"] ~ .fin-summary,
.fin-calc__results .fin-result[data-state="invalid"] ~ .fin-compare,
.fin-calc__results .fin-result[data-state="invalid"] ~ .fin-actions {
	display: none;
}

.fin-result__note {
	margin-top: var(--s1, 4px);
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-small, 0.875rem);
	line-height: 1.45;
}

.fin-result__note:empty {
	display: none;
}

/* Results are filled in by script after first paint. On wide screens they sit
   in view, so reserve room for the note and the summary: text appearing must
   not push the figures and buttons around (layout shift). */
@media (min-width: 960px) {
	.fin-calc__results .fin-result__note,
	.fin-calc__results .fin-result__note:empty {
		display: block;
		min-height: 2.9em;
	}

	.fin-calc__results .fin-summary,
	.fin-calc__results .fin-summary:empty {
		display: block;
		min-height: 4.65em;
	}
}

/* From 1200px the note fits on one line and the summary on two. */
@media (min-width: 1200px) {
	.fin-calc__results .fin-result__note,
	.fin-calc__results .fin-result__note:empty {
		min-height: 1.45em;
	}

	.fin-calc__results .fin-summary,
	.fin-calc__results .fin-summary:empty {
		min-height: 3.1em;
	}
}

.fin-facts {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: var(--s4, 16px) 0 0;
	border-top: 1px solid var(--rule, #dcd9d1);
}

.fin-facts > div {
	padding: var(--s3, 12px) 0;
	border-bottom: 1px solid var(--rule, #dcd9d1);
}

.fin-facts > div:nth-child(odd) {
	padding-right: var(--s3, 12px);
}

.fin-facts > div:nth-child(even) {
	padding-left: var(--s4, 16px);
	border-left: 1px solid var(--rule, #dcd9d1);
}

.fin-facts dt {
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-small, 0.875rem);
}

.fin-facts dd {
	margin: 2px 0 0;
	font-size: 1.1875rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* The narrowest phones: six-figure amounts with cents must fit a half-width cell. */
@media (max-width: 359px) {
	.fin-facts dd {
		font-size: 1.0625rem;
	}

	.fin-facts > div:nth-child(even) {
		padding-left: var(--s3, 12px);
	}
}

/* Principal / interest split: pattern + label, never color alone. */
.fin-split {
	margin-top: var(--s5, 24px);
}

.fin-split__bar {
	display: flex;
	height: 12px;
	overflow: hidden;
	border-radius: 2px;
	background: var(--tint, #f2f1ec);
}

.fin-split__a {
	background: var(--accent, #0b5d4b);
}

.fin-split__b {
	background: repeating-linear-gradient(135deg, var(--series-2, #c27c0e) 0 3px, #e0a64a 3px 6px);
}

.fin-split__a,
.fin-split__b {
	display: block;
	height: 100%;
}

.fin-split__a + .fin-split__b {
	border-left: 2px solid var(--surface, #fff);
}

.fin-split__legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s1, 4px) var(--s5, 24px);
	margin: var(--s2, 8px) 0 0;
	padding: 0;
	list-style: none;
	font-size: var(--fs-small, 0.875rem);
	color: var(--ink-2, #4b535c);
}

.fin-split__legend li {
	display: flex;
	align-items: center;
	gap: var(--s2, 8px);
}

.fin-split__legend strong {
	color: var(--ink, #1b1f23);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.fin-swatch {
	width: 12px;
	height: 12px;
	border-radius: 2px;
}

.fin-swatch--a {
	background: var(--accent, #0b5d4b);
}

.fin-swatch--b {
	background: repeating-linear-gradient(135deg, var(--series-2, #c27c0e) 0 3px, #e0a64a 3px 6px);
}

/* Extra-payment comparison */
.fin-compare {
	margin-top: var(--s5, 24px);
	padding-top: var(--s4, 16px);
	border-top: 1px solid var(--rule, #dcd9d1);
}

.fin-compare__title {
	margin-bottom: var(--s2, 8px);
	font-size: 1rem;
}

.fin-compare__table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--fs-small, 0.875rem);
	font-variant-numeric: tabular-nums;
}

.fin-compare__table th,
.fin-compare__table td {
	padding: var(--s2, 8px) 0;
	border-bottom: 1px solid var(--rule, #dcd9d1);
	text-align: right;
}

.fin-compare__table th[scope="row"] {
	text-align: left;
	font-weight: 400;
	color: var(--ink-2, #4b535c);
}

.fin-compare__table thead th {
	color: var(--ink-2, #4b535c);
	font-weight: 500;
	padding-left: var(--s3, 12px);
}

.fin-compare__table td {
	padding-left: var(--s3, 12px);
}

.fin-compare__table td:last-child {
	font-weight: 600;
	color: var(--ink, #1b1f23);
}

.fin-compare__line {
	margin-top: var(--s3, 12px);
	font-weight: 500;
	color: var(--accent-hover, #07473a);
}

/* Itemized breakdown (e.g. the amount financed): plain amounts, bold total. */
.fin-breakdown .fin-compare__table td:last-child {
	font-weight: 400;
}

.fin-breakdown .fin-compare__table tbody th[scope="row"] {
	color: var(--ink, #1b1f23);
}

.fin-breakdown tfoot th,
.fin-breakdown tfoot td {
	padding-top: var(--s2, 8px);
	border-top: 1px solid var(--rule-strong, #8c8a84);
	border-bottom: 0;
	font-weight: 600;
	color: var(--ink, #1b1f23);
}

.fin-breakdown .fin-compare__table tfoot th[scope="row"] {
	font-weight: 600;
	color: var(--ink, #1b1f23);
}

.fin-compare__line--plain {
	color: var(--ink-2, #4b535c);
	font-weight: 400;
}

.fin-compare__line--plain:empty {
	display: none;
}

/* The assumption a projection depends on, stated beside the result (Withdrawal, CAGR). */
.fin-assumption {
	margin-top: var(--s2, 8px);
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-small, 0.875rem);
}

.fin-assumption:empty {
	display: none;
}

.fin-summary {
	margin-top: var(--s5, 24px);
	color: var(--ink, #1b1f23);
	line-height: 1.55;
}

.fin-summary:empty {
	display: none;
}

.fin-invalid {
	margin-top: var(--s4, 16px);
	padding: var(--s3, 12px) var(--s4, 16px);
	background: var(--surface, #fff);
	border: 1px solid var(--rule, #dcd9d1);
	border-left: 3px solid var(--rule-strong, #8c8a84);
	font-size: var(--fs-small, 0.875rem);
}

.fin-invalid p + p {
	margin-top: var(--s1, 4px);
	color: var(--ink-2, #4b535c);
}

.fin-noscript {
	margin-top: var(--s4, 16px);
	color: var(--ink-2, #4b535c);
}

.fin-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2, 8px);
	margin-top: var(--s5, 24px);
	padding-top: var(--s5, 24px);
	border-top: 1px solid var(--rule, #dcd9d1);
}

.fin-actions__status {
	flex-basis: 100%;
	min-height: 1.4em;
	color: var(--accent-hover, #07473a);
	font-size: var(--fs-small, 0.875rem);
}

/* Mobile result bar: label above the figure so nothing wraps at 320px. */
.fin-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 30;
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	column-gap: var(--s3, 12px);
	padding: 6px var(--gutter, 16px) calc(6px + env(safe-area-inset-bottom));
	background: var(--surface, #fff);
	border-top: 1px solid var(--rule, #dcd9d1);
	box-shadow: 0 -6px 16px rgb(27 31 35 / 0.06);
}

.fin-sticky[hidden] {
	display: none;
}

.fin-sticky__label {
	grid-column: 1;
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-micro, 0.8125rem);
	line-height: 1.3;
}

.fin-sticky__value {
	grid-column: 1;
	font-size: 1.1875rem;
	line-height: 1.3;
	font-variant-numeric: tabular-nums;
}

.fin-sticky__link {
	grid-column: 2;
	grid-row: 1 / span 2;
	display: inline-flex;
	align-items: center;
	min-height: var(--tap, 44px);
	font-weight: 500;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Sections under the calculator: chart and schedule
   -------------------------------------------------------------------------- */

.fin-section {
	margin-top: var(--s7, 48px);
}

/* Chart and schedule read better at a set width than stretched across a wide screen. */
.fin-chart-section,
.fin-schedule {
	max-width: 880px;
}

.fin-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--s3, 12px);
	margin-bottom: var(--s4, 16px);
}

.fin-section > h2 {
	margin-bottom: var(--s4, 16px);
}

.fin-print-inputs {
	display: none;
}

.fin-figure {
	margin: 0;
	padding: var(--s4, 16px);
	background: var(--surface, #fff);
	border: 1px solid var(--rule, #dcd9d1);
	border-radius: var(--radius, 4px);
}

.fin-chart {
	min-height: 220px;
}

@media (min-width: 520px) {
	.fin-chart {
		min-height: 280px;
	}
}

.fin-chart__svg {
	display: block;
	overflow: visible;
}

.fin-chart__grid line {
	stroke: var(--rule, #dcd9d1);
	stroke-width: 1;
}

.fin-chart__axis line {
	stroke: var(--rule-strong, #8c8a84);
	stroke-width: 1;
}

.fin-chart__tick {
	fill: var(--ink-3, #646c75);
	font-family: var(--font-sans);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.fin-chart__line {
	fill: none;
	stroke-width: 2.5;
	stroke-linejoin: round;
	stroke-linecap: round;
}

.fin-chart__line--1 {
	stroke: var(--accent, #0b5d4b);
}

.fin-chart__line--2 {
	stroke: var(--ink-3, #646c75);
	stroke-width: 2;
}

.fin-chart__line.is-dashed {
	stroke-dasharray: 6 5;
	stroke-linecap: butt;
}

.fin-chart__legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s1, 4px) var(--s5, 24px);
	margin: 0 0 var(--s3, 12px);
	padding: 0;
	list-style: none;
	font-size: var(--fs-small, 0.875rem);
	color: var(--ink-2, #4b535c);
}

.fin-chart__legend li {
	display: flex;
	align-items: center;
	gap: var(--s2, 8px);
}

.fin-figure__caption {
	margin-top: var(--s3, 12px);
	color: var(--ink-2, #4b535c);
	font-size: var(--fs-small, 0.875rem);
	line-height: 1.5;
	max-width: 72ch;
}

/* Segmented toggle */
.fin-toggle {
	display: inline-flex;
	border: 1px solid var(--rule-strong, #8c8a84);
	border-radius: var(--radius, 4px);
	overflow: hidden;
}

.fin-toggle button {
	min-height: var(--tap, 44px);
	padding: 0 var(--s4, 16px);
	background: var(--surface, #fff);
	border: 0;
	font-size: var(--fs-small, 0.875rem);
	font-weight: 500;
	color: var(--ink-2, #4b535c);
}

.fin-toggle button + button {
	border-left: 1px solid var(--rule-strong, #8c8a84);
}

.fin-toggle button[aria-pressed="true"] {
	background: var(--ink, #1b1f23);
	color: #fff;
}

/* Schedule table */
.fin-table-wrap {
	overflow: auto;
	background: var(--surface, #fff);
	border: 1px solid var(--rule, #dcd9d1);
	border-radius: var(--radius, 4px);
}

.fin-table-wrap:focus-visible {
	outline-offset: 2px;
}

.fin-table[data-view="payment"] {
	--sticky-top: 0;
}

.fin-table-wrap:has(.fin-table[data-view="payment"]) {
	max-height: min(70vh, 640px);
}

.fin-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: var(--fs-small, 0.875rem);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.fin-table th,
.fin-table td {
	padding: 10px 14px;
	text-align: right;
	border-bottom: 1px solid var(--rule, #dcd9d1);
}

.fin-table thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--tint, #f2f1ec);
	border-bottom: 1px solid var(--rule-strong, #8c8a84);
	color: var(--ink-2, #4b535c);
	font-weight: 600;
}

.fin-table th[scope="row"],
.fin-table thead th:first-child {
	position: sticky;
	left: 0;
	z-index: 1;
	text-align: left;
	background: var(--surface, #fff);
	font-weight: 500;
}

.fin-table thead th:first-child {
	z-index: 3;
	background: var(--tint, #f2f1ec);
}

.fin-table tbody tr:hover td,
.fin-table tbody tr:hover th {
	background: #fafaf7;
}

.fin-table tfoot th,
.fin-table tfoot td {
	font-weight: 600;
	border-top: 1px solid var(--rule-strong, #8c8a84);
	border-bottom: 0;
	background: var(--surface, #fff);
}

/* Narrow screens: columns marked hideNarrow (e.g. payment counts) are dropped
   so the balance stays in view. */
@media (max-width: 479px) {
	.fin-table .fin-col-narrow-hide {
		display: none;
	}

	.fin-table th,
	.fin-table td {
		padding: 10px 10px;
	}
}

.fin-table-note {
	margin-top: var(--s3, 12px);
	max-width: 72ch;
	color: var(--ink-3, #646c75);
	font-size: var(--fs-micro, 0.8125rem);
	line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Article, related tools, review note
   -------------------------------------------------------------------------- */

.tool-article {
	margin-top: var(--s7, 48px);
}

.tool-article > h2:first-child {
	margin-top: 0;
}

.fin-related {
	max-width: var(--measure, 68ch);
	margin-top: var(--s8, 64px);
	padding-top: var(--s5, 24px);
	border-top: 1px solid var(--rule-strong, #8c8a84);
}

.fin-related__list {
	margin: var(--s3, 12px) 0 0;
	padding: 0;
	list-style: none;
}

.fin-related__item {
	padding: var(--s4, 16px) 0;
	border-bottom: 1px solid var(--rule, #dcd9d1);
}

.fin-related__link {
	font-size: 1.0625rem;
	font-weight: 600;
}

.fin-related__preview {
	margin-left: var(--s2, 8px);
	padding: 1px 6px;
	border: 1px dashed var(--rule-strong, #8c8a84);
	border-radius: 2px;
	color: var(--ink-3, #646c75);
	font-size: var(--fs-micro, 0.8125rem);
}

.fin-related__reason {
	margin-top: var(--s1, 4px);
	color: var(--ink-2, #4b535c);
	font-size: 0.9375rem;
}

.fin-reviewed {
	max-width: var(--measure, 68ch);
	margin-top: var(--s6, 32px);
	color: var(--ink-3, #646c75);
	font-size: var(--fs-small, 0.875rem);
}

.fin-reviewed p + p {
	margin-top: var(--s2, 8px);
}

/* Leave room for the sticky bar so it never covers the footer text. */
@media (max-width: 959px) {
	.site-main--tool {
		padding-bottom: calc(var(--s8, 64px) + 56px);
	}
}

/* --------------------------------------------------------------------------
   Print: a clean report of this calculation.
   -------------------------------------------------------------------------- */

@media print {
	.fin-tool-head .fin-lede,
	.fin-pointer,
	.fin-calc__form,
	.fin-actions,
	.fin-sticky,
	.fin-toggle,
	.fin-table-note,
	.tool-article,
	.fin-related,
	.fin-invalid,
	.fin-noscript {
		display: none !important;
	}

	.fin-tool-head {
		margin: 12pt 0 8pt;
	}

	.fin-calc {
		display: block;
		border: 0;
	}

	.fin-calc__results {
		padding: 0;
		border: 0;
	}

	.fin-result {
		padding: 0;
		background: none;
	}

	.fin-print-inputs {
		display: block;
		margin: 12pt 0 18pt;
	}

	.fin-print-inputs dl {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 2pt 24pt;
		margin: 0;
	}

	.fin-print-inputs dl div {
		display: flex;
		justify-content: space-between;
		gap: 12pt;
		border-bottom: 0.5pt solid #bbb;
		padding: 3pt 0;
	}

	.fin-print-inputs dt {
		color: #444;
	}

	.fin-print-inputs dd {
		margin: 0;
		font-weight: 600;
		text-align: right;
		/* Wrap between words; split a word (a long page URL) only if it can't fit. */
		word-break: normal;
		overflow-wrap: anywhere;
	}

	.fin-section {
		margin-top: 16pt;
	}

	.fin-chart-section {
		break-inside: avoid;
	}

	.fin-figure {
		border: 0;
		padding: 0;
	}

	.fin-table-wrap,
	.fin-table-wrap:has(.fin-table[data-view="payment"]) {
		max-height: none;
		overflow: visible;
		border: 0;
	}

	.fin-table {
		font-size: 8.5pt;
	}

	.fin-table th,
	.fin-table td {
		padding: 2.5pt 6pt;
	}

	.fin-table thead {
		display: table-header-group;
	}

	.fin-table tr {
		break-inside: avoid;
	}

	.fin-table thead th,
	.fin-table th[scope="row"] {
		position: static;
	}

	.fin-reviewed {
		margin-top: 12pt;
		font-size: 8pt;
	}
}

/* Repeatable rows: a clear, full-width "add another" control and a counter. */
.fin-rows__add {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--s2, 8px);
	width: 100%;
	min-height: 48px;
	margin-top: var(--s2, 8px);
	background: var(--surface, #fff);
	border: 1.5px dashed var(--accent, #0b5d4b);
	border-radius: var(--radius, 4px);
	color: var(--accent, #0b5d4b);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.fin-rows__add:hover {
	background: #e3f1ec;
}

.fin-rows__plus {
	font-size: 1.25rem;
	line-height: 1;
}

.fin-rows__limit {
	margin-top: var(--s2, 8px);
	text-align: center;
}
