/* Boof — boof.dujardin.me
 *
 * La palette est celle de Notes, de Signets et de Tâches (et donc de Sono93),
 * teinte pour teinte : des sites de la même main doivent se reconnaître.
 *
 * Sobre exprès : pas d'image, pas de police à télécharger, pas d'animation
 * qui ne serve à rien. Une page qui s'ouvre vite, sur un vieux téléphone aussi.
 *
 * Une différence de forme avec Tâches, voulue : Tâches écrit ses teintes en
 * light-dark(), que Safari ne connaît que depuis la 17.5. La cible descend à
 * Safari iOS 15 ; les deux jeux de teintes sont donc déclarés à part — le clair
 * par défaut, le sombre par la préférence du système ou par le choix enregistré.
 */

:root {
	color-scheme: light;

	--fond: #fff;
	--laterale: #f4f4f7;
	--surface: #f1f1f5;
	--surface-haute: #e6e6ee;
	--bordure: #e1e1e9;
	--separateur: #e4e4ec;
	--survol: #eaeaf1;
	--texte: #16171a;
	--texte-doux: #3b3f47;
	--discret: #62687a;
	--efface: #6b7180;

	--accent: #7b2cbf;
	--accent-texte: #fff;
	--accent-voile: rgba(123, 44, 191, .12);
	--accent-halo: rgba(123, 44, 191, .35);

	--erreur: #c0272d;
	--succes: #0f7a52;
	--avertir: #a8850c;
	--surligne: rgba(231, 190, 35, .45);

	--ombre: rgba(0, 0, 0, .12);
	--voile-fond: rgba(0, 0, 0, .35);

	--rayon: 6px;
	--largeur-laterale: 232px;
}

/* Les teintes sombres, une fois pour les deux façons d'y arriver. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="clair"]) {
		color-scheme: dark;

		--fond: #0b0b0d;
		--laterale: #000;
		--surface: #17181c;
		--surface-haute: #212328;
		--bordure: #2a2c33;
		--separateur: #1d1f25;
		--survol: #131418;
		--texte: #f2f3f5;
		--texte-doux: #c8ccd3;
		--discret: #9096a0;
		--efface: #5f6672;

		--accent: #c589f2;
		--accent-texte: #17171b;
		--accent-voile: rgba(197, 137, 242, .16);
		--accent-halo: rgba(197, 137, 242, .45);

		--erreur: #ff6b6b;
		--succes: #5ddba0;
		--avertir: #e7be23;
		--surligne: rgba(231, 190, 35, .35);

		--ombre: rgba(0, 0, 0, .35);
		--voile-fond: rgba(0, 0, 0, .6);
	}
}

:root[data-theme="sombre"] {
	color-scheme: dark;

	--fond: #0b0b0d;
	--laterale: #000;
	--surface: #17181c;
	--surface-haute: #212328;
	--bordure: #2a2c33;
	--separateur: #1d1f25;
	--survol: #131418;
	--texte: #f2f3f5;
	--texte-doux: #c8ccd3;
	--discret: #9096a0;
	--efface: #5f6672;

	--accent: #c589f2;
	--accent-texte: #17171b;
	--accent-voile: rgba(197, 137, 242, .16);
	--accent-halo: rgba(197, 137, 242, .45);

	--erreur: #ff6b6b;
	--succes: #5ddba0;
	--avertir: #e7be23;
	--surligne: rgba(231, 190, 35, .35);

	--ombre: rgba(0, 0, 0, .35);
	--voile-fond: rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
	margin: 0;
	background: var(--fond);
	color: var(--texte);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.hors-ecran {
	position: absolute;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Les symboles des pictogrammes, posés une fois dans la page. */
.symboles { position: absolute; width: 0; height: 0; overflow: hidden; }

.icone {
	width: 20px; height: 20px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

kbd {
	padding: 1px 5px;
	border: 1px solid var(--bordure);
	border-bottom-width: 2px;
	border-radius: 4px;
	background: var(--surface);
	font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Le cadre ------------------------------------------------------------ */

.cadre { display: flex; height: 100%; }

.colonne {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.vue--nue {
	display: grid;
	place-items: center;
	min-height: 100%;
	padding: 24px 16px;
}

.vue--page {
	flex: 1;
	overflow-y: auto;
	display: flex;
	justify-content: center;
	padding: 24px 16px 64px;
}

.page-reglages { display: flex; flex-direction: column; }

/* --- La barre latérale --------------------------------------------------- */

.laterale {
	width: var(--largeur-laterale);
	flex: none;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--laterale);
	border-right: 1px solid var(--separateur);
	padding: 14px 10px 10px;
	overflow-y: auto;
}

.marque {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 4px 8px 4px;
	font-weight: 600;
}

.logo { display: block; width: 26px; height: 26px; }
.logo svg { display: block; width: 100%; height: 100%; }
/* Le mauve de la marque est FIXE, comme le favicon et ceux de la fratrie : il
   ne suit pas l'accent, qui s'éclaircit en thème sombre. */
.logo-fond { fill: #7b2cbf; }
.logo-trace {
	fill: none;
	stroke: #fff;
	stroke-width: 2;
}
.logo-trace--fin { stroke-width: 1.5; opacity: .7; }

.menu { flex: 1; display: flex; flex-direction: column; gap: 1px; }

.menu-titre {
	margin: 6px 0 4px;
	padding: 0 8px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--efface);
}

.menu-dossiers { display: flex; flex-direction: column; gap: 1px; }

.menu-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 8px;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: var(--texte-doux);
	text-align: left;
	width: 100%;
	cursor: pointer;
}

.menu-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item:hover { background: var(--survol); color: var(--texte); }

.menu-item[aria-current="page"] {
	background: var(--accent-voile);
	color: var(--accent);
	font-weight: 500;
}

.menu-item--discret { color: var(--discret); font-size: 14px; }

.menu-emoji {
	width: 20px;
	flex: none;
	text-align: center;
	font-size: 16px;
	line-height: 1;
}

.menu-nom { flex: 1; }

.menu-compte {
	margin-left: auto;
	flex: none;
	padding-left: 6px;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	color: var(--efface);
}
.menu-item[aria-current="page"] .menu-compte { color: var(--accent); }

.pied {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-top: 10px;
	border-top: 1px solid var(--separateur);
}

.ligne-compte { display: flex; align-items: center; gap: 2px; }

.compte {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 8px;
	border-radius: var(--rayon);
	color: var(--texte-doux);
}
.compte span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compte:hover { background: var(--survol); color: var(--texte); }

/* --- Les outils ------------------------------------------------------------ */

.outil {
	position: relative;
	display: inline-grid;
	place-items: center;
	min-width: 34px; height: 34px;
	padding: 0;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: var(--discret);
	cursor: pointer;
}
.outil:hover { background: var(--survol); color: var(--texte); }
.outil[aria-pressed="true"] { color: var(--accent); }

.outil--texte { padding: 0 10px; font-size: 14px; }
.outil--danger { color: var(--erreur); }

/* « Ranger dans » : un sélecteur natif posé, invisible, sur le pictogramme.
   Il reste le vrai contrôle — clavier, lecteur d'écran et liste native du
   téléphone compris — sans le poids visuel d'une liste déroulante. */
.outil--choix select {
	position: absolute;
	inset: 0;
	width: 100%;
	opacity: 0;
	cursor: pointer;
}
.outil--choix:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

.bascule-theme .theme-clair,
.bascule-theme .theme-sombre { display: none; }
:root[data-theme="clair"] .theme-sombre { display: grid; }
:root[data-theme="sombre"] .theme-clair { display: grid; }

@media (prefers-color-scheme: light) {
	:root:not([data-theme]) .theme-sombre { display: grid; }
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) .theme-clair { display: grid; }
}

/* --- La barre du haut ---------------------------------------------------- */

.haut {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--separateur);
}

.haut-titre { margin: 0; font-size: 17px; font-weight: 600; }
.haut-outils { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.burger {
	display: none;
	place-items: center;
	width: 36px; height: 36px;
	flex: none;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: var(--texte-doux);
	cursor: pointer;
}
.burger:hover { background: var(--survol); }

.voile {
	position: fixed;
	inset: 0;
	background: var(--voile-fond);
	z-index: 15;
}

/* --- La recherche ---------------------------------------------------------- */

.recherche {
	position: relative;
	flex: 1;
	max-width: 560px;
	display: flex;
	align-items: center;
}

.recherche > .icone {
	position: absolute;
	left: 10px;
	color: var(--efface);
	pointer-events: none;
}

.recherche input {
	width: 100%;
	padding: 8px 70px 8px 38px;
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	background: var(--surface);
	font-size: 15px;
	-webkit-appearance: none;
	appearance: none;
}

.recherche input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.recherche-touche {
	position: absolute;
	right: 10px;
	color: var(--efface);
	pointer-events: none;
}
.recherche input:focus ~ .recherche-touche,
.recherche input:not(:placeholder-shown) ~ .recherche-touche { display: none; }

.lien {
	padding: 0;
	border: 0;
	background: none;
	color: var(--discret);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}
.lien:hover { color: var(--accent); }

/* --- La fiche et le formulaire d'ajout --------------------------------------------- */

.fiche { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.fiche .champ { margin-bottom: 0; }

.champ textarea {
	width: 100%;
	min-height: 90px;
	padding: 9px 11px;
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	background: var(--fond);
	resize: vertical;
}
.champ textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.case { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--texte-doux); cursor: pointer; }
.case input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.fiche-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.fiche-actions .bouton { width: auto; }

/* --- Panneaux et annonces --------------------------------------------------------- */

.panneau {
	position: fixed;
	top: 0; right: 0; bottom: 0;
	z-index: 20;
	width: min(440px, 100%);
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: var(--fond);
	border-left: 1px solid var(--bordure);
	box-shadow: 0 0 30px var(--ombre);
	overflow-y: auto;
}

.panneau-tete { display: flex; align-items: center; justify-content: space-between; }
.panneau-tete h2 { margin: 0; font-size: 17px; }
.panneau-note { margin: 0; font-size: 13px; color: var(--discret); }
/* Le texte d'une question : les retours à la ligne comptent, ils séparent ce
   qu'on vise de ce qu'il faut en savoir. */
.confirmer-texte { margin: 0; white-space: pre-line; }
.panneau--confirmer { width: min(420px, 100%); }

.raccourcis { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.raccourcis dt { white-space: nowrap; }
.raccourcis dd { margin: 0; color: var(--texte-doux); }

.annonce {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 40;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: calc(100% - 32px);
	padding: 10px 14px;
	border-radius: calc(var(--rayon) * 1.5);
	background: var(--texte);
	color: var(--fond);
	font-size: 14px;
	box-shadow: 0 8px 24px var(--ombre);
}

.annonce-action {
	flex: none;
	padding: 4px 8px;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

/* Le menu du clic droit. */
.menu-contextuel {
	position: fixed;
	z-index: 50;
	min-width: 220px;
	padding: 4px;
	border: 1px solid var(--bordure);
	border-radius: calc(var(--rayon) * 1.5);
	background: var(--fond);
	box-shadow: 0 12px 32px var(--ombre);
}

.menu-contextuel button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 7px 10px;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: var(--texte-doux);
	text-align: left;
	cursor: pointer;
}
.menu-contextuel button:hover,
.menu-contextuel button:focus-visible { background: var(--survol); color: var(--texte); outline: none; }
.menu-contextuel .icone { width: 18px; height: 18px; color: var(--discret); }
.menu-contextuel kbd { margin-left: auto; color: var(--efface); }

/* --- Formulaires et cartes (connexion, réglages) ------------------------------------ */

.carte {
	width: min(380px, 100%);
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: calc(var(--rayon) * 2);
	padding: 28px;
	box-shadow: 0 8px 30px var(--ombre);
}

.carte--large { width: min(600px, 100%); box-shadow: none; align-self: flex-start; }

.carte .marque { justify-content: center; padding: 0 0 18px; font-size: 18px; }
.carte h2 { margin: 0 0 4px; font-size: 18px; }
.carte .accroche { margin: 0 0 16px; color: var(--discret); font-size: 14px; }

.carte h3 {
	margin: 28px 0 6px;
	padding-top: 24px;
	border-top: 1px solid var(--separateur);
	font-size: 15px;
}
.carte h3:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }

.champ { display: block; margin-bottom: 14px; }
.champ > span { display: block; margin-bottom: 5px; font-size: 13px; color: var(--texte-doux); }

.champ input,
.champ select {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	background: var(--fond);
}

.champ input:focus-visible,
.champ select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.bouton {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 10px 14px;
	border: 0;
	border-radius: var(--rayon);
	background: var(--accent);
	color: var(--accent-texte);
	font-weight: 600;
	text-align: center;
	cursor: pointer;
}
.bouton:hover { filter: brightness(1.08); }

.bouton--danger { background: var(--erreur); }
.bouton--sobre { background: var(--surface-haute); color: var(--texte-doux); }
.bouton--sobre:hover { background: var(--survol); filter: none; color: var(--texte); }
.bouton--petit { width: auto; padding: 6px 10px; font-size: 13px; font-weight: 500; }

.bouton--nouvelle { justify-content: flex-start; padding: 9px 10px; }

.secours { margin-top: 18px; }
.secours summary { cursor: pointer; color: var(--discret); font-size: 14px; text-align: center; }
.secours[open] summary { margin-bottom: 14px; }

.message {
	margin: 0 0 16px;
	padding: 9px 12px;
	border-radius: var(--rayon);
	font-size: 14px;
}
.message p { margin: 0 0 6px; }
.message p:last-child { margin-bottom: 0; }
.message--erreur { background: var(--accent-voile); color: var(--erreur); }
.message--succes { background: var(--accent-voile); color: var(--succes); }

.sous-carte { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--discret); }
.sous-carte a { color: var(--accent); }

.liste-sobre { margin: 0 0 14px; padding: 0; list-style: none; }
.liste-sobre li { padding: 8px 0; border-bottom: 1px solid var(--separateur); }
.liste-sobre li:last-child { border-bottom: 0; }
.liste-sobre small { display: block; color: var(--efface); font-size: 12px; }

.liste-jetons li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.pastille {
	display: inline-block;
	margin-left: 6px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--accent-voile);
	color: var(--accent);
	font-size: 11px;
	font-weight: 600;
}

.formulaire-ligne { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: end; }
.formulaire-ligne .bouton { grid-column: 1 / -1; }

.jeton-clair {
	width: 100%;
	margin: 6px 0;
	padding: 8px 10px;
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	background: var(--fond);
	color: var(--texte);
	font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 8px 0 0; padding: 0; list-style: none; }

.pied-carte { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--separateur); }

code {
	padding: 1px 4px;
	border-radius: 3px;
	background: var(--surface-haute);
	font-size: .92em;
}

/* --- La vue ---------------------------------------------------------------- */

.vue {
	flex: 1;
	overflow-y: auto;
	padding: 20px 24px 80px;
}

.vue:focus { outline: none; }

.vue-contenu {
	max-width: 760px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.date-du-jour { margin: 0 0 -4px; color: var(--discret); font-size: 14px; }
.date-du-jour:empty { display: none; }

/* Une carte de la page : un filet, pas d'ombre. */
.bloc {
	padding: 16px 18px;
	border: 1px solid var(--separateur);
	border-radius: calc(var(--rayon) * 1.5);
	background: var(--fond);
}

.bloc-tete {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}
.bloc-tete h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; }
.bloc-outils { display: flex; align-items: center; gap: 6px; }
.bloc-note { margin: 0 0 12px; font-size: 13px; color: var(--discret); }
.bloc > :last-child { margin-bottom: 0; }

.vide-doux { margin: 0 0 12px; color: var(--discret); font-size: 14px; }

.bouton--ligne { width: auto; margin-top: 14px; }

/* --- Les jauges ---------------------------------------------------------------- */
/* L'état se lit en texte (« au plus 5 g ») autant qu'en couleur. */

.jauges { display: flex; flex-direction: column; gap: 14px; }
.jauges-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }

.jauge { --teinte: var(--accent); min-width: 0; }
.jauge--bien { --teinte: var(--succes); }
.jauge--depasse { --teinte: var(--avertir); }

.jauge-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.jauge-nom { color: var(--texte-doux); }
.jauge-chiffres { color: var(--discret); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jauge-chiffres strong { color: var(--texte); font-weight: 600; }

.jauge-piste { height: 6px; margin-top: 5px; border-radius: 999px; background: var(--surface-haute); overflow: hidden; }
.jauge-plein { height: 100%; border-radius: inherit; background: var(--teinte); }

.jauge--grande .jauge-tete { font-size: 15px; }
.jauge--grande .jauge-chiffres strong { font-size: 22px; }
.jauge--grande .jauge-piste { height: 10px; }

.jauge-note { display: block; margin-top: 3px; font-size: 11px; color: var(--efface); }

/* --- Les conseils ----------------------------------------------------------------- */

.conseils { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.conseil {
	padding: 8px 12px;
	border-left: 3px solid var(--bordure);
	border-radius: 0 var(--rayon) var(--rayon) 0;
	background: var(--surface);
	font-size: 14px;
}
.conseil strong { display: block; margin-bottom: 1px; }
.conseil--attention { border-left-color: var(--avertir); }
.conseil--bravo { border-left-color: var(--succes); }
.conseil--info { border-left-color: var(--accent); }
.conseil--attente { color: var(--discret); }

/* --- Les pastilles de gestes : repas types, portions ----------------------------------- */

.pastilles, .portions { display: flex; flex-wrap: wrap; gap: 6px; }

.pastille-geste {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px;
	border: 1px solid var(--bordure);
	border-radius: 999px;
	background: var(--fond);
	color: var(--texte-doux);
	font-size: 13px;
	cursor: pointer;
}
.pastille-geste:hover { border-color: var(--accent); color: var(--texte); }
.pastille-emoji { font-size: 15px; line-height: 1; }

.poids-resume { margin: 0 0 6px; color: var(--discret); }
.poids-resume strong { color: var(--texte); font-size: 18px; }

/* --- L'eau ------------------------------------------------------------------------ */

.bloc--eau { padding: 12px 18px 10px; }
.eau-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.eau-titre { font-weight: 600; font-size: 15px; }
.eau-valeur { color: var(--discret); font-variant-numeric: tabular-nums; }
.eau-valeur strong { color: var(--texte); font-size: 18px; font-weight: 600; }
.eau-note { margin: 4px 0 0; font-size: 12px; color: var(--efface); }

/* La tirette : la piste se remplit jusqu'au pouce (--plein, posé par app.js). */
.tirette {
	--plein: 0%;
	--eau: #2f80c9;
	width: 100%;
	height: 22px;
	margin: 8px 0 0;
	background: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}
:root[data-theme="sombre"] .tirette { --eau: #6cb4f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .tirette { --eau: #6cb4f0; } }

.tirette::-webkit-slider-runnable-track {
	height: 8px;
	border-radius: 999px;
	background: linear-gradient(to right, var(--eau) var(--plein), var(--surface-haute) var(--plein));
}
.tirette::-moz-range-track { height: 8px; border-radius: 999px; background: var(--surface-haute); }
.tirette::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--eau); }

.tirette::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 22px; height: 22px;
	margin-top: -7px;
	border: 2px solid var(--fond);
	border-radius: 50%;
	background: var(--eau);
	box-shadow: 0 1px 3px var(--ombre);
}
.tirette::-moz-range-thumb {
	width: 18px; height: 18px;
	border: 2px solid var(--fond);
	border-radius: 50%;
	background: var(--eau);
}

.bloc--eau-atteinte .eau-valeur strong { color: var(--succes); }

/* --- Le journal ----------------------------------------------------------------- */

.repas .bloc-tete { margin-bottom: 6px; }
.repas-total { margin-left: 10px; font-weight: 400; font-size: 13px; color: var(--discret); font-variant-numeric: tabular-nums; }

.entrees { margin: 0; padding: 0; list-style: none; }

.entree {
	display: grid;
	grid-template-columns: 1fr auto 72px auto;
	align-items: center;
	gap: 10px;
	padding: 6px 0;
	border-top: 1px solid var(--separateur);
	font-size: 14px;
}

.entree-nom { min-width: 0; display: flex; flex-direction: column; }
.entree-nom span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entree-marque { font-size: 12px; color: var(--efface); }

.entree-quantite {
	padding: 2px 6px;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: var(--texte-doux);
	font-variant-numeric: tabular-nums;
	text-decoration: underline dotted var(--efface);
	text-underline-offset: 3px;
	cursor: pointer;
}
.entree-quantite:hover { background: var(--survol); color: var(--texte); }
.entree-quantite-champ { width: 80px; padding: 3px 6px; border: 1px solid var(--accent); border-radius: var(--rayon); background: var(--fond); }

.entree-energie { text-align: right; color: var(--discret); font-variant-numeric: tabular-nums; }
.entree-retirer { opacity: .55; }
.entree:hover .entree-retirer, .entree-retirer:focus-visible { opacity: 1; }

.repas-pied { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 8px; border-top: 1px solid var(--separateur); font-size: 13px; }

.menu-deroulant { position: relative; }
.menu-contextuel--ancre { position: absolute; top: calc(100% + 4px); right: 0; z-index: 10; }
.menu-contextuel--ancre .menu-compte { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--efface); }

/* --- Les graphiques ------------------------------------------------------------------- */

.graphique { display: block; width: 100%; height: auto; margin-top: 4px; overflow: visible; }
.barre { fill: var(--accent); opacity: .85; }
.barre--bien { fill: var(--succes); }
.barre--depasse { fill: var(--avertir); }
.barre-vide { fill: var(--bordure); }
.ligne-repere { stroke: var(--texte-doux); stroke-width: 1; stroke-dasharray: 4 4; }
.texte-repere, .texte-axe { fill: var(--efface); font-size: 12px; font-variant-numeric: tabular-nums; }
.courbe { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.point { fill: var(--fond); stroke: var(--accent); stroke-width: 2; }

.segments { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: calc(var(--rayon) + 3px); background: var(--surface); align-self: flex-start; }
.segments--petits { margin-bottom: 8px; background: none; padding: 0; }

.segment {
	padding: 5px 12px;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	color: var(--discret);
	font-size: 13px;
	cursor: pointer;
}
.segment:hover { color: var(--texte); }
.segment[aria-pressed="true"] { background: var(--fond); color: var(--accent); box-shadow: 0 1px 3px var(--ombre); }
.segments--petits .segment[aria-pressed="true"] { background: var(--accent-voile); box-shadow: none; }

.repartition { margin-top: 18px; }
.repartition h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--texte-doux); }
.repartition-barre { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-haute); }
.repartition-legende { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.repartition-legende li { display: flex; align-items: center; gap: 6px; }
.repartition-legende small { color: var(--efface); }
.repartition-pastille { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
span.repartition-proteines, .repartition-proteines .repartition-pastille { background: var(--accent); }
span.repartition-glucides, .repartition-glucides .repartition-pastille { background: var(--avertir); }
span.repartition-lipides, .repartition-lipides .repartition-pastille { background: var(--succes); }

/* --- Listes de lignes : pesées, aliments ------------------------------------------------- */

.liste-lignes { margin: 0; padding: 0; list-style: none; }

.ligne {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 6px 0;
	border-top: 1px solid var(--separateur);
	font-size: 14px;
}
.ligne:first-child { border-top: 0; }
.ligne-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-nom small { color: var(--efface); }
.ligne-valeur { color: var(--texte-doux); font-variant-numeric: tabular-nums; white-space: nowrap; }

.repas-type-elements { margin: 0; font-size: 13px; color: var(--texte-doux); }

/* --- Le profil ---------------------------------------------------------------------- */

.grille-profil { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grille-profil .champ { margin-bottom: 12px; }
.champ-lecture { margin: 0; padding: 9px 0; color: var(--texte-doux); }

.champ-unite, .champ > .champ-unite { display: flex; align-items: center; gap: 6px; margin-bottom: 0; }
.champ-unite > span { color: var(--discret); font-size: 13px; }
.champ .champ-unite input { flex: 1; min-width: 0; }

.reperes { display: flex; flex-direction: column; }

.repere {
	display: grid;
	grid-template-columns: 1fr auto 90px 34px 84px;
	align-items: center;
	gap: 8px;
	padding: 5px 0;
	border-top: 1px solid var(--separateur);
	font-size: 14px;
}
.repere:first-child { border-top: 0; }
.repere-sens, .repere-unite, .repere-origine { font-size: 12px; color: var(--efface); }
.repere-valeur { width: 100%; padding: 5px 8px; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--fond); text-align: right; }

/* --- Le panneau d'ajout ----------------------------------------------------------------- */

.recherche--panneau { max-width: none; }
.recherche--panneau input { padding-right: 12px; }

.ajouter-gestes { display: flex; gap: 8px; margin: 10px 0 6px; }
.ajouter-gestes .bouton { flex: 1; }

.choix-aliments { margin: 0; padding: 0; list-style: none; }
.choix-titre { padding: 8px 6px 4px; font-size: 12px; font-weight: 600; color: var(--efface); }
.choix-vide { padding: 10px 6px; color: var(--discret); font-size: 14px; }
.choix-titre--off { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--separateur); }

.choix-bouton {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px 6px;
	border: 0;
	border-radius: var(--rayon);
	background: none;
	text-align: left;
	cursor: pointer;
}
.choix-bouton:hover, .choix-bouton:focus-visible { background: var(--survol); }
.choix-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.choix-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choix-detail { font-size: 12px; color: var(--efface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choix-energie { font-size: 13px; color: var(--discret); font-variant-numeric: tabular-nums; white-space: nowrap; }

.scanner { display: flex; flex-direction: column; gap: 10px; }
.scanner video { width: 100%; max-height: 50vh; border-radius: var(--rayon); background: #000; object-fit: cover; }

.nutriments-saisie { margin: 0; padding: 0; border: 0; }
.nutriments-saisie legend { margin-bottom: 8px; font-size: 13px; color: var(--texte-doux); }
.grille-nutriments { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.champ--nutriment { margin-bottom: 10px; }

.aliment-choisi { display: flex; flex-direction: column; gap: 2px; }
.aliment-choisi strong { font-size: 16px; }
.aliment-detail { font-size: 13px; color: var(--discret); }

.champ--quantite .champ-unite { justify-content: flex-start; }
.segments--unite {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	align-self: stretch;
	margin: 2px 0 -2px;
}
.segments--unite .segment { padding: 7px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.segments--unite .court { display: none; }

/* Trop étroit pour « Millilitres » en entier : les formes courtes. */
@media (max-width: 400px) {
	.segments--unite .long { display: none; }
	.segments--unite .court { display: inline; }
}
.champ-equivalent { margin-left: 4px; color: var(--efface); font-size: 13px; }
.champ--quantite .champ-unite input { flex: none; width: 140px; font-size: 18px; }

/* Le geste qui compte : large, franc, et il répond. */
.ajouter-valider { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6px; }

.bouton--ajouter {
	min-height: 54px;
	padding: 14px 18px;
	border-radius: 12px;
	font-size: 17px;
	letter-spacing: .01em;
	box-shadow: 0 4px 14px var(--accent-halo);
	transition: transform .08s ease, box-shadow .15s ease, background-color .2s ease;
}
.bouton--ajouter:active { transform: scale(.97); box-shadow: 0 1px 4px var(--accent-halo); }
.bouton--ajouter:disabled { cursor: progress; filter: saturate(.7); }
.bouton--reussi { background: var(--succes); box-shadow: 0 4px 14px rgba(15, 122, 82, .35); }

@media (prefers-reduced-motion: reduce) {
	.bouton--ajouter { transition: none; }
	.bouton--ajouter:active { transform: none; }
}

.apports { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.apport { padding: 6px 8px; border-radius: var(--rayon); background: var(--surface); }
.apport dt { font-size: 11px; color: var(--efface); }
.apport dd { margin: 0; font-variant-numeric: tabular-nums; }

/* --- Le repas type et l'aliment ---------------------------------------------------------- */

.formulaire-ligne--emoji { grid-template-columns: 1fr 90px; }
.formulaire-ligne--deux { grid-template-columns: 1fr 1fr; }
.formulaire-ligne--pesee { grid-template-columns: 1fr 1fr auto; align-items: end; }
.formulaire-ligne--pesee .bouton { grid-column: auto; margin-bottom: 14px; }

.elements { margin: 0; padding: 0; list-style: none; }

.element {
	display: grid;
	grid-template-columns: 1fr 80px auto auto;
	align-items: center;
	gap: 6px;
	padding: 4px 0;
	border-top: 1px solid var(--separateur);
	font-size: 14px;
}
.element:first-child { border-top: 0; }
.element-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.element-quantite { width: 100%; padding: 4px 6px; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--fond); text-align: right; }
.element-unite { color: var(--efface); font-size: 13px; }

/* --- La lecture de Mistral ------------------------------------------------------------------- */

.panneau-tete h2 { display: flex; align-items: center; gap: 8px; }
.texte-analyse { font-size: 15px; line-height: 1.6; }
.texte-analyse p { margin: 0 0 .8em; }
.texte-analyse ul { margin: 0 0 .8em; padding-left: 1.2em; }
.texte-analyse li { margin-bottom: .3em; }

/* --- Sous 900 px : la latérale devient un tiroir --------------------------------------- */

@media (max-width: 900px) {
	.laterale {
		position: fixed;
		inset: 0 auto 0 0;
		z-index: 20;
		transform: translateX(calc(-100% - 40px));
		transition: transform .18s ease;
		box-shadow: 0 0 30px var(--ombre);
		border-right: 0;
	}

	body.tiroir-ouvert .laterale { transform: none; }
	.burger { display: grid; }
}

/* --- Sous 760 px : le téléphone ------------------------------------------------------ */

@media (max-width: 760px) {
	.panneau { width: 100%; }
	.vue { padding: 12px 10px 80px; }
	.bloc { padding: 14px 12px; }
	.jauges-grille { grid-template-columns: 1fr; }
	.entree { grid-template-columns: 1fr auto auto; }
	.entree-energie { display: none; }
	.grille-profil, .formulaire-ligne--pesee { grid-template-columns: 1fr; }
	.repere { grid-template-columns: 1fr 80px 30px auto; }
	.repere-sens { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.laterale { transition: none; }
}

/* --- Le rappel du soir (réglages) ----------------------------------------------- */

.formulaire-ligne--rappel { grid-template-columns: auto 130px auto; align-items: center; gap: 0 12px; }
.formulaire-ligne--rappel .champ, .formulaire-ligne--rappel .bouton { margin-bottom: 0; }
.formulaire-ligne--rappel .bouton { grid-column: auto; width: auto; }
.carte-push { margin-top: 14px; padding: 12px 14px; border-radius: var(--rayon); background: var(--fond); border: 1px solid var(--separateur); }
.carte-push .accroche { margin-bottom: 8px; }
.push-boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.push-boutons .bouton { width: auto; }
