/**
 * MY HOME CLASS — enveloppe de l'application (en-tête, onglets, formulaires).
 * Autonome : ne dépend d'aucun thème.
 */

body.macfr-app {
	margin: 0;
	background: #f8f4ee;
	color: #16120f;
	font-family: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 16.5px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

body.macfr-app *,
body.macfr-app *::before,
body.macfr-app *::after {
	box-sizing: border-box;
}

body.macfr-app img {
	max-width: 100%;
	height: auto;
}

body.macfr-app a {
	color: #004aad;
	text-underline-offset: 3px;
}

body.macfr-app :focus-visible {
	outline: 3px solid #004aad;
	outline-offset: 2px;
}

.macfr-skip {
	position: absolute;
	left: -9999px;
}

.macfr-skip:focus {
	left: 8px;
	top: 8px;
	z-index: 100;
	padding: 10px 16px;
	border-radius: 8px;
	background: #16120f;
	color: #fff !important;
}

/* En-tête */
.macfr-app-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: #fff;
	border-bottom: 1px solid #e7e1d9;
	padding-top: env(safe-area-inset-top);
}

.macfr-app-bar {
	display: flex;
	align-items: center;
	gap: 22px;
	max-width: 1160px;
	min-height: 64px;
	margin: 0 auto;
	padding: 0 20px;
}

.macfr-app-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: #16120f !important;
	margin-right: auto;
}

.macfr-app-brand img {
	width: 40px;
	height: 40px;
	object-fit: contain;
	border-radius: 8px;
}

.macfr-app-brand span {
	font-family: "Oswald", "Arial Narrow", sans-serif;
	font-weight: 700;
	font-size: 1.2rem;
	line-height: 1;
	text-transform: uppercase;
}

.macfr-app-brand small {
	display: block;
	margin-top: 4px;
	font-size: 0.66rem;
	font-weight: 500;
	letter-spacing: 0.18em;
	color: #b04606;
}

.macfr-app-nav {
	display: flex;
	gap: 4px;
}

.macfr-app-nav a {
	padding: 8px 12px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.97rem;
	color: #6a635c !important;
	text-decoration: none;
	white-space: nowrap;
}

.macfr-app-nav a:hover {
	background: #f8f4ee;
	color: #16120f !important;
}

.macfr-app-nav a[aria-current="page"] {
	background: #16120f;
	color: #fff !important;
}

.macfr-app-tools {
	display: flex;
	align-items: center;
	gap: 10px;
}

.macfr-app-logout {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	border-radius: 10px;
	color: #6a635c !important;
	font-weight: 600;
	font-size: 0.92rem;
	text-decoration: none;
}

.macfr-app-logout:hover {
	background: #f8f4ee;
	color: #16120f !important;
}

/* Contenu */
.macfr-app-main {
	padding: 26px 0 64px;
}

.macfr-app-wrap {
	max-width: 1160px;
	margin: 0 auto;
	padding: 0 20px;
}

.macfr-app-wrap > .macfr,
.macfr-front {
	font-family: inherit;
}

.macfr-front h2,
.macfr-app .macfr h2 {
	margin-top: 6px;
}

.macfr-hello {
	font-size: clamp(2rem, 4vw, 2.6rem) !important;
	margin: 0 0 6px !important;
}

/* Formulaires de l'espace */
.macfr-grid-forms {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 16px;
	margin-bottom: 10px;
}

.macfr-card-form {
	padding: 22px;
	border-radius: 16px;
	background: #fff;
	border: 1px solid #e7e1d9;
	margin-bottom: 18px;
}

.macfr-card-form h3 {
	margin: 0 0 14px !important;
}

.macfr-field {
	display: block;
	margin: 0 0 14px;
	padding: 0;
	border: 0;
}

.macfr-field > span,
.macfr-field > legend {
	display: block;
	margin-bottom: 6px;
	font-weight: 700;
	font-size: 0.95rem;
	color: #16120f;
}

.macfr-field input[type="text"],
.macfr-field input[type="email"],
.macfr-field input[type="tel"],
.macfr-field input[type="password"],
.macfr-field input[type="number"],
.macfr-field input[type="date"],
.macfr-field input[type="datetime-local"],
.macfr-field select,
.macfr-field textarea {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	border: 1.5px solid #e7e1d9;
	border-radius: 12px;
	background: #fff;
	font: 500 1rem "Source Sans 3", -apple-system, "Segoe UI", sans-serif;
	color: #16120f;
	box-shadow: none;
}

.macfr-field input[type="file"] {
	display: block;
	width: 100%;
	padding: 14px;
	border: 1.5px dashed #c9c0b5;
	border-radius: 12px;
	background: #f8f4ee;
	font: inherit;
}

.macfr-field input:focus,
.macfr-field select:focus,
.macfr-field textarea:focus {
	border-color: #004aad;
	outline: none;
	box-shadow: 0 0 0 3px #e5eefa;
}

.macfr-field small {
	display: block;
	margin-top: 6px;
}

.macfr-field-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 12px;
}

.macfr-check {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 6px 0;
	font-weight: 600;
}

.macfr-check input {
	width: 18px;
	height: 18px;
	accent-color: #004aad;
}

.macfr-empty-state {
	padding: 18px 20px;
	border-radius: 14px;
	border: 1.5px dashed #e7e1d9;
	background: #fff;
	color: #6a635c;
	list-style: none;
}

/* À faire */
.macfr-todo {
	list-style: none;
	margin: 0 0 18px;
	padding: 0;
	display: grid;
	gap: 10px;
}

.macfr-todo li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-radius: 14px;
	background: #fbeadf;
	border-left: 5px solid #d5570a;
}

/* Agenda */
.macfr-agenda {
	list-style: none;
	margin: 0;
	padding: 0;
	border-radius: 16px;
	background: #fff;
	border: 1px solid #e7e1d9;
	overflow: hidden;
}

.macfr-agenda-day {
	padding: 10px 16px;
	background: #f8f4ee;
	font-family: "Oswald", "Arial Narrow", sans-serif;
	font-size: 0.82rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #6a635c;
	border-top: 1px solid #e7e1d9;
}

.macfr-agenda-day:first-child {
	border-top: 0;
}

.macfr-agenda-item a {
	display: grid;
	grid-template-columns: 58px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 13px 16px;
	border-top: 1px solid #f0ebe4;
	color: #16120f !important;
	text-decoration: none;
}

.macfr-agenda-item a:hover {
	background: #fbf9f6;
}

.macfr-agenda-item time {
	font-family: "Oswald", "Arial Narrow", sans-serif;
	font-weight: 500;
	font-size: 1.1rem;
}

.macfr-agenda-item em {
	font-style: normal;
	font-size: 0.82rem;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 999px;
	background: #e5eefa;
	color: #004aad;
}

.macfr-agenda-item.is-closed em {
	background: #ebf1e1;
	color: #365907;
}

.macfr-agenda-item.is-postponed em {
	background: #fbeadf;
	color: #b04606;
}

.macfr-agenda-item.is-closed span,
.macfr-agenda-item.is-closed time {
	color: #6a635c;
}

/* Élèves */
.macfr-student-card {
	padding: 20px 22px;
	margin-bottom: 14px;
	border-radius: 16px;
	background: #fff;
	border: 1px solid #e7e1d9;
	border-top: 5px solid #004aad;
}

.macfr-student-card header {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: baseline;
	margin-bottom: 8px;
}

.macfr-student-card header strong {
	font-family: "Oswald", "Arial Narrow", sans-serif;
	font-weight: 500;
	font-size: 1.35rem;
}

.macfr-student-name {
	margin: 8px 0 4px;
	font-weight: 700;
}

.macfr-student-meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 6px 14px;
	margin: 12px 0 0;
	font-size: 0.95rem;
}

.macfr-student-meta dt {
	color: #6a635c;
	font-weight: 600;
}

.macfr-student-meta dd {
	margin: 0;
}

/* Documents */
.macfr-doclist {
	list-style: none;
	margin: 0;
	padding: 0;
	border-radius: 16px;
	background: #fff;
	border: 1px solid #e7e1d9;
}

.macfr-doclist > li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border-top: 1px solid #f0ebe4;
}

.macfr-doclist > li:first-child {
	border-top: 0;
}

.macfr-doclist > li div {
	display: grid;
	gap: 2px;
}

.macfr-doclist form {
	margin: 0;
}

.macfr-doclist .macfr-empty-state {
	border: 0;
}

/* Bulletins */
.macfr-payout {
	margin-bottom: 10px;
	border-radius: 14px;
	background: #fff;
	border: 1px solid #e7e1d9;
}

.macfr-payout summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	cursor: pointer;
}

.macfr-payout summary strong {
	margin-left: auto;
	font-family: "Oswald", "Arial Narrow", sans-serif;
	font-size: 1.2rem;
}

.macfr-payout .macfr-table {
	margin: 0;
}

/* Bouton « Installer l'application » */
.macfr-install {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: 1.5px solid #004aad;
	border-radius: 999px;
	background: #fff;
	color: #004aad;
	font: 700 0.88rem "Source Sans 3", -apple-system, sans-serif;
	cursor: pointer;
}

.macfr-install[hidden] {
	display: none;
}

.macfr-install svg {
	width: 18px;
	height: 18px;
}

/* Pastilles dans la navigation */
.macfr-nav-badge {
	display: inline-grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	margin-left: 5px;
	padding: 0 5px;
	border-radius: 999px;
	background: #d5570a;
	color: #fff;
	font-size: 0.7rem;
	font-weight: 800;
	line-height: 1;
}

.macfr-nav-badge[hidden] {
	display: none;
}

.macfr-tab-ico {
	position: relative;
	display: inline-flex;
}

.macfr-tab-ico .macfr-nav-badge {
	position: absolute;
	top: -6px;
	right: -12px;
	margin: 0;
	box-shadow: 0 0 0 2px #fff;
}

/* Activer les notifications sur ce téléphone */
.macfr-push-optin {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin: 0 0 18px;
	padding: 14px 18px;
	border-radius: 16px;
	background: #e5eefa;
}

.macfr-push-optin[hidden] {
	display: none;
}

.macfr-push-optin p {
	margin: 0;
}

/* Barre d'onglets (mobile) */
.macfr-tabbar {
	display: none;
}

@media (max-width: 900px) {
	.macfr-app-nav,
	.macfr-app-logout span,
	.macfr-install span {
		display: none;
	}

	.macfr-install {
		padding: 9px;
	}

	.macfr-app-bar {
		min-height: 58px;
		gap: 10px;
		padding: 0 14px;
	}

	.macfr-app-main {
		padding: 18px 0 calc(96px + env(safe-area-inset-bottom));
	}

	.macfr-app-wrap {
		padding: 0 14px;
	}

	.macfr-tabbar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 60;
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: 1fr;
		padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, 0.98);
		border-top: 1px solid #e7e1d9;
		box-shadow: 0 -6px 20px rgba(22, 18, 15, 0.06);
	}

	.macfr-tabbar a {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 3px;
		padding: 6px 2px;
		border-radius: 12px;
		color: #6a635c !important;
		text-decoration: none;
		font-size: 0.72rem;
		font-weight: 700;
		line-height: 1.1;
		text-align: center;
	}

	.macfr-tabbar a[aria-current="page"] {
		color: #d5570a !important;
		background: #fbeadf;
	}

	/* « Plus » : onglets au-delà du sixième */
	.macfr-tab-more {
		position: relative;
	}

	.macfr-tab-more > summary {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 3px;
		padding: 6px 2px;
		border-radius: 12px;
		color: #6a635c;
		font-size: 0.72rem;
		font-weight: 700;
		line-height: 1.1;
		text-align: center;
		list-style: none;
		cursor: pointer;
	}

	.macfr-tab-more > summary::-webkit-details-marker {
		display: none;
	}

	.macfr-tab-more > summary[aria-current="page"],
	.macfr-tab-more[open] > summary {
		color: #d5570a;
		background: #fbeadf;
	}

	.macfr-tab-menu {
		position: absolute;
		right: 0;
		bottom: calc(100% + 10px);
		min-width: 210px;
		padding: 6px;
		border-radius: 16px;
		background: #fff;
		border: 1px solid #e7e1d9;
		box-shadow: 0 -10px 30px rgba(22, 18, 15, 0.16);
	}

	.macfr-tabbar .macfr-tab-menu a {
		flex-direction: row;
		justify-content: flex-start;
		gap: 12px;
		padding: 12px 14px;
		font-size: 0.95rem;
		color: #16120f !important;
		text-align: left;
	}

	.macfr-doclist > li {
		flex-direction: column;
		align-items: flex-start;
	}

	.macfr-agenda-item a {
		grid-template-columns: 50px 1fr;
	}

	.macfr-agenda-item em {
		grid-column: 2;
		justify-self: start;
	}
}

@media print {
	.macfr-app-header,
	.macfr-tabbar {
		display: none !important;
	}
}

/* Les boutons-liens gardent leurs couleurs, quelle que soit la couleur générale des liens. */
body.macfr-app a.macfr-btn,
body.macfr-app a.macfr-btn:hover,
body.macfr-app a.macfr-btn:focus-visible {
	color: #fff;
	text-decoration: none;
}

body.macfr-app a.macfr-btn-ghost {
	color: #16120f;
}

body.macfr-app a.macfr-btn-ghost:hover {
	color: #fff;
}

/* Chiffres clés côte à côte, y compris sur téléphone. */
.macfr-app .macfr-stats {
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 640px) {
	.macfr-app .macfr-stats {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}

	.macfr-app .macfr-stat {
		padding: 12px 10px;
		border-radius: 12px;
	}

	.macfr-app .macfr-stat strong,
	.macfr-app .macfr-stat-main strong {
		font-size: 1.45rem;
	}

	.macfr-app .macfr-stat span {
		font-size: 0.78rem;
		line-height: 1.25;
	}

	.macfr-app .macfr-todo .macfr-btn,
	.macfr-app .macfr-session-actions .macfr-btn {
		width: 100%;
	}
}
