/*
 * PICMAN : gabarit de l'application (docs/UI.md § 5 et § 9), templates/picman/shell.xhtml.
 *
 * Trois formes d'un même gabarit :
 * - ordinateur ≥ 1280 px : barre latérale bleu nuit de 248 px, réductible en rail de 72 px
 *   (cookie picman.side → data-side="rail" sur html) ;
 * - tablette 768 à 1279 px : rail d'icônes, la barre se déplie par-dessus le contenu ;
 * - téléphone < 768 px : barre supérieure et barre d'onglets, la barre latérale devient un
 *   tiroir ouvert par « Plus » ou par l'avatar.
 * html.side-open (picman-shell.js) marque la barre dépliée par-dessus le contenu.
 *
 * Couches : contenu < barres de l'application (--z-shell) < surcouches PrimeFaces (1000 et +,
 * attribuées par PrimeFaces.nextZindex) : un dialogue ou un calendrier passe toujours devant.
 */

/* ---------- Socle de page ---------- */

body {
	overscroll-behavior-x: none;
	overflow-x: clip;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
	html,
	body {
		overscroll-behavior: contain;
	}
}

.icon-sprite {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

:root {
	--side-offset: var(--side-w);
}

@media screen and (min-width: 1280px) {
	:root[data-side="rail"] {
		--side-offset: var(--rail-w);
	}
}

@media screen and (min-width: 768px) and (max-width: 1279.98px) {
	:root {
		--side-offset: var(--rail-w);
	}
}

@media screen and (max-width: 767.98px) {
	:root {
		--side-offset: 0px;
	}
}

.shell {
	min-height: 100vh;
	min-height: 100dvh;
}

.shell__main {
	margin-left: var(--side-offset);
	min-width: 0;
}

#page {
	max-width: 100%;
	overflow-x: clip;
}

#content {
	padding: 1.75rem 2rem 2.5rem;
}

main#content:focus {
	outline: none;
}

@media screen and (max-width: 1279.98px) {
	#content {
		padding: 1.25rem 1.5rem 2rem;
	}
}

@media screen and (max-width: 767.98px) {
	#content {
		padding: 1rem max(16px, env(safe-area-inset-right, 0px)) calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 1.5rem) max(16px, env(safe-area-inset-left, 0px));
	}
}

/* ---------- En-tête de page ---------- */

.pagehead {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem 1.5rem;
	margin-bottom: 1.25rem;
}

.pagehead__titles {
	margin-right: auto;
	min-width: 0;
}

.pagehead__group {
	margin: 0;
	font-size: 0.78125rem;
	font-weight: 550;
	color: var(--muted);
}

.pagehead .page-title {
	margin: 0.125rem 0 0;
	font-size: 1.625rem;
	font-weight: 740;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--ink);
	text-wrap: balance;
}

.pagehead__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.pagehead__actions:empty {
	display: none;
}

/* Sur téléphone, le titre est porté par la barre supérieure : le h1 reste pour les lecteurs d'écran */
@media screen and (max-width: 767.98px) {
	.pagehead {
		margin-bottom: 0;
	}

	/* L'espace sous l'en-tête vient de ses actions affichées : celles que la barre supérieure
	   reprend (display: none) n'en laissent aucun */
	.pagehead__actions > * {
		margin-bottom: 1rem;
	}

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

/* Écran bas (téléphone en paysage, 390 px de haut) : en-tête de page resserré, le contenu commence
   plus haut */
@media screen and (min-width: 768px) and (max-height: 500px) {
	#content {
		padding-top: 1rem;
	}

	.pagehead {
		align-items: center;
		margin-bottom: 0.75rem;
	}

	.pagehead .page-title {
		font-size: 1.25rem;
	}
}

/* ---------- Barre latérale ---------- */

.side {
	position: fixed;
	inset-block: 0;
	left: 0;
	z-index: var(--z-shell);
	display: flex;
	flex-direction: column;
	width: var(--side-w);
	padding: calc(1rem + env(safe-area-inset-top, 0px)) 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
	background: var(--side-bg);
	color: var(--side-ink);
	overflow: hidden;
}

.side :focus-visible {
	outline: 2px solid var(--side-focus);
	outline-offset: -2px;
	box-shadow: none;
}

.side__head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0 0.125rem 0.75rem 0.375rem;
}

.side__brand {
	display: flex;
	align-items: center;
	gap: 0.6875rem;
	min-width: 0;
	margin-right: auto;
	border-radius: var(--radius-sm);
	color: var(--side-active-ink);
	text-decoration: none;
}

.side__brand:hover {
	color: var(--side-active-ink);
	text-decoration: none;
}

.side__tile {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 22%;
	box-shadow: 0 0 0 1px var(--tile-ring);
}

.side__word {
	font-size: 1rem;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

/* En casse normale : en capitales de 12 px, « CVVM · MONTPELLIER » passerait sous le bouton qui
   replie la barre */
.side__word small {
	display: block;
	margin-top: 0.1875rem;
	font-size: 0.75rem;
	font-weight: 550;
	letter-spacing: 0.02em;
	color: var(--side-head);
}

.side__toggle {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--side-head);
	cursor: pointer;
}

.side__toggle:hover {
	background: var(--side-hover);
	color: var(--side-active-ink);
}

.side__toggle-close,
.side-open .side__toggle-rail {
	display: none;
}

.side-open .side__toggle-close {
	display: block;
}

/* Seule la navigation défile : le pied (identité, thème, déconnexion) reste en vue
   dans toutes les formes de la barre, même sur un écran bas */
.side__nav {
	display: grid;
	flex: 1 1 auto;
	gap: 0.25rem;
	align-content: start;
	min-height: 0;
	margin-inline: -0.25rem;
	padding-inline: 0.25rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--side-switch) transparent;
}

.nav-group {
	display: grid;
	gap: 0.125rem;
	padding-bottom: 0.5rem;
}

.nav-group__title {
	margin: 0;
	padding: 0.625rem 0.625rem 0.375rem;
	font-size: 0.75rem;
	font-weight: 650;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--side-head);
}

.nav-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: max(38px, var(--control-h));
	padding: 0 0.625rem;
	border-radius: var(--radius-sm);
	color: var(--side-ink);
	font-weight: 520;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
	background: var(--side-hover);
	color: var(--side-active-ink);
	text-decoration: none;
}

.nav-item[aria-current="page"] {
	background: var(--side-active-bg);
	color: var(--side-active-ink);
	font-weight: 620;
}

.nav-item__label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nav-item__ext {
	margin-left: auto;
	width: 14px;
	height: 14px;
	opacity: 0.6;
}

/* Infobulle du rail : le libellé, au survol ou au focus clavier. Fixe, au bord du rail et à la
   hauteur de l'entrée (--tip-y, posé par picman-shell.js), elle n'est pas coupée par la navigation
   qui défile */
:is(.nav-item, .side__logout, .side__switch)::after {
	content: attr(data-label);
	position: fixed;
	left: calc(var(--rail-w) + 0.375rem);
	top: var(--tip-y, 50%);
	z-index: 1;
	display: none;
	padding: 0.3125rem 0.5625rem;
	border-radius: var(--radius-xs);
	background: var(--tooltip-bg);
	color: var(--tooltip-ink);
	font-size: 0.78125rem;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: var(--shadow-2);
	transform: translateY(-50%);
	pointer-events: none;
}

/* Pied : identité, rôles du jour, thème, déconnexion */
.side__foot {
	display: grid;
	flex: none;
	gap: 0.625rem;
	margin-top: auto;
	padding-top: 0.75rem;
	border-top: 1px solid var(--side-line);
}

.who {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	min-width: 0;
	padding: 0 0.375rem;
}

.avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--avatar-a), var(--avatar-b));
	color: var(--avatar-ink);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.side .avatar {
	box-shadow: 0 0 0 2px var(--tile-ring);
}

/* Dans l'espace administratif, l'avatar porte le bouclier du profil en vigueur */
.avatar {
	position: relative;
}

.avatar__badge {
	position: absolute;
	right: -5px;
	bottom: -5px;
	display: grid;
	place-items: center;
	width: 19px;
	height: 19px;
	border-radius: 50%;
	background: var(--side-ok);
	box-shadow: 0 0 0 2px var(--side-bg);
	color: var(--side-bg);
}

.avatar .avatar__badge .icon {
	width: 12px;
	height: 12px;
	stroke-width: 2.4;
}

.avatar .icon {
	width: 18px;
	height: 18px;
}

.who__text {
	display: grid;
	min-width: 0;
	line-height: 1.35;
}

/* Un nom long (« PIZZOLANTE PIRES Mario Raul ») passe sur deux lignes plutôt que d'être tronqué */
.who__name {
	color: var(--side-active-ink);
	font-size: 0.84375rem;
	font-weight: 650;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.who__meta {
	color: var(--side-head);
	font-size: 0.75rem;
}

.who__status {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.75rem;
	font-weight: 600;
}

.who__status::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
}

.who__status--ok {
	color: var(--side-ok);
}

.who__status--warn {
	color: var(--side-warn);
}

.who__status--office {
	color: var(--side-focus);
}

/* Bascule entre l'espace membre et l'espace administratif : un bouton sous l'identité, toujours en vue */
.side__switch {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.625rem;
	min-height: 48px;
	padding: 0.4375rem 0.5rem 0.4375rem 0.625rem;
	border: 1px solid var(--side-line);
	border-radius: var(--radius-sm);
	background: var(--side-hover);
	color: var(--side-active-ink);
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.side__switch:hover {
	background: var(--side-active-bg);
	color: var(--side-active-ink);
	text-decoration: none;
}

.side__switch:focus-visible {
	outline: 2px solid var(--side-focus);
	outline-offset: -2px;
	box-shadow: none;
}

.side__switch .icon {
	width: 18px;
	height: 18px;
}

.side__switch-text {
	display: grid;
	min-width: 0;
	margin-right: auto;
	line-height: 1.3;
}

.side__switch-title {
	font-size: 0.8125rem;
	font-weight: 650;
}

.side__switch-sub {
	color: var(--side-head);
	font-size: 0.75rem;
	overflow-wrap: anywhere;
}

.side__switch .side__switch-go {
	width: 16px;
	height: 16px;
	color: var(--side-head);
}

@media screen and (max-width: 767.98px) {
	.side__switch {
		min-height: 52px;
	}
}

.who__today {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.5rem 0.625rem;
	border-radius: var(--radius-sm);
	background: var(--side-hover);
	color: var(--side-ink);
	font-size: 0.75rem;
	line-height: 1.4;
}

.who__today .icon {
	width: 16px;
	height: 16px;
	color: var(--side-ok);
}

.who__today-label {
	font-weight: 650;
	color: var(--side-active-ink);
}

.side__tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem;
}

.theme-switch {
	display: inline-flex;
	padding: 2px;
	border: 1px solid var(--side-line);
	border-radius: 999px;
}

.theme-switch button {
	display: grid;
	place-items: center;
	width: 30px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--side-head);
	cursor: pointer;
}

/* Le nom de chaque thème : lu par les lecteurs d'écran partout, écrit dans le tiroir du téléphone */
.theme-switch__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media screen and (max-width: 767.98px) {
	.theme-switch {
		flex: 1 1 100%;
	}

	.side .theme-switch button {
		display: inline-flex;
		flex: 1 1 0;
		align-items: center;
		justify-content: center;
		gap: 0.375rem;
		width: auto;
	}

	.theme-switch__label {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip-path: none;
		font-size: 0.8125rem;
		font-weight: 600;
	}
}

.theme-switch button:hover {
	color: var(--side-active-ink);
}

.theme-switch button[aria-pressed="true"] {
	background: var(--side-active-bg);
	color: var(--side-active-ink);
}

.theme-switch .icon {
	width: 16px;
	height: 16px;
}

.side__logout {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 32px;
	border-radius: var(--radius-sm);
	color: var(--side-ink);
	font-size: 0.8125rem;
	font-weight: 550;
	text-decoration: none;
}

.side__logout {
	position: relative;
	margin-left: auto;
	padding: 0.25rem 0.375rem;
}

.side__logout:hover {
	background: var(--side-hover);
	color: var(--side-active-ink);
	text-decoration: none;
}

.side__logout .icon {
	width: 18px;
	height: 18px;
}

@media screen and (pointer: coarse) {
	.theme-switch button {
		width: 44px;
		height: 44px;
	}

	.side__logout {
		min-height: 44px;
	}

	.side__toggle,
	.side__brand {
		min-width: 44px;
		min-height: 44px;
	}

	/* Avec le bouton de 44 px, « CVVM · MONTPELLIER » tient à côté sans passer dessous */
	.side__head {
		gap: 0.25rem;
		padding-inline: 0;
	}

	.side__brand {
		gap: 0.5rem;
	}
}

/* ---------- Rail d'icônes (tablette, ou choix « réduire » sur ordinateur) ---------- */

@media screen and (min-width: 768px) and (max-width: 1279.98px) {
	:root:not(.side-open) .side {
		width: var(--rail-w);
		padding-inline: 0.625rem;
	}

	:root:not(.side-open) .side__head {
		flex-direction: column;
		padding: 0 0 0.75rem;
	}

	:root:not(.side-open) .side__brand {
		margin-right: 0;
	}

	:root:not(.side-open) :is(.side__word, .nav-group__title, .nav-item__ext, .who__text, .who__today, .theme-switch, .side__switch-text, .side__switch-go) {
		display: none;
	}

	:root:not(.side-open) :is(.nav-item__label, .side__logout-label) {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	:root:not(.side-open) .nav-group + .nav-group {
		padding-top: 0.5rem;
		border-top: 1px solid var(--side-line);
	}

	:root:not(.side-open) :is(.nav-item, .side__logout, .side__switch) {
		justify-content: center;
		width: 100%;
		margin: 0;
		padding: 0;
	}

	:root:not(.side-open) :is(.nav-item, .side__logout, .side__switch):is(:hover, :focus-visible)::after {
		display: block;
	}

	:root:not(.side-open) .who {
		justify-content: center;
		padding: 0;
	}

	:root:not(.side-open) .side__tools {
		justify-content: center;
		padding: 0;
	}
}

@media screen and (min-width: 1280px) {
	:root[data-side="rail"]:not(.side-open) .side {
		width: var(--rail-w);
		padding-inline: 0.625rem;
	}

	:root[data-side="rail"]:not(.side-open) .side__head {
		flex-direction: column;
		padding: 0 0 0.75rem;
	}

	:root[data-side="rail"]:not(.side-open) .side__brand {
		margin-right: 0;
	}

	:root[data-side="rail"]:not(.side-open) :is(.side__word, .nav-group__title, .nav-item__ext, .who__text, .who__today, .theme-switch, .side__switch-text, .side__switch-go) {
		display: none;
	}

	:root[data-side="rail"]:not(.side-open) :is(.nav-item__label, .side__logout-label) {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	:root[data-side="rail"]:not(.side-open) .nav-group + .nav-group {
		padding-top: 0.5rem;
		border-top: 1px solid var(--side-line);
	}

	:root[data-side="rail"]:not(.side-open) :is(.nav-item, .side__logout, .side__switch) {
		justify-content: center;
		width: 100%;
		margin: 0;
		padding: 0;
	}

	:root[data-side="rail"]:not(.side-open) :is(.nav-item, .side__logout, .side__switch):is(:hover, :focus-visible)::after {
		display: block;
	}

	:root[data-side="rail"]:not(.side-open) .who {
		justify-content: center;
		padding: 0;
	}

	:root[data-side="rail"]:not(.side-open) .side__tools {
		justify-content: center;
		padding: 0;
	}
}



/* ---------- Barre dépliée par-dessus le contenu (tablette, rail, téléphone) ---------- */

.side-scrim {
	display: none;
}

.side-open .side-scrim {
	position: fixed;
	inset: 0;
	z-index: calc(var(--z-shell) + 1);
	display: block;
	background: var(--mask);
}

.side-open .side {
	z-index: calc(var(--z-shell) + 2);
	box-shadow: var(--shadow-float);
}

@media screen and (min-width: 1280px) {
	:root:not([data-side="rail"]).side-open .side {
		box-shadow: none;
	}

	:root:not([data-side="rail"]).side-open .side-scrim {
		display: none;
	}
}

@media screen and (max-width: 767.98px) {
	.side {
		width: min(320px, 86vw);
		padding-left: max(1rem, env(safe-area-inset-left, 0px));
		visibility: hidden;
		transform: translateX(-100%);
		transition: transform 0.25s ease, visibility 0s linear 0.25s;
	}

	.side-open .side {
		visibility: visible;
		transform: none;
		transition: transform 0.25s ease;
	}

	html.side-open {
		overflow: hidden;
	}
}

/* ---------- Barre supérieure et barre d'onglets (téléphone) ---------- */

.topbar,
.tabbar {
	display: none;
}

@media screen and (max-width: 767.98px) {
	.topbar {
		position: sticky;
		top: 0;
		z-index: var(--z-shell);
		display: flex;
		align-items: center;
		gap: 0.75rem;
		height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
		padding: env(safe-area-inset-top, 0px) max(0.5rem, env(safe-area-inset-right, 0px)) 0 max(0.625rem, env(safe-area-inset-left, 0px));
		background: var(--bar-bg);
		border-bottom: 1px solid var(--line);
	}

	.topbar__brand {
		display: grid;
		flex: none;
		place-items: center;
		width: 2.75rem;
		height: 2.75rem;
		border-radius: var(--radius-sm);
	}

	.topbar__brand img {
		width: 32px;
		height: 32px;
		border-radius: 22%;
	}

	/* Petit téléphone : la marque cède sa place au titre de la page, que deux actions et le compte
	   tronquaient (« Carnet … ») ; l'Accueil reste dans la barre d'onglets */
	@media (max-width: 359.98px) {
		.topbar__brand {
			display: none;
		}
	}

	.topbar__title {
		flex: 1;
		min-width: 0;
		overflow: hidden;
		color: var(--ink);
		font-size: 1.0625rem;
		font-weight: 720;
		letter-spacing: -0.01em;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.topbar__actions {
		display: flex;
		align-items: center;
		gap: 0.25rem;
	}

	.topbar__actions:empty {
		display: none;
	}

	.topbar__actions > form {
		display: flex;
		align-items: center;
		gap: 0.25rem;
	}

	/* Action de la page au téléphone : pleine pour l'action principale, discrète pour un export */
	.topbar__action {
		display: grid;
		place-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		border-radius: var(--radius-sm);
		background: var(--fill-primary);
		color: var(--on-accent);
		cursor: pointer;
	}

	.topbar__action--quiet {
		background: transparent;
		color: var(--slate);
	}

	/* Une action en lien PrimeFaces (p:commandLink) garde la couleur de la barre, pas celle des liens */
	.topbar .topbar__action.ui-commandlink {
		color: var(--on-accent);
	}

	.topbar .topbar__action--quiet.ui-commandlink {
		color: var(--slate);
	}

	.topbar__action:focus-visible {
		outline: none;
		box-shadow: var(--focus-ring);
	}

	.topbar__action .icon {
		width: 22px;
		height: 22px;
	}

	.topbar__account {
		display: grid;
		place-items: center;
		flex: none;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: transparent;
		cursor: pointer;
	}

	.topbar__account .avatar {
		width: 34px;
		height: 34px;
		font-size: 0.75rem;
	}

	.tabbar {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: var(--z-shell);
		display: grid;
		grid-auto-columns: 1fr;
		grid-auto-flow: column;
		height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
		padding: 0.25rem max(0.25rem, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(0.25rem, env(safe-area-inset-left, 0px));
		background: var(--bar-bg);
		border-top: 1px solid var(--line);
	}

	.tabbar__item {
		display: grid;
		align-content: center;
		justify-items: center;
		gap: 0.125rem;
		min-width: 0;
		min-height: 44px;
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--muted);
		font: inherit;
		font-size: 0.75rem;
		font-weight: 600;
		line-height: 1.2;
		text-decoration: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.tabbar__item:hover {
		color: var(--ink);
		text-decoration: none;
	}

	.tabbar__label {
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* 320 px : cinq onglets de 64 px, « Facturation » tient entier en 12 px, resserré */
	@media (max-width: 339.98px) {
		.tabbar {
			padding-inline: max(0px, env(safe-area-inset-left, 0px)) max(0px, env(safe-area-inset-right, 0px));
		}

		.tabbar__item {
			letter-spacing: -0.02em;
		}
	}

	.tabbar__pill {
		display: grid;
		place-items: center;
		width: 56px;
		height: 30px;
		border-radius: 999px;
		transition: background-color 0.2s ease;
	}

	.tabbar__pill .icon {
		width: 22px;
		height: 22px;
	}

	.tabbar__item[aria-current="page"],
	.tabbar__item--current,
	.tabbar__item[aria-expanded="true"] {
		color: var(--blue);
	}

	.tabbar__item[aria-current="page"] .tabbar__pill,
	.tabbar__item--current .tabbar__pill,
	.tabbar__item[aria-expanded="true"] .tabbar__pill {
		background: var(--blue-soft);
	}
}

/* ---------- Bandeaux : espace d'un membre ouvert depuis l'espace administratif, réseau perdu ou revenu ---------- */

.shell-band {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0.5rem max(1rem, env(safe-area-inset-right, 0px)) 0.5rem max(1rem, env(safe-area-inset-left, 0px));
	border-bottom: 1px solid var(--line);
	background: var(--amber-soft);
	color: var(--amber-ink);
	font-size: 0.84375rem;
	font-weight: 600;
}

.shell-band[hidden] {
	display: none;
}

.shell-band .icon {
	width: 1rem;
	height: 1rem;
}

/* L'espace d'un membre ouvert depuis l'espace administratif : qui regarde quoi, et le retour à l'espace administratif */
.shell-band--space {
	flex-wrap: wrap;
	row-gap: 0.375rem;
}

.shell-band__text {
	flex: 1 1 14rem;
	min-width: 0;
}

.shell-band__action {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 30px;
	padding: 0 0.625rem;
	border: 1px solid currentColor;
	border-radius: var(--radius-sm);
	color: inherit;
	font-size: 0.8125rem;
	font-weight: 650;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.shell-band__action:hover {
	background: var(--paper);
	color: inherit;
	text-decoration: none;
}

@media screen and (pointer: coarse) {
	.shell-band__action {
		min-height: 44px;
	}
}

.shell-band--online {
	background: var(--green-soft);
	color: var(--green-deep);
}

.shell-band__on,
.shell-band--online .shell-band__off {
	display: none;
}

.shell-band--online .shell-band__on {
	display: inline;
}

/* ---------- Activité réseau et préparation d'un export ---------- */

.app-progress {
	position: fixed;
	top: env(safe-area-inset-top, 0px);
	right: 0;
	left: 0;
	z-index: calc(var(--z-shell) + 5);
	height: 3px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.app-progress::before {
	content: "";
	position: absolute;
	inset-block: 0;
	left: 0;
	width: 40%;
	background: var(--fill-primary);
	animation: app-progress-slide 1.1s ease-in-out infinite;
}

.is-busy .app-progress {
	opacity: 1;
}

@keyframes app-progress-slide {
	from {
		transform: translateX(-100%);
	}
	to {
		transform: translateX(250%);
	}
}

.dl-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--z-shell) + 10);
	display: none;
	place-items: center;
	padding: 1rem;
	background: var(--mask);
}

.dl-overlay.active {
	display: grid;
}

.dl-overlay__card {
	display: grid;
	justify-items: center;
	gap: 0.25rem;
	max-width: 22.5rem;
	padding: 1.5rem 1.75rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--paper);
	box-shadow: var(--shadow-float);
	text-align: center;
}

.dl-overlay__spinner {
	width: 32px;
	height: 32px;
	margin-bottom: 0.5rem;
	border: 3px solid var(--line);
	border-top-color: var(--blue);
	border-radius: 50%;
	animation: app-spin 0.8s linear infinite;
}

.dl-overlay__title {
	margin: 0;
	color: var(--ink);
	font-weight: 650;
}

.dl-overlay__hint {
	margin: 0;
	color: var(--muted);
	font-size: 0.8125rem;
}

@keyframes app-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.side,
	.side-open .side,
	.tabbar__pill {
		transition: none;
	}

	.app-progress::before {
		width: 100%;
		animation: none;
		opacity: 0.6;
	}

	.dl-overlay__spinner {
		animation-duration: 2.4s;
	}
}
