.affordability-page {
	--afford-navy: #182235;
	--afford-teal: #13786a;
	--afford-gold: #c8871e;
	--afford-red: #b45757;
}

.afford-hero {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 330px;
	gap: 22px;
	align-items: stretch;
	margin-bottom: 22px;
	padding: 30px;
	color: #ffffff;
	background:
		linear-gradient(135deg, #182235 0%, #1d3f47 56%, #13786a 100%);
	border: 1px solid #274052;
	border-radius: 8px;
	box-shadow: var(--shadow);
}

.afford-hero h1 {
	color: #ffffff;
}

.afford-hero p {
	max-width: 790px;
	color: #d8e4ec;
}

.afford-hero .eyebrow {
	color: #f8c76f;
}

.hero-ledger {
	display: grid;
	align-content: center;
	gap: 8px;
	padding: 18px;
	color: #172033;
	background: #ffffff;
	border-radius: 8px;
}

.hero-ledger span,
.mode-switch span,
.primary-result span,
.range-labels span,
.dti-card span,
.money-grid span,
.payment-stack span,
.formula-box span {
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
}

.hero-ledger span,
.primary-result span,
.formula-box span {
	color: var(--afford-teal);
}

.hero-ledger strong {
	color: var(--afford-navy);
	font-size: 26px;
	line-height: 1.1;
}

.hero-ledger p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}

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

.control-deck,
.decision-board,
.content-section,
.disclaimer {
	background: #ffffff;
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow-soft);
}

.control-deck,
.decision-board {
	padding: 22px;
}

.mode-switch {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 18px;
}

.mode-switch label {
	cursor: pointer;
}

.mode-switch input {
	position: absolute;
	opacity: 0;
}

.mode-switch span {
	display: flex;
	min-height: 46px;
	align-items: center;
	justify-content: center;
	padding: 10px;
	color: var(--muted);
	background: #f7f9fc;
	border: 1px solid var(--line);
	border-radius: 8px;
	text-align: center;
}

.mode-switch input:checked + span {
	color: #ffffff;
	background: var(--afford-teal);
	border-color: var(--afford-teal);
}

.input-cluster {
	padding: 16px;
	background: #f8fbfc;
	border: 1px solid #dce7ef;
	border-radius: 8px;
}

.input-cluster + .input-cluster {
	margin-top: 14px;
}

.input-cluster h2 {
	margin-bottom: 12px;
	font-size: 18px;
}

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

.field {
	display: grid;
	gap: 7px;
	color: #344052;
	font-size: 14px;
	font-weight: 800;
}

.field input,
.field select {
	width: 100%;
	min-height: 44px;
	padding: 10px 11px;
	color: var(--text);
	background: #ffffff;
	border: 1px solid #c5d1e1;
	border-radius: 7px;
	font: inherit;
}

.field input:focus,
.field select:focus {
	border-color: var(--afford-teal);
	outline: none;
	box-shadow: 0 0 0 3px rgba(19, 120, 106, 0.16);
}

.ratio-pair {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.example-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

.example-actions button,
.copy-button {
	min-height: 42px;
	padding: 10px 14px;
	cursor: pointer;
	border-radius: 7px;
	font: inherit;
	font-weight: 800;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.example-actions button {
	color: var(--afford-teal);
	background: #e9f5f2;
	border: 1px solid #b8ddd2;
}

.example-actions button:hover,
.copy-button:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow-soft);
}

.decision-board {
	position: sticky;
	top: 86px;
	display: grid;
	gap: 14px;
	background:
		linear-gradient(180deg, #ffffff 0%, #f7fbfa 100%);
}

.primary-result {
	padding: 18px;
	background: #182235;
	border-radius: 8px;
}

.primary-result span {
	color: #f8c76f;
}

.primary-result strong {
	display: block;
	margin-top: 8px;
	color: #ffffff;
	font-size: 40px;
	line-height: 1.1;
	overflow-wrap: anywhere;
}

.primary-result p {
	margin: 10px 0 0;
	color: #d8e4ec;
}

.range-rail,
.dti-card,
.money-grid,
.payment-stack,
.formula-box {
	padding: 14px;
	background: #ffffff;
	border: 1px solid #dce7ef;
	border-radius: 8px;
}

.range-labels,
.range-values {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.range-labels span {
	color: var(--muted);
}

.range-bars {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	margin: 10px 0;
}

.range-bars i {
	display: block;
	height: 10px;
	background: #9fd8cb;
	border-radius: 999px;
}

.range-bars i:nth-child(2) {
	background: var(--afford-teal);
}

.range-bars i:nth-child(3) {
	background: var(--afford-gold);
}

.range-values strong {
	color: #172033;
	font-size: 15px;
}

.dti-card {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.dti-card span,
.money-grid span,
.payment-stack span {
	color: var(--muted);
}

.dti-card strong,
.money-grid strong,
.payment-stack strong {
	display: block;
	margin-top: 4px;
	color: #172033;
	font-size: 18px;
}

.dti-card p,
.formula-box p {
	grid-column: 1 / -1;
	margin: 0;
	color: var(--muted);
}

.dti-meter {
	grid-column: 1 / -1;
	height: 10px;
	background: #e8eef4;
	border-radius: 999px;
	overflow: hidden;
}

.dti-meter i {
	display: block;
	width: 0;
	height: 100%;
	background: var(--afford-teal);
	border-radius: inherit;
	transition: width 0.18s ease, background 0.18s ease;
}

.money-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.payment-stack {
	display: grid;
	gap: 10px;
}

.payment-stack div {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

.payment-stack div:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.copy-button {
	color: #ffffff;
	background: var(--afford-teal);
	border: 1px solid var(--afford-teal);
}

.content-section {
	margin-top: 18px;
	padding: 24px;
}

.content-section p,
.content-section li {
	color: #435166;
}

.content-section p {
	margin: 0;
}

.content-section p + p {
	margin-top: 12px;
}

.content-section ol,
.content-section ul {
	margin: 0;
	padding-left: 22px;
}

.content-section li + li {
	margin-top: 8px;
}

.content-section a {
	color: var(--afford-teal);
	font-weight: 800;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.decision-grid,
.example-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
}

.decision-grid article,
.example-grid article {
	padding: 18px;
	background: var(--surface-soft);
	border: 1px solid var(--line);
	border-top: 4px solid var(--afford-teal);
	border-radius: 8px;
}

.decision-grid article:nth-child(2),
.example-grid article:nth-child(2) {
	border-top-color: var(--afford-gold);
}

.decision-grid article:nth-child(3),
.example-grid article:nth-child(3) {
	border-top-color: var(--blue);
}

.decision-grid p,
.example-grid p {
	margin-top: 8px;
	color: var(--muted);
}

.formula-large {
	margin: 14px 0 0;
	padding: 14px;
	color: #23314a;
	background: var(--surface-soft);
	border: 1px solid var(--line);
	border-radius: 8px;
	overflow-wrap: anywhere;
}

.faq-section details {
	padding: 16px;
	background: var(--surface-soft);
	border: 1px solid var(--line);
	border-radius: 8px;
}

.faq-section details + details {
	margin-top: 10px;
}

.faq-section summary {
	cursor: pointer;
	color: var(--text);
	font-weight: 800;
}

.faq-section details p {
	margin-top: 10px;
}

.disclaimer {
	margin: 18px 0 0;
	padding: 16px 18px;
	color: #5d4a20;
	background: #fffaf0;
	border-color: #efd99c;
	font-size: 14px;
}

[hidden] {
	display: none !important;
}

@media (max-width: 1040px) {
	.afford-hero,
	.afford-tool,
	.decision-grid,
	.example-grid {
		grid-template-columns: 1fr;
	}

	.decision-board {
		position: static;
	}
}

@media (max-width: 640px) {
	.afford-hero,
	.control-deck,
	.decision-board,
	.content-section {
		padding: 18px;
	}

	.field-grid,
	.mode-switch,
	.money-grid,
	.dti-card {
		grid-template-columns: 1fr;
	}

	.primary-result strong {
		font-size: 32px;
	}
}
