:root {
	--lfcfv-bg: #f4f6f8;
	--lfcfv-card: #ffffff;
	--lfcfv-card-2: #f8fafc;
	--lfcfv-text: #1f2937;
	--lfcfv-muted: #64748b;
	--lfcfv-border: #d7dee8;
	--lfcfv-accent: #374151;
	--lfcfv-accent-2: #111827;
	--lfcfv-good: #0f766e;
	--lfcfv-danger: #b91c1c;
	--lfcfv-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
	--lfcfv-radius: 22px;
	--lfcfv-focus: 0 0 0 4px rgba(55, 65, 81, 0.18);
}

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

.lfcfv-calculator {
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 18px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--lfcfv-text);
}

.lfcfv-calculator[data-theme="dark"] {
	--lfcfv-bg: #0f172a;
	--lfcfv-card: #111827;
	--lfcfv-card-2: #172033;
	--lfcfv-text: #f8fafc;
	--lfcfv-muted: #bac4d3;
	--lfcfv-border: #334155;
	--lfcfv-accent: #94a3b8;
	--lfcfv-accent-2: #e5e7eb;
	--lfcfv-good: #5eead4;
	--lfcfv-danger: #fca5a5;
	--lfcfv-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
	--lfcfv-focus: 0 0 0 4px rgba(148, 163, 184, 0.25);
}

.lfcfv-shell {
	width: min(1040px, 100%);
	margin: 0 auto;
	padding: clamp(14px, 3vw, 26px);
	border-radius: 28px;
	background: linear-gradient(135deg, var(--lfcfv-bg), var(--lfcfv-card-2));
	box-shadow: var(--lfcfv-shadow);
	overflow: hidden;
}

.lfcfv-header-card,
.lfcfv-card {
	background: var(--lfcfv-card);
	border: 1px solid var(--lfcfv-border);
	border-radius: var(--lfcfv-radius);
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.lfcfv-header-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: clamp(18px, 4vw, 30px);
	margin-bottom: 16px;
}

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

.lfcfv-header-card h2 {
	margin: 0;
	font-size: clamp(1.35rem, 4vw, 2.25rem);
	line-height: 1.15;
	color: var(--lfcfv-text);
	text-transform: capitalize;
}

.lfcfv-theme-toggle,
.lfcfv-btn {
	appearance: none;
	border: 1px solid var(--lfcfv-border);
	border-radius: 999px;
	background: var(--lfcfv-accent-2);
	color: #fff;
	font-weight: 800;
	cursor: pointer;
	transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.lfcfv-theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	white-space: nowrap;
}

.lfcfv-theme-toggle:hover,
.lfcfv-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}

.lfcfv-theme-toggle:focus-visible,
.lfcfv-btn:focus-visible,
.lfcfv-field input:focus-visible,
.lfcfv-field select:focus-visible,
.lfcfv-check input:focus-visible {
	outline: none;
	box-shadow: var(--lfcfv-focus);
}

.lfcfv-status {
	min-height: 26px;
	padding: 0 4px 10px;
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--lfcfv-danger);
}

/* Layout lock: the output/result panel must stay below the inputs at every screen size. */
.lfcfv-calculator-stack {
	display: flex !important;
	flex-direction: column !important;
	align-items: stretch !important;
	gap: 18px;
	width: 100% !important;
	max-width: 100% !important;
}

.lfcfv-form-card {
	order: 1 !important;
	width: 100% !important;
	max-width: none !important;
}

.lfcfv-result-card {
	order: 2 !important;
	width: 100% !important;
	max-width: none !important;
}

.lfcfv-card {
	padding: clamp(18px, 4vw, 28px);
}

.lfcfv-fieldset {
	border: 0;
	margin: 0 0 22px;
	padding: 0;
}

.lfcfv-fieldset:last-of-type {
	margin-bottom: 16px;
}

.lfcfv-fieldset legend {
	width: 100%;
	margin-bottom: 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--lfcfv-border);
	font-size: 1rem;
	font-weight: 900;
	color: var(--lfcfv-text);
}

.lfcfv-fields-grid,
.lfcfv-checkbox-grid,
.lfcfv-result-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

.lfcfv-field label,
.lfcfv-check {
	display: block;
	font-size: 0.92rem;
	font-weight: 800;
	color: var(--lfcfv-text);
}

.lfcfv-field label {
	margin-bottom: 8px;
}

.lfcfv-field input,
.lfcfv-field select {
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	border: 1px solid var(--lfcfv-border);
	border-radius: 14px;
	background: var(--lfcfv-card-2);
	color: var(--lfcfv-text);
	font-size: 1rem;
	transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.lfcfv-field input:hover,
.lfcfv-field select:hover {
	border-color: var(--lfcfv-muted);
}

.lfcfv-field input[aria-invalid="true"] {
	border-color: var(--lfcfv-danger);
}

.lfcfv-input-unit {
	display: flex;
	align-items: center;
	gap: 8px;
}

.lfcfv-input-unit input {
	flex: 1 1 auto;
}

.lfcfv-input-unit span {
	min-width: 48px;
	padding: 12px 10px;
	border: 1px solid var(--lfcfv-border);
	border-radius: 14px;
	background: var(--lfcfv-card-2);
	text-align: center;
	font-weight: 900;
	color: var(--lfcfv-muted);
}

.lfcfv-check {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 12px 14px;
	border: 1px solid var(--lfcfv-border);
	border-radius: 16px;
	background: var(--lfcfv-card-2);
	cursor: pointer;
}

.lfcfv-check input {
	width: 20px;
	height: 20px;
	accent-color: var(--lfcfv-accent-2);
	flex: 0 0 auto;
}

.lfcfv-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.lfcfv-btn {
	min-height: 44px;
	padding: 11px 16px;
	font-size: 0.92rem;
}

.lfcfv-btn-secondary {
	background: transparent;
	color: var(--lfcfv-text);
}

.lfcfv-result-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.lfcfv-total {
	font-size: clamp(2rem, 8vw, 4.2rem);
	font-weight: 950;
	line-height: 1;
	letter-spacing: -0.06em;
	color: var(--lfcfv-good);
}

.lfcfv-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 96px;
	padding: 8px 12px;
	border-radius: 999px;
	background: var(--lfcfv-card-2);
	border: 1px solid var(--lfcfv-border);
	font-size: 0.82rem;
	font-weight: 900;
	color: var(--lfcfv-muted);
}

.lfcfv-result-summary {
	margin-bottom: 18px;
	padding: 14px 16px;
	border-radius: 16px;
	background: var(--lfcfv-card-2);
	border: 1px solid var(--lfcfv-border);
	color: var(--lfcfv-muted);
	font-weight: 700;
	line-height: 1.5;
}

.lfcfv-mini-card {
	padding: 14px;
	border: 1px solid var(--lfcfv-border);
	border-radius: 16px;
	background: var(--lfcfv-card-2);
}

.lfcfv-mini-card span {
	display: block;
	margin-bottom: 6px;
	font-size: 0.78rem;
	font-weight: 900;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--lfcfv-muted);
}

.lfcfv-mini-card strong {
	display: block;
	font-size: 1.22rem;
	color: var(--lfcfv-text);
}

.lfcfv-breakdown {
	margin-top: 18px;
	border: 1px solid var(--lfcfv-border);
	border-radius: 18px;
	overflow: hidden;
}

.lfcfv-breakdown-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--lfcfv-border);
	background: var(--lfcfv-card);
	font-weight: 700;
}

.lfcfv-breakdown-row:last-child {
	border-bottom: 0;
}

.lfcfv-breakdown-row span:first-child {
	color: var(--lfcfv-muted);
}

.lfcfv-breakdown-row strong {
	text-align: right;
	white-space: nowrap;
}

.lfcfv-bars {
	display: grid;
	gap: 10px;
	margin-top: 18px;
}

.lfcfv-bar-row {
	display: grid;
	grid-template-columns: 88px 1fr;
	align-items: center;
	gap: 10px;
	font-size: 0.82rem;
	font-weight: 900;
	color: var(--lfcfv-muted);
}

.lfcfv-bar-row div {
	height: 12px;
	border-radius: 999px;
	background: var(--lfcfv-card-2);
	border: 1px solid var(--lfcfv-border);
	overflow: hidden;
}

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

.lfcfv-result-actions {
	margin-top: 18px;
}

@media (min-width: 680px) {
	.lfcfv-fields-grid,
	.lfcfv-checkbox-grid,
	.lfcfv-result-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 980px) {
	.lfcfv-fields-grid,
	.lfcfv-checkbox-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

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

@media (max-width: 560px) {
	.lfcfv-header-card,
	.lfcfv-result-head {
		flex-direction: column;
		align-items: stretch;
	}

	.lfcfv-theme-toggle,
	.lfcfv-btn {
		width: 100%;
		justify-content: center;
	}

	.lfcfv-breakdown-row {
		align-items: flex-start;
		flex-direction: column;
	}

	.lfcfv-breakdown-row strong {
		text-align: left;
	}
}

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

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

	.lfcfv-calculator {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
	}

	.lfcfv-theme-toggle,
	.lfcfv-actions,
	.lfcfv-form-card {
		display: none !important;
	}

	.lfcfv-shell,
	.lfcfv-card,
	.lfcfv-header-card {
		box-shadow: none !important;
		background: #fff !important;
		color: #000 !important;
	}
}
