/**
 * Budget personnel en ligne — parcours par étapes (voir assets/js/budget-stepper.js).
 * Tout est préfixé .bs- pour ne pas interférer avec les anciens styles du formulaire.
 */

/* Aligner le titre et l'introduction de la page sur le bloc budget. */
.head-budget .contain-header-budget {
	max-width: 760px;
	margin-right: auto;
	margin-left: auto;
	padding-right: 0;
	padding-left: 0;
}

.head-budget .info-budget {
	max-width: 760px;
	margin-right: auto;
	margin-left: auto;
}

.head-budget .info-budget h1,
.head-budget .info-budget h2,
.head-budget .info-budget .h1,
.head-budget .info-budget .h2 {
	max-width: 760px;
	margin-right: 0;
	margin-left: 0;
	color: var(--bs-navy);
	letter-spacing: 0;
}

.head-budget .info-budget p {
	max-width: 760px;
	margin-right: 0;
	margin-left: 0;
	color: var(--bs-muted);
	font-size: 17px;
	line-height: 1.55;
}

:root {
	--bs-navy: #203468;
	--bs-navy-soft: #e9edf6;
	--bs-green: #76bc21;
	--bs-green-ink: #4d7f12;
	--bs-yellow: #f5a623;
	--bs-red: #c2410c;
	--bs-ink: #1b2440;
	--bs-muted: #5b6480;
	--bs-line: #d9deea;
	--bs-paper: #ffffff;
	--bs-wash: #f6f8fc;
	--bs-radius: 16px;
}

/* L'ancien formulaire reste en place (champs soumis), mais masqué. */
#budget_enligne.bs-on > :not(.bs-app) {
	display: none !important;
}

.bs-app {
	max-width: 760px;
	margin: 0 auto;
	scroll-margin-top: 96px;
	overflow-anchor: none;
	font-family: "Plus Jakarta Sans", system-ui, sans-serif;
	color: var(--bs-ink);
	background: var(--bs-paper);
	border: 1px solid var(--bs-line);
	border-radius: 24px;
	box-shadow: 0 18px 50px -24px rgba(32, 52, 104, .35);
}
.bs-app *,
.bs-app *::before,
.bs-app *::after { box-sizing: border-box; }
.bs-app [hidden] { display: none !important; }

/* ---------- En-tête : phase + progression ---------- */

.bs-head { padding: 22px 28px 0; }
.bs-phase {
	margin: 0 0 10px;
	font-size: 13px;
	letter-spacing: .02em;
	color: var(--bs-muted);
}
.bs-phase strong { color: var(--bs-navy); font-weight: 700; }

.bs-track { display: flex; gap: 4px; }
.bs-track__seg {
	flex: 1;
	height: 6px;
	border-radius: 3px;
	background: var(--bs-navy-soft);
	transition: background-color .3s;
}
.bs-track__seg.is-done { background: var(--bs-green); }
.bs-track__seg.is-current { background: var(--bs-navy); }
/* Petit espace entre les phases (situation / revenus / dépenses / résumé). */
.bs-track__seg[data-phase="Revenus"] + .bs-track__seg[data-phase="Dépenses"],
.bs-track__seg[data-phase="Situation"] + .bs-track__seg[data-phase="Revenus"],
.bs-track__seg[data-phase="Dépenses"] + .bs-track__seg[data-phase="Résumé"] { margin-left: 8px; }

/* ---------- Étapes ---------- */

.bs-stage { padding: 26px 28px 8px; }
.bs-step.bs-in-r { animation: bs-in-r .28s ease-out; }
.bs-step.bs-in-l { animation: bs-in-l .28s ease-out; }
@keyframes bs-in-r { from { opacity: 0; transform: translateX(18px); } }
@keyframes bs-in-l { from { opacity: 0; transform: translateX(-18px); } }

.bs-app .bs-title {
	margin: 0 0 6px;
	font-family: inherit;
	font-size: clamp(24px, 4.2vw, 32px);
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -.02em;
	text-transform: none;
	color: var(--bs-navy);
	outline: none;
}
.bs-lede {
	margin: 0 0 22px;
	font-size: 16px;
	line-height: 1.5;
	color: var(--bs-muted);
}

/* Situation familiale */
.bs-q { margin: 0 0 26px; padding: 0; border: 0; }
.bs-q legend,
.bs-q__label {
	display: block;
	margin: 0 0 10px;
	padding: 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--bs-ink);
}
.bs-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bs-choice { position: relative; margin: 0; cursor: pointer; }
.bs-choice input { position: absolute; opacity: 0; pointer-events: none; }
.bs-choice span {
	display: flex;
	align-items: center;
	min-height: 64px;
	height: 100%;
	padding: 14px 16px 14px 46px;
	border: 2px solid var(--bs-line);
	border-radius: var(--bs-radius);
	font-weight: 600;
	line-height: 1.3;
	background: var(--bs-paper);
	transition: border-color .15s, background-color .15s;
}
.bs-choice span::before {
	content: "";
	position: absolute;
	left: 16px;
	top: 50%;
	width: 20px;
	height: 20px;
	margin-top: -10px;
	border: 2px solid var(--bs-line);
	border-radius: 50%;
	background: #fff;
}
.bs-choice input:checked + span { border-color: var(--bs-navy); background: var(--bs-navy-soft); }
.bs-choice input:checked + span::before { border: 6px solid var(--bs-navy); }
.bs-choice input:focus-visible + span { outline: 3px solid var(--bs-yellow); outline-offset: 2px; }

.bs-counter { display: inline-flex; align-items: center; gap: 8px; }
.bs-counter input {
	width: 72px;
	height: 52px;
	border: 2px solid var(--bs-line);
	border-radius: 12px;
	text-align: center;
	font: 700 20px/1 "Plus Jakarta Sans", system-ui, sans-serif;
	font-variant-numeric: tabular-nums;
	color: var(--bs-ink);
}
.bs-counter__btn {
	width: 52px;
	height: 52px;
	border: 0;
	border-radius: 50%;
	background: var(--bs-navy-soft);
	color: var(--bs-navy);
	font-size: 24px;
	font-weight: 700;
	cursor: pointer;
}
.bs-counter__btn:hover { background: #dbe2f1; }

/* ---------- Liste d'éléments d'une catégorie ---------- */

.bs-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--bs-line); }
.bs-item { border-bottom: 1px solid var(--bs-line); }

.bs-item__toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 60px;
	padding: 12px 4px;
	border: 0;
	background: none;
	font: inherit;
	text-align: left;
	color: var(--bs-ink);
	cursor: pointer;
}
.bs-item__toggle:hover .bs-item__label { color: var(--bs-navy); }
.bs-item__text { flex: 1; min-width: 0; }
.bs-item__label { display: block; font-size: 16px; font-weight: 600; line-height: 1.35; }
.bs-item__hint { display: block; margin-top: 2px; font-size: 13px; color: var(--bs-muted); }
.bs-item__amt {
	font-size: 15px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: var(--bs-green-ink);
}

/* Marqueur : « + » tant que rien n'est inscrit, crochet vert une fois rempli. */
.bs-item__mark {
	position: relative;
	flex: none;
	width: 32px;
	height: 32px;
	border: 2px solid var(--bs-line);
	border-radius: 50%;
	transition: background-color .15s, border-color .15s, transform .2s;
}
.bs-item__mark::before,
.bs-item__mark::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	background: var(--bs-navy);
	border-radius: 1px;
}
.bs-item__mark::before { width: 12px; height: 2px; margin: -1px 0 0 -6px; }
.bs-item__mark::after { width: 2px; height: 12px; margin: -6px 0 0 -1px; transition: transform .2s; }
.bs-item.is-open .bs-item__mark::after { transform: scaleY(0); }

.bs-item.is-on .bs-item__mark { background: var(--bs-green); border-color: var(--bs-green); }
.bs-item.is-on .bs-item__mark::before,
.bs-item.is-on .bs-item__mark::after { background: #fff; }
.bs-item.is-on:not(.is-open) .bs-item__mark::before { width: 6px; margin: 1px 0 0 -6px; transform: rotate(45deg); }
.bs-item.is-on:not(.is-open) .bs-item__mark::after { height: 11px; margin: -6px 0 0 1px; transform: rotate(45deg); }

.bs-item__body { padding: 2px 4px 18px; }
.bs-entry + .bs-entry { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--bs-line); }
.bs-entry__n { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--bs-muted); }

.bs-amounts { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.bs-conj-only { display: none; }
.bs-has-conj .bs-conj-only { display: block; }
.bs-amounts .bs-field { flex: 1 1 160px; min-width: 0; max-width: 240px; }
/* Sans conjoint, le libellé « Vous » n'apporte rien. */
.bs-app:not(.bs-has-conj) .bs-amounts .bs-field__who {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.bs-field__who {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 700;
	color: var(--bs-muted);
}
.bs-field__box {
	display: flex;
	align-items: center;
	border: 2px solid var(--bs-line);
	border-radius: 12px;
	background: #fff;
	transition: border-color .15s, box-shadow .15s;
}
.bs-field__box:focus-within { border-color: var(--bs-navy); box-shadow: 0 0 0 4px rgba(32, 52, 104, .12); }
.bs-app .bs-field__box input {
	flex: 1;
	width: 100%;
	min-width: 0;
	height: 52px;
	margin: 0;
	padding: 0 14px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	box-shadow: none;
	font: 600 18px/1 "Plus Jakarta Sans", system-ui, sans-serif;
	font-variant-numeric: tabular-nums;
	color: var(--bs-ink);
	outline: none;
	-webkit-appearance: none;
}
.bs-field__box span { padding-right: 14px; font-weight: 700; color: var(--bs-muted); }

.bs-freq { display: flex; flex-wrap: wrap; gap: 6px; }
.bs-chip { position: relative; margin: 0; cursor: pointer; }
.bs-chip input { position: absolute; opacity: 0; pointer-events: none; }
.bs-chip span {
	display: inline-block;
	padding: 8px 14px;
	border: 1.5px solid var(--bs-line);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	color: var(--bs-muted);
	background: #fff;
	transition: all .15s;
}
.bs-chip:hover span { border-color: var(--bs-navy); color: var(--bs-navy); }
.bs-chip input:checked + span { border-color: var(--bs-navy); background: var(--bs-navy); color: #fff; }
.bs-chip input:focus-visible + span { outline: 3px solid var(--bs-yellow); outline-offset: 2px; }

.bs-item__actions { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.bs-link {
	padding: 4px 0;
	border: 0;
	background: none;
	font: 600 14px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
	color: var(--bs-navy);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.bs-clear { color: var(--bs-muted); }

/* ---------- Barre du bas : solde + navigation ---------- */

.bs-foot {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 28px;
	border-top: 1px solid var(--bs-line);
	border-radius: 0 0 24px 24px;
	background: rgba(255, 255, 255, .96);
	backdrop-filter: blur(8px);
}
.bs-balance { display: flex; flex-direction: column; line-height: 1.1; }
.bs-balance__label { font-size: 12px; font-weight: 600; color: var(--bs-muted); }
.bs-balance__value {
	font-size: 26px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	letter-spacing: -.02em;
	color: var(--bs-navy);
	transition: color .2s;
}
.bs-balance.is-pos .bs-balance__value { color: var(--bs-green-ink); }
.bs-balance.is-neg .bs-balance__value { color: var(--bs-red); }
.bs-at-summary .bs-balance { visibility: hidden; }

.bs-nav { display: flex; gap: 8px; }
.bs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 52px;
	padding: 0 22px;
	border: 2px solid transparent;
	border-radius: 999px;
	font: 700 16px/1 "Plus Jakarta Sans", system-ui, sans-serif;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, transform .1s;
}
.bs-btn:active { transform: translateY(1px); }
.bs-btn--primary { background: var(--bs-green); color: #fff; }
.bs-btn--primary:hover { background: #69a81d; }
.bs-btn--ghost { background: transparent; border-color: var(--bs-line); color: var(--bs-navy); }
.bs-btn--ghost:hover { border-color: var(--bs-navy); color: var(--bs-navy); text-decoration: none; }

.bs-app button:focus-visible,
.bs-app a:focus-visible,
.bs-counter input:focus-visible { outline: 3px solid var(--bs-yellow); outline-offset: 2px; }

/* ---------- Résumé ---------- */

.bs-sum { margin: 18px 0 8px; }
.bs-sum > div {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 12px 0;
	border-bottom: 1px solid var(--bs-line);
}
.bs-sum dt { font-weight: 600; color: var(--bs-muted); }
.bs-sum dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bs-sum .bs-sum__total { border-bottom: 0; padding-top: 16px; }
.bs-sum__total dt { color: var(--bs-navy); font-weight: 700; }
.bs-sum__total dd { font-size: 34px; font-weight: 800; color: var(--bs-green-ink); letter-spacing: -.02em; }
.bs-sum__total.is-neg dd { color: var(--bs-red); }
.bs-sum__note { margin: 0 0 8px; font-size: 15px; line-height: 1.5; color: var(--bs-ink); }
.bs-sum__note:empty { display: none; }

.bs-send {
	margin: 22px 0 18px;
	padding: 22px;
	border-radius: var(--bs-radius);
	background: var(--bs-wash);
}
.bs-app .bs-send h3 { margin: 0 0 4px; font-family: inherit; font-size: 19px; font-weight: 800; color: var(--bs-navy); text-transform: none; }
.bs-send p { margin: 0 0 16px; font-size: 15px; color: var(--bs-muted); }
.bs-send__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.bs-field--wide { grid-column: 1 / -1; }
.bs-consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	min-height: 44px;
	margin: 0 0 14px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--bs-ink);
	cursor: pointer;
}
.bs-consent input {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 1px 0 0;
	accent-color: var(--bs-green-ink);
	cursor: pointer;
}
.bs-consent a { color: var(--bs-navy); text-decoration: underline; text-underline-offset: 2px; }
.bs-consent strong { font-weight: 700; }
.bs-consent input:focus-visible { outline: 3px solid var(--bs-yellow); outline-offset: 2px; }
.bs-consent.is-invalid { color: var(--bs-red); }
.bs-consent--optional { margin-top: 2px; color: var(--bs-muted); }
.bs-consent__error { margin: -8px 0 14px 32px; font-size: 13px; font-weight: 600; color: var(--bs-red); }
.bs-btn--send { width: 100%; }

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
	.head-budget .contain-header-budget {
		padding-right: 15px;
		padding-left: 15px;
	}

	.head-budget .info-budget p {
		font-size: 16px;
	}

	.bs-app {
		margin: 0 -15px;
		border-left: 0;
		border-right: 0;
		border-radius: 0;
		box-shadow: none;
	}
	.bs-head { padding: 16px 16px 0; }
	.bs-stage { padding: 20px 16px 4px; }
	.bs-choices { grid-template-columns: 1fr; }
	.bs-amounts { display: grid; grid-template-columns: 1fr; gap: 10px; }
	.bs-has-conj .bs-amounts { grid-template-columns: 1fr 1fr; }
	.bs-amounts .bs-field { max-width: none; }
	.bs-freq { display: grid; grid-template-columns: repeat(4, 1fr); }
	.bs-chip span { display: block; padding: 9px 2px; text-align: center; font-size: 13px; white-space: nowrap; }
	.bs-send { margin-left: -4px; margin-right: -4px; padding: 18px 16px; }
	.bs-send__grid { grid-template-columns: 1fr; }

	.bs-foot {
		flex-wrap: wrap;
		gap: 10px;
		padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
		border-radius: 0;
		box-shadow: 0 -8px 24px -12px rgba(32, 52, 104, .25);
	}
	.bs-balance { flex-direction: row; align-items: baseline; justify-content: space-between; width: 100%; }
	.bs-balance__value { font-size: 20px; }
	.bs-at-summary .bs-balance { display: none; }
	.bs-nav { width: 100%; }
	.bs-nav .bs-btn--primary { flex: 1; }
	.bs-btn { min-height: 50px; padding: 0 18px; }
}

/* Pendant que le parcours est à l'écran, la bulle Lionard est réduite à son avatar pour ne pas
   masquer les boutons ; son texte reste lu par les lecteurs d'écran. */
body.bs-in-view .abi-shell:not(.is-open) .abi-launcher {
	min-height: 0;
	padding: 5px;
}
body.bs-in-view .abi-shell:not(.is-open) .abi-launcher__copy {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
body.bs-in-view .abi-shell:not(.is-open) .abi-launcher__pulse { display: none; }

/* Sur mobile, elle remonte au-dessus de la barre collante. .abi-shell y fait toute la largeur :
   on le rend transparent aux clics, sauf la bulle elle-même. */
@media (max-width: 991px) {
	body.bs-in-view .abi-shell:not(.is-open) {
		bottom: calc(var(--bs-foot-h, 110px) + 8px);
		pointer-events: none;
		transition: bottom .2s;
	}
	body.bs-in-view .abi-shell:not(.is-open) .abi-launcher { pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
	.bs-app *,
	.bs-app *::before,
	.bs-app *::after { animation: none !important; transition: none !important; }
}

.bs-at-summary .bs-foot { justify-content: flex-start; }
.bs-at-summary .bs-balance { display: none; }

/* ---------- Banniere NovaPlan sous le budget ---------- */

.budget-novaplan {
	padding: 66px 0 84px;
	background: var(--bs-wash);
}

.budget-novaplan__banner {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
	gap: 34px;
	align-items: stretch;
	padding: 42px;
	border-radius: 24px;
	color: #fff;
	background:
		linear-gradient(135deg, rgba(32, 52, 104, .98), rgba(23, 38, 71, .98) 58%, rgba(77, 127, 18, .94));
	box-shadow: 0 24px 70px -36px rgba(32, 52, 104, .56);
}

.budget-novaplan__kicker {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	margin-bottom: 18px;
	padding: 0 12px;
	border: 1px solid rgba(255, 255, 255, .26);
	border-radius: 999px;
	color: #d9f7b8;
	background: rgba(255, 255, 255, .08);
	font-size: 12px;
	font-weight: 900;
	line-height: 1.2;
	text-transform: uppercase;
}

.budget-novaplan h2 {
	margin: 0 0 14px;
	color: #fff;
	font-family: "Plus Jakarta Sans", system-ui, sans-serif;
	font-size: clamp(30px, 4vw, 46px);
	font-weight: 900;
	line-height: 1.08;
	text-transform: none;
}

.budget-novaplan__intro > p {
	max-width: 620px;
	margin: 0;
	color: rgba(255, 255, 255, .86);
	font-size: 17px;
	line-height: 1.55;
}

.budget-novaplan__cta {
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid rgba(255, 255, 255, .18);
}

.budget-novaplan h3 {
	margin: 0 0 6px;
	color: #fff;
	font-family: "Plus Jakarta Sans", system-ui, sans-serif;
	font-weight: 800;
	line-height: 1.25;
	text-transform: none;
}

.budget-novaplan__cta h3 {
	font-size: 20px;
}

.budget-novaplan__cta p {
	margin: 0 0 18px;
	color: rgba(255, 255, 255, .78);
	font-size: 15px;
	line-height: 1.5;
}

.budget-novaplan__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	padding: 0 24px;
	border-radius: 999px;
	color: var(--bs-navy);
	background: #fff;
	font-size: 16px;
	font-weight: 900;
	text-decoration: none;
}

.budget-novaplan__button:hover {
	color: var(--bs-navy);
	text-decoration: none;
	background: #f2f7ff;
}

.budget-novaplan__button:focus-visible {
	outline: 3px solid var(--bs-yellow);
	outline-offset: 3px;
}

.budget-novaplan__points {
	display: grid;
	gap: 14px;
}

.budget-novaplan__point {
	padding: 18px;
	border: 1px solid rgba(255, 255, 255, .18);
	border-radius: 16px;
	background: rgba(255, 255, 255, .09);
}

.budget-novaplan__point h3 {
	font-size: 18px;
}

.budget-novaplan__point p {
	margin: 0;
	color: rgba(255, 255, 255, .78);
	font-size: 14px;
	line-height: 1.5;
}

@media (max-width: 991px) {
	.budget-novaplan__banner {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.budget-novaplan {
		padding: 48px 0 60px;
	}

	.budget-novaplan__banner {
		padding: 28px 20px;
		border-radius: 18px;
	}

	.budget-novaplan__button {
		width: 100%;
	}
}
