.rlfc-calculator,
.rlfc-calculator * {
	box-sizing: border-box;
}

.rlfc-calculator {
	--rlfc-bg: #f4f6f8;
	--rlfc-card: #ffffff;
	--rlfc-card-soft: #f8fafc;
	--rlfc-text: #17202a;
	--rlfc-muted: #5d6875;
	--rlfc-border: #d9e1ea;
	--rlfc-primary: #3e5268;
	--rlfc-primary-dark: #283848;
	--rlfc-accent: #d6aa55;
	--rlfc-danger: #a63d40;
	--rlfc-success: #2f7d59;
	--rlfc-shadow: 0 18px 45px rgba(19, 28, 39, 0.12);
	--rlfc-radius: 22px;
	width: 100%;
	max-width: 1120px;
	margin: 24px auto;
	padding: 12px;
	color: var(--rlfc-text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rlfc-calculator[data-theme="dark"] {
	--rlfc-bg: #121820;
	--rlfc-card: #1b2430;
	--rlfc-card-soft: #222e3b;
	--rlfc-text: #edf3f8;
	--rlfc-muted: #b6c2cf;
	--rlfc-border: #314151;
	--rlfc-primary: #98b3ce;
	--rlfc-primary-dark: #c0d2e2;
	--rlfc-accent: #e0ba68;
	--rlfc-danger: #f09a9c;
	--rlfc-success: #8dd9b1;
	--rlfc-shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

.rlfc-shell {
	background: linear-gradient(145deg, var(--rlfc-bg), var(--rlfc-card-soft));
	border: 1px solid var(--rlfc-border);
	border-radius: 28px;
	box-shadow: var(--rlfc-shadow);
	padding: clamp(16px, 3vw, 34px);
	overflow: hidden;
}

.rlfc-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
}

.rlfc-eyebrow {
	margin: 0 0 6px;
	color: var(--rlfc-accent);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.11em;
	text-transform: uppercase;
}

.rlfc-header h2,
.rlfc-results h3 {
	margin: 0;
	line-height: 1.12;
	letter-spacing: -0.04em;
}

.rlfc-header h2 {
	font-size: clamp(1.65rem, 4vw, 3rem);
}

.rlfc-theme-toggle,
.rlfc-button {
	appearance: none;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	font-weight: 800;
	transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.rlfc-theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 15px;
	background: var(--rlfc-card);
	border: 1px solid var(--rlfc-border);
	color: var(--rlfc-text);
	white-space: nowrap;
}

.rlfc-theme-toggle:hover,
.rlfc-button:hover {
	transform: translateY(-1px);
}

.rlfc-theme-toggle:focus-visible,
.rlfc-button:focus-visible,
.rlfc-field input:focus-visible,
.rlfc-field select:focus-visible,
.rlfc-choice-group input:focus-visible,
.rlfc-checkbox-row input:focus-visible {
	outline: 3px solid rgba(214, 170, 85, 0.55);
	outline-offset: 3px;
}

.rlfc-alert {
	margin-bottom: 18px;
	padding: 12px 14px;
	border-radius: 14px;
	background: rgba(166, 61, 64, 0.12);
	border: 1px solid rgba(166, 61, 64, 0.3);
	color: var(--rlfc-danger);
	font-weight: 700;
}

/* Hard layout lock: results must always be below the input form. */
.rlfc-layout {
	display: flex !important;
	flex-direction: column !important;
	align-items: stretch !important;
	gap: 24px;
	width: 100%;
}

.rlfc-input-card,
.rlfc-results {
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0;
}

.rlfc-input-card,
.rlfc-results,
.rlfc-section {
	background: var(--rlfc-card);
	border: 1px solid var(--rlfc-border);
	border-radius: var(--rlfc-radius);
	box-shadow: 0 10px 26px rgba(29, 43, 57, 0.08);
}

.rlfc-input-card {
	padding: clamp(14px, 2vw, 22px);
}

.rlfc-form {
	display: grid;
	gap: 18px;
	margin: 0;
}

.rlfc-section {
	padding: clamp(16px, 2vw, 22px);
}

.rlfc-section-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 16px;
}

.rlfc-icon {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	flex: 0 0 38px;
	border-radius: 13px;
	background: linear-gradient(135deg, var(--rlfc-primary), var(--rlfc-primary-dark));
	color: #fff;
	font-weight: 900;
}

.rlfc-section h3 {
	margin: 0 0 3px;
	font-size: 1.05rem;
}

.rlfc-section p {
	margin: 0;
	color: var(--rlfc-muted);
	font-size: 0.92rem;
}

.rlfc-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

.rlfc-field {
	display: grid;
	gap: 7px;
	min-width: 0;
}

.rlfc-field > span,
.rlfc-choice-group legend,
.rlfc-checkbox-row span {
	font-size: 0.88rem;
	font-weight: 800;
	color: var(--rlfc-text);
}

.rlfc-field input,
.rlfc-field select {
	width: 100%;
	min-height: 48px;
	border: 1px solid var(--rlfc-border);
	border-radius: 14px;
	padding: 11px 13px;
	background: var(--rlfc-card-soft);
	color: var(--rlfc-text);
	font: inherit;
	font-weight: 700;
}

.rlfc-field input[type="range"] {
	padding: 0;
	accent-color: var(--rlfc-primary);
}

.rlfc-inline-input {
	display: flex;
	align-items: center;
	background: var(--rlfc-card-soft);
	border: 1px solid var(--rlfc-border);
	border-radius: 14px;
	overflow: hidden;
}

.rlfc-inline-input input {
	border: 0;
	border-radius: 0;
	background: transparent;
}

.rlfc-inline-input span {
	padding: 0 13px;
	color: var(--rlfc-muted);
	font-weight: 900;
}

.rlfc-choice-group {
	border: 1px solid var(--rlfc-border);
	border-radius: 18px;
	padding: 12px;
	margin: 0 0 15px;
	display: grid;
	gap: 10px;
	background: var(--rlfc-card-soft);
}

.rlfc-choice-group legend {
	padding: 0 8px;
}

.rlfc-choice-group label,
.rlfc-checkbox-row label {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 10px 12px;
	border: 1px solid var(--rlfc-border);
	border-radius: 14px;
	background: var(--rlfc-card);
	cursor: pointer;
}

.rlfc-choice-group input,
.rlfc-checkbox-row input {
	width: 18px;
	height: 18px;
	accent-color: var(--rlfc-primary);
	flex: 0 0 auto;
}

.rlfc-checkbox-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	margin-top: 14px;
}

.rlfc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.rlfc-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 11px 16px;
	background: linear-gradient(135deg, var(--rlfc-primary), var(--rlfc-primary-dark));
	color: #fff;
	box-shadow: 0 8px 18px rgba(62, 82, 104, 0.22);
}

.rlfc-button-secondary {
	background: var(--rlfc-card);
	color: var(--rlfc-text);
	border: 1px solid var(--rlfc-border);
	box-shadow: none;
}

.rlfc-results {
	padding: clamp(18px, 3vw, 28px);
}

.rlfc-result-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 18px;
	margin-bottom: 18px;
}

.rlfc-results h3 {
	font-size: clamp(2.05rem, 7vw, 4.4rem);
	color: var(--rlfc-primary-dark);
}

.rlfc-result-top p[data-rlfc-summary] {
	margin: 8px 0 0;
	color: var(--rlfc-muted);
	font-weight: 650;
}

.rlfc-score {
	min-width: 92px;
	text-align: center;
	padding: 12px;
	border-radius: 18px;
	background: linear-gradient(135deg, rgba(214, 170, 85, 0.18), rgba(62, 82, 104, 0.13));
	border: 1px solid var(--rlfc-border);
	font-weight: 900;
	color: var(--rlfc-primary-dark);
}

.rlfc-result-cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin: 18px 0;
}

.rlfc-mini-card {
	padding: 15px;
	border-radius: 18px;
	border: 1px solid var(--rlfc-border);
	background: var(--rlfc-card-soft);
	display: grid;
	gap: 8px;
}

.rlfc-mini-card span {
	font-size: 0.84rem;
	color: var(--rlfc-muted);
	font-weight: 800;
}

.rlfc-mini-card strong {
	font-size: 1.28rem;
}

.rlfc-bars {
	display: grid;
	gap: 11px;
	margin: 18px 0;
}

.rlfc-bars div {
	display: grid;
	grid-template-columns: 122px 1fr;
	gap: 12px;
	align-items: center;
	font-size: 0.85rem;
	font-weight: 800;
	color: var(--rlfc-muted);
}

.rlfc-bars b {
	display: block;
	height: 12px;
	border-radius: 999px;
	background: var(--rlfc-card-soft);
	overflow: hidden;
	border: 1px solid var(--rlfc-border);
}

.rlfc-bars i {
	display: block;
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--rlfc-primary), var(--rlfc-accent));
	transition: width 220ms ease;
}

.rlfc-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--rlfc-border);
	border-radius: 18px;
}

.rlfc-breakdown {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.94rem;
}

.rlfc-breakdown caption {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.rlfc-breakdown th,
.rlfc-breakdown td {
	padding: 13px 14px;
	border-bottom: 1px solid var(--rlfc-border);
	text-align: left;
}

.rlfc-breakdown tr:last-child th,
.rlfc-breakdown tr:last-child td {
	border-bottom: 0;
}

.rlfc-breakdown td {
	text-align: right;
	font-weight: 900;
}

.rlfc-note {
	margin-top: 15px;
	padding: 13px 14px;
	border-radius: 16px;
	background: rgba(214, 170, 85, 0.12);
	border: 1px solid rgba(214, 170, 85, 0.32);
	color: var(--rlfc-muted);
	font-size: 0.9rem;
	font-weight: 650;
}

@media (min-width: 640px) {
	.rlfc-grid,
	.rlfc-result-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rlfc-checkbox-row {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 900px) {
	.rlfc-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.rlfc-result-cards {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.rlfc-choice-group {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 520px) {
	.rlfc-calculator {
		padding: 6px;
		margin: 12px auto;
	}

	.rlfc-header,
	.rlfc-result-top {
		flex-direction: column;
	}

	.rlfc-theme-toggle,
	.rlfc-button {
		width: 100%;
	}

	.rlfc-bars div {
		grid-template-columns: 1fr;
		gap: 6px;
	}
}

@media print {
	body * {
		visibility: hidden !important;
	}

	.rlfc-calculator,
	.rlfc-calculator * {
		visibility: visible !important;
	}

	.rlfc-calculator {
		position: absolute;
		inset: 0 auto auto 0;
		max-width: 100%;
		margin: 0;
		padding: 0;
	}

	.rlfc-actions,
	.rlfc-theme-toggle {
		display: none !important;
	}

	.rlfc-shell,
	.rlfc-input-card,
	.rlfc-results,
	.rlfc-section {
		box-shadow: none !important;
	}
}


/* Final output-below override: prevents side-by-side result panels in themes/builders. */
.rlfc-calculator .rlfc-layout,
.rlfc-calculator .rlfc-layout-output-below {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	grid-template-columns: 1fr !important;
	column-count: 1 !important;
}

.rlfc-calculator .rlfc-input-card,
.rlfc-calculator .rlfc-results,
.rlfc-calculator .rlfc-output-below-result {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	float: none !important;
	clear: both !important;
	grid-column: 1 / -1 !important;
}

.rlfc-calculator .rlfc-output-below-result {
	margin-top: 24px !important;
}

@media (min-width: 1px) {
	.rlfc-calculator .rlfc-layout,
	.rlfc-calculator .rlfc-layout-output-below {
		display: block !important;
		grid-template-columns: 1fr !important;
	}

	.rlfc-calculator .rlfc-input-card,
	.rlfc-calculator .rlfc-results,
	.rlfc-calculator .rlfc-output-below-result {
		width: 100% !important;
		max-width: 100% !important;
		float: none !important;
		clear: both !important;
	}
}
