/**
 * Section 199A QBI Deduction Estimator — module styles.
 *
 * Inherits the shared design tokens (--bf-primary, --bf-accent, --bf-ink,
 * --bf-muted, --bf-border, --bf-bg-soft, --bf-radius, --bf-shadow) from
 * assets/css/frontend.css. Everything is scoped to .qbi. QuickBooks-style: an
 * input column beside a results column with a live zone meter, a three-card
 * summary, and a breakdown grid. Mobile-first; two columns at ≥860px. Print too.
 *
 * The A/B/C meter segment widths are fixed because the 2026 OBBBA thresholds and
 * phase-out widths share the same ratio for Single and MFJ (threshold : width =
 * 2.69 : 1), so the segment proportions are identical for both filing statuses.
 */

.qbi {
	--qbi-safe: #16a34a;
	--qbi-phase: #f59e0b;
	--qbi-capped: #e11d48;
	--qbi-floor: #7c3aed;
	color: var(--bf-ink, #0f172a);
	font-size: 16px;
	line-height: 1.5;
}
.qbi *,
.qbi *::before,
.qbi *::after { box-sizing: border-box; }

.qbi__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 18px;
	align-items: start;
}
@media (min-width: 860px) {
	.qbi__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}

/* --------------------------------------------------------------- inputs */

.qbi__inputs {
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: var(--bf-radius, 16px);
	background: #fff;
	padding: 22px;
	margin: 0;
	min-width: 0;
}
.qbi__field { margin-top: 18px; }
.qbi__field:first-child { margin-top: 0; }
.qbi__field--split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}
@media (max-width: 430px) {
	.qbi__field--split { grid-template-columns: 1fr; }
}
.qbi__field--check { margin-top: 18px; }

.qbi__label {
	display: block;
	font-weight: 700;
	font-size: 13.5px;
	margin-bottom: 7px;
	color: var(--bf-ink, #0f172a);
}

.qbi__money {
	display: flex;
	align-items: center;
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 11px;
	background: var(--bf-bg-soft, #f8fafc);
	overflow: hidden;
	transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.qbi__money:focus-within {
	border-color: var(--bf-primary, #4f46e5);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-primary, #4f46e5) 18%, transparent);
	background: #fff;
}
.qbi__sym {
	flex: 0 0 auto;
	padding: 0 11px;
	font-weight: 700;
	color: var(--bf-muted, #64748b);
	font-size: 14px;
	border-right: 1px solid var(--bf-border, #e5e7eb);
}
.qbi__money input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 11px 13px;
	font: inherit;
	font-weight: 700;
	font-size: 16px;
	color: var(--bf-ink, #0f172a);
	-moz-appearance: textfield;
}
.qbi__money input:focus { outline: none; }
.qbi__money input::-webkit-outer-spin-button,
.qbi__money input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.qbi__slider {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	margin-top: 12px;
	border-radius: 999px;
	background: var(--bf-border, #e5e7eb);
	outline: none;
	cursor: pointer;
}
.qbi__slider::-webkit-slider-thumb {
	-webkit-appearance: none; appearance: none;
	width: 20px; height: 20px; border-radius: 50%;
	background: var(--bf-primary, #4f46e5); border: 3px solid #fff;
	box-shadow: 0 2px 6px rgba(15, 23, 42, .25); cursor: pointer;
}
.qbi__slider::-moz-range-thumb {
	width: 20px; height: 20px; border-radius: 50%;
	background: var(--bf-primary, #4f46e5); border: 3px solid #fff;
	box-shadow: 0 2px 6px rgba(15, 23, 42, .25); cursor: pointer;
}
.qbi__slider:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-primary, #4f46e5) 30%, transparent); }

.qbi__toggle {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 4px;
	border-radius: 12px;
	background: var(--bf-bg-soft, #f8fafc);
	border: 1px solid var(--bf-border, #e5e7eb);
}
.qbi__toggle-btn {
	font: inherit;
	font-weight: 700;
	font-size: 13.5px;
	padding: 8px 15px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--bf-muted, #64748b);
	cursor: pointer;
	transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.qbi__toggle-btn.is-active {
	background: #fff;
	color: var(--bf-primary, #4f46e5);
	box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}
.qbi__toggle-btn:focus-visible { outline: 2px solid var(--bf-primary, #4f46e5); outline-offset: 1px; }

.qbi__hint {
	margin: 8px 0 0;
	font-size: 12.5px;
	line-height: 1.45;
	color: var(--bf-muted, #64748b);
}

.qbi__check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--bf-ink, #0f172a);
	cursor: pointer;
	line-height: 1.4;
}
.qbi__check input {
	width: 18px; height: 18px; margin: 1px 0 0;
	accent-color: var(--bf-primary, #4f46e5);
	flex: 0 0 auto;
}

.qbi__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--bf-border, #e5e7eb);
}

/* -------------------------------------------------------------- results */

.qbi__results { min-width: 0; }

/* Zone status + meter. */
.qbi__zone {
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: var(--bf-radius, 16px);
	background: #fff;
	padding: 18px 20px;
	margin-bottom: 16px;
}
.qbi__zone-badge {
	display: inline-block;
	font-size: 13px;
	font-weight: 800;
	padding: 6px 14px;
	border-radius: 999px;
	color: #fff;
	background: var(--qbi-safe);
}
.qbi__zone-badge--safe { background: var(--qbi-safe); }
.qbi__zone-badge--phase { background: var(--qbi-phase); }
.qbi__zone-badge--capped { background: var(--qbi-capped); }
.qbi__zone-badge--out { background: var(--qbi-capped); }
.qbi__zone-badge--floor { background: var(--qbi-floor); }
.qbi__zone-badge--none { background: var(--bf-muted, #64748b); }
.qbi__zone-detail {
	margin: 10px 0 0;
	font-size: 13.5px;
	color: var(--bf-muted, #64748b);
}

.qbi__meter {
	position: relative;
	display: flex;
	height: 14px;
	margin-top: 16px;
	border-radius: 999px;
	overflow: hidden;
	background: var(--bf-border, #e5e7eb);
}
.qbi__meter-seg { height: 100%; opacity: .35; transition: opacity .2s ease; }
.qbi__meter-seg--a { flex: 0 0 57.36%; background: var(--qbi-safe); }
.qbi__meter-seg--b { flex: 0 0 21.32%; background: var(--qbi-phase); }
.qbi__meter-seg--c { flex: 1 1 auto; background: var(--qbi-capped); }
.qbi__meter-seg.is-active { opacity: 1; }
.qbi__meter-marker {
	position: absolute;
	top: -4px;
	width: 4px;
	height: 22px;
	border-radius: 3px;
	background: var(--bf-ink, #0f172a);
	transform: translateX(-50%);
	transition: left .2s ease;
	box-shadow: 0 0 0 2px #fff;
}
.qbi__meter-labels {
	display: flex;
	justify-content: space-between;
	margin-top: 8px;
	font-size: 11.5px;
	color: #94a3b8;
	font-variant-numeric: tabular-nums;
}
.qbi__meter-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-top: 10px;
	font-size: 12.5px;
	color: var(--bf-muted, #64748b);
}
.qbi__meter-legend span { display: inline-flex; align-items: center; gap: 6px; }
.qbi__dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.qbi__dot--a { background: var(--qbi-safe); }
.qbi__dot--b { background: var(--qbi-phase); }
.qbi__dot--c { background: var(--qbi-capped); }

/* Summary card. */
.qbi__summary {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin-bottom: 16px;
}
@media (min-width: 520px) {
	.qbi__summary { grid-template-columns: repeat(3, 1fr); }
}
.qbi__summary-card {
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 14px;
	background: #fff;
	padding: 16px 18px;
	text-align: center;
}
.qbi__summary-card--primary {
	background: linear-gradient(135deg, color-mix(in srgb, var(--bf-primary, #4f46e5) 12%, #fff), color-mix(in srgb, var(--bf-accent, #0ea5e9) 10%, #fff));
	border-color: color-mix(in srgb, var(--bf-primary, #4f46e5) 30%, var(--bf-border, #e5e7eb));
}
.qbi__summary-label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: var(--bf-muted, #64748b);
	line-height: 1.3;
}
.qbi__summary-value {
	display: block;
	margin-top: 4px;
	font-size: clamp(24px, 4.2vw, 32px);
	font-weight: 800;
	color: var(--bf-ink, #0f172a);
	font-variant-numeric: tabular-nums;
}
.qbi__summary-card--primary .qbi__summary-value { color: var(--bf-primary, #4f46e5); }

/* Breakdown grid. */
.qbi__breakdown {
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 14px;
	background: var(--bf-bg-soft, #f8fafc);
	padding: 6px 16px;
}
.qbi__break-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	padding: 11px 0;
	border-bottom: 1px dashed var(--bf-border, #e5e7eb);
	font-size: 14px;
}
.qbi__break-row:last-child { border-bottom: 0; }
.qbi__break-row span { color: var(--bf-muted, #64748b); }
.qbi__break-row strong {
	color: var(--bf-ink, #0f172a);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

/* --------------------------------------------------------------- trust */

.qbi__trust { margin-top: 22px; }
.qbi__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin: 12px 0 0;
	font-size: 12.5px;
	color: var(--bf-muted, #64748b);
}
.qbi__meta a { color: var(--bf-primary, #4f46e5); font-weight: 700; text-decoration: none; }
.qbi__meta a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- print */

@media print {
	.qbi__inputs,
	.qbi__actions,
	.qbi__slider {
		display: none !important;
	}
	.qbi__grid { grid-template-columns: 1fr; }
	.qbi__summary-card--primary { background: #fff; }
	.qbi__summary-card--primary .qbi__summary-value { color: #000; }
	.qbi { color: #000; font-size: 11pt; }
	.qbi__zone, .qbi__summary-card, .qbi__breakdown { break-inside: avoid; }
}
