/* ── Carte ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card.padded { padding: 16px; }

/* ── Recherche repliable (icône → barre, avec animation) ── */
.search-icon-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.2); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s;
}
.search-icon-btn:active { background: rgba(255,255,255,.32); }
.search-icon-btn.open { background: #fff; color: var(--primary); }

.search-expand {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  margin-top: 0;
  transition: max-height .32s cubic-bezier(.4,0,.2,1), opacity .22s ease, transform .28s ease, margin-top .32s ease;
}
.search-expand.open {
  max-height: 60px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 12px;
}

/* ── Bouton d'icône unifié (flèches de date, fermeture, etc.) ── */
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-light); cursor: pointer;
}
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn.on-primary { background: rgba(255,255,255,.15); border-color: transparent; color: #fff; }
.icon-btn.on-primary:disabled { opacity: .35; }

/* ── Badge / pill ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge svg { width: 10px; height: 10px; }

/* ── KPI tile ── */
.kpi-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.kpi-tile {
  flex: 1;
  min-width: 45%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 15px;
  color: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-md);
}
.kpi-tile.full { flex-basis: 100%; width: 100%; }
.kpi-tile .kpi-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.kpi-tile .kpi-icon svg { width: 18px; height: 18px; }
.kpi-tile .kpi-value { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; margin-top: 2px; }
.kpi-tile .kpi-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: rgba(255,255,255,.85);
}
.kpi-tile .kpi-chevron { position: absolute; top: 14px; right: 12px; opacity: .7; }
.kpi-blue, .kpi-sky   { background: linear-gradient(135deg,#3D5CE0,#5D7BF2); }
.kpi-green, .kpi-teal { background: linear-gradient(135deg,#14B8A6,#0D9488); }
.kpi-amber  { background: linear-gradient(135deg,#FF6A45,#F59E0B); }
.kpi-red    { background: linear-gradient(135deg,#EF4444,#DC2626); }
.kpi-violet { background: linear-gradient(135deg,#3D5CE0,#8B5CF6); }

/* ── Bannière d'écran / topbar sticky ── */
.screen-header {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(135deg,var(--primary) 0%,#223C9E 100%);
  padding: 16px 18px 20px;
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(61,92,224,.45);
}
.screen-header.frdk { background: linear-gradient(135deg,var(--frdk) 0%,#f97316 100%); box-shadow: 0 8px 20px -10px rgba(234,88,12,.45); }
.screen-header .screen-title { font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1.2; }
.screen-header .screen-subtitle { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 3px; }

/* ── En-tête de section ── */
.section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; border-bottom: 1px solid var(--surface3);
}
.section-header .sh-icon {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-header .sh-icon svg { width: 15px; height: 15px; }
.section-header .sh-title { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
.section-header .sh-link { font-size: 12px; font-weight: 700; background: none; border: none; cursor: pointer; }

/* ── État vide ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 30px 16px; gap: 6px; text-align: center;
}
.empty-state svg { width: 32px; height: 32px; color: var(--border2); }
.empty-state .es-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.empty-state .es-hint { font-size: 12.5px; color: var(--text-light); }
.empty-state .es-action {
  margin-top: 10px; background: var(--surface3); color: var(--primary);
  border: none; border-radius: var(--radius-sm); padding: 8px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}

/* ── Formulaires ── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text-muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.09em;
}
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 14px; height: 46px; font-size: 14px; color: var(--text); background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(61,92,224,.12);
}
.field textarea { height: auto; padding: 10px 14px; min-height: 80px; resize: vertical; }
.field .input-with-icon { position: relative; }
.field .input-with-icon input { padding-right: 42px; }
.field .input-icon-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}

/* ── Boutons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius-sm); height: 50px; padding: 0 20px;
  font-size: 15px; font-weight: 700; cursor: pointer; width: 100%;
  transition: transform .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(61,92,224,.5); }
.btn-primary:disabled { opacity: .7; cursor: default; }
.btn-danger-outline { background: none; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-text-danger { background: none; border: none; color: var(--danger); font-weight: 700; font-size: 13px; cursor: pointer; }

/* Petit bouton d'action inline (écran Liaison Parent-Élève) */
.lp-mini-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 11px; font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer;
}
.lp-mini-btn.ok     { background: #22C55E14; border-color: #22C55E40; color: #15803D; }
.lp-mini-btn.danger { background: #EF444414; border-color: #EF444440; color: var(--danger); }
.lp-mini-btn:active { transform: scale(.97); }

/* Règlement intérieur (écran statique) */
.rg-wrap { padding-bottom: 28px; }
.rg-intro { border-left: 3px solid var(--primary); }
.rg-section-intro { margin: 8px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.rg-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.rg-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.rg-title { margin: 0; font-size: 13.5px; font-weight: 800; color: var(--text); line-height: 1.35; }
.rg-list { margin: 4px 0 0; padding-left: 20px; }
.rg-list > li { font-size: 12.5px; line-height: 1.55; color: var(--text-light); margin: 6px 0; }
.rg-list > li::marker { color: var(--primary); }
.rg-sub { margin: 5px 0 2px; padding-left: 16px; }
.rg-sub > li { font-size: 12px; line-height: 1.5; color: var(--text-light); margin: 3px 0; }
.rg-sub > li::marker { color: var(--text-muted); }

/* ── Puces / chips ── */
.chip-row { display: flex; gap: 8px; padding: 2px 0; }
.chip {
  padding: 9px 14px; border-radius: 20px; background: var(--surface);
  border: 1.5px solid var(--border); font-size: 12.5px; font-weight: 700;
  color: var(--text-light); white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 14px -6px rgba(61,92,224,.5); }

/* ── Spinner ── */
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(61,92,224,.18); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
.spinner.on-dark { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Boîte d'erreur / accès refusé ── */
.err-box {
  display: flex; align-items: center; gap: 8px;
  background: #fceeed; color: #b3352d; border-radius: var(--radius-sm); padding: 12px; margin: 12px 16px;
  font-size: 12.5px;
}
.err-box svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Écran de connexion (héro dégradé bleu, à la "onboarding" du kit) ── */
.login-screen {
  position: absolute; inset: 0; background: linear-gradient(165deg,#5D80F5 0%,#3D5CE0 45%,#1B2F7A 100%); color: #fff;
  display: flex; flex-direction: column; overflow: hidden;
}
.login-bg-photo {
  position: absolute; inset: 0;
  background-image: url('../assets/img/login-bg.jpg');
  background-size: cover; background-position: center 30%;
  animation: bgKenBurns 22s ease-in-out infinite alternate;
}
@keyframes bgKenBurns {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.14) translate(-1.5%, -1.5%); }
}
.login-bg-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(165deg, rgba(93,128,245,.92) 0%, rgba(61,92,224,.90) 45%, rgba(27,47,122,.95) 100%);
}
.login-orb1 {
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.16), rgba(255,255,255,0) 70%);
  top: -140px; left: -120px; filter: blur(6px);
  animation: orbFloat 9s ease-in-out infinite;
}
.login-orb2 {
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle at 60% 40%, rgba(255,106,69,.30), rgba(255,106,69,0) 70%);
  bottom: -110px; right: -90px; filter: blur(6px);
  animation: orbFloat 11s ease-in-out infinite -3s;
}
.login-orb3 {
  position: absolute; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.12), rgba(255,255,255,0) 70%);
  top: 30%; right: -50px; filter: blur(4px);
  animation: orbFloat 7s ease-in-out infinite -1.5s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.06); }
}
.login-step {
  flex: 1; overflow-y: auto; position: relative; z-index: 1;
  padding: 24px 22px calc(24px + var(--safe-bottom));
}

@keyframes loginFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logoPop {
  0% { opacity: 0; transform: scale(.55) rotate(-10deg); }
  65% { opacity: 1; transform: scale(1.08) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes glowPulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: .95; transform: scale(1.12); }
}

.login-header { display: flex; flex-direction: column; align-items: center; padding: 16px 0 24px; animation: loginFadeUp .5s ease both; }
.login-logo {
  position: relative;
  width: 76px; height: 76px; border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255,255,255,.24), rgba(255,255,255,.08));
  border: 1.5px solid rgba(255,255,255,.28);
  box-shadow: 0 12px 28px -10px rgba(10,20,60,.5), inset 0 1px 0 rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-family: var(--font-display); font-weight: 800; font-size: 25px; color: #fff;
  letter-spacing: .02em;
  animation: logoPop .6s cubic-bezier(.34,1.56,.64,1) both;
}
.login-logo img { width: 58px; height: auto; object-fit: contain; }
.login-logo::before {
  content: ''; position: absolute; inset: -10px; border-radius: calc(var(--radius-xl) + 10px);
  background: radial-gradient(circle, rgba(255,255,255,.35), rgba(255,255,255,0) 72%);
  z-index: -1; animation: glowPulse 2.6s ease-in-out infinite .6s;
}
.login-title { font-family: var(--font-display); font-weight: 800; font-size: 22px; text-align: center; letter-spacing: -.01em; }
.login-subtitle { font-size: 12.5px; color: rgba(255,255,255,.7); margin-top: 7px; text-align: center; }
.login-count {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px; padding: 4px 11px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.85);
  animation: loginFadeUp .45s .15s ease both;
}

.login-search {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,.09); border: 1.5px solid rgba(255,255,255,.14);
  border-radius: var(--radius-xl); padding: 0 15px; height: 50px; margin-bottom: 16px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  animation: loginFadeUp .5s .1s ease both;
}
.login-search:focus-within { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.13); box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
.login-search input {
  flex: 1; background: none; border: none; color: #fff; font-size: 14.5px; height: 48px; outline: none;
}
.login-search input::placeholder { color: rgba(255,255,255,.45); }
.login-search svg { color: rgba(255,255,255,.55); width: 16px; height: 16px; flex-shrink: 0; transition: color .2s; }
.login-search:focus-within svg { color: #fff; }

/* Variante claire — même structure, réutilisée comme barre de recherche sur fond
   blanc (écrans Élèves, Journal, ...) : le texte/l'icône blancs de la variante sombre
   seraient invisibles sur #fff. */
.login-search.light { background: #fff; border: 1px solid var(--border); }
.login-search.light input { color: var(--text); }
.login-search.light input::placeholder { color: var(--text-muted); }
.login-search.light svg { color: var(--text-light); }

.fil-card {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 9px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.fil-card:active { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.22); transform: scale(.99); }
/* La liste apparaît d'un bloc, une seule fois — pas d'animation par carte (illisible
   avec ~20 filiales et re-déclenchée à chaque frappe dans la recherche). */
#fil-list { animation: loginFadeUp .3s ease both; }
#fil-list.no-anim { animation: none; }
.fil-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255,255,255,.24), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff;
}
.fil-name { flex: 1; font-size: 14.5px; font-weight: 600; color: #fff; }
/* Cartes à 2 lignes (étape "type d'établissement") : libellé + compteur de filiales,
   au lieu du simple nom sur une ligne des cartes filiale. */
.fil-card-body { flex: 1; min-width: 0; }
.fil-card-body .fil-name { flex: none; }
.fil-meta { font-size: 11.5px; color: rgba(255,255,255,.55); margin-top: 2px; }

.login-back { display: flex; align-items: center; gap: 2px; background: none; border: none; color: rgba(255,255,255,.75); font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: 18px; animation: loginFadeUp .4s ease both; }
.fil-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,106,69,.2); border-radius: 20px; padding: 7px 12px; margin-bottom: 22px;
  font-size: 12.5px; font-weight: 700; color: #fff;
  animation: loginFadeUp .45s .05s ease both;
}

/* Onglets Connexion / Créer un compte (écran de login) */
.login-tabs {
  display: flex; gap: 6px; padding: 4px;
  background: rgba(255,255,255,.1); border-radius: 14px; margin-bottom: 6px;
  animation: loginFadeUp .45s .05s ease both;
}
.login-tabs button {
  flex: 1; border: none; background: transparent; cursor: pointer;
  padding: 10px 6px; border-radius: 10px; font: inherit;
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,.7);
  transition: background .2s, color .2s;
}
.login-tabs button.on { background: #fff; color: var(--primary); }

.dark-field { margin-top: 16px; animation: loginFadeUp .45s ease both; }
.dark-field:nth-of-type(1) { animation-delay: .1s; }
.dark-field:nth-of-type(2) { animation-delay: .16s; }
.dark-field label {
  display: block; font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.55);
  margin-bottom: 7px; letter-spacing: 0.06em; text-transform: uppercase;
}
.dark-input-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.09); border: 1.5px solid rgba(255,255,255,.16);
  border-radius: var(--radius-sm); padding: 0 14px; height: 52px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.dark-input-wrap:focus-within { border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.14); box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
.dark-input-wrap svg { flex-shrink: 0; color: rgba(255,255,255,.55); width: 18px; height: 18px; transition: color .2s; }
.dark-input-wrap:focus-within svg { color: #fff; }
.dark-input-wrap input {
  flex: 1; background: none; border: none; color: #fff; font-size: 15px; height: 52px; outline: none;
}
.dark-input-wrap input::placeholder { color: rgba(255,255,255,.4); }
.dark-input-wrap button { background: none; border: none; color: rgba(255,255,255,.5); cursor: pointer; display: flex; }

.login-submit {
  margin-top: 26px; background: linear-gradient(135deg,var(--cta),#FF8A5B); color: #fff; border: none;
  border-radius: var(--radius-xl); height: 54px; width: 100%; font-size: 16px; font-weight: 700;
  letter-spacing: 0.02em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 12px 26px -10px rgba(255,106,69,.6);
  animation: loginFadeUp .45s .22s ease both;
  transition: transform .15s ease, box-shadow .2s ease;
}
.login-submit:active { transform: scale(.97); box-shadow: 0 6px 16px -8px rgba(255,106,69,.6); }
.login-submit:disabled { opacity: .8; }
.login-version { text-align: center; color: rgba(255,255,255,.4); font-size: 11.5px; margin-top: 24px; animation: loginFadeUp .4s .28s ease both; }

/* ── Passage de mot de passe obligatoire / bandeau d'en-tête plein écran ── */
.hero-gradient {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(165deg,var(--primary) 0%,#223C9E 100%);
  color: #fff;
  padding: 26px 22px 32px;
}
.hero-gradient.centered { text-align: center; padding-top: 42px; padding-bottom: 34px; }
.hero-icon-circle {
  width: 60px; height: 60px; border-radius: 30px; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.hero-icon-circle svg { width: 30px; height: 30px; }
.hero-title { font-family: var(--font-display); font-weight: 800; font-size: 19px; margin-bottom: 8px; }
.hero-sub { font-size: 12.5px; color: rgba(255,255,255,.8); line-height: 1.5; }

/* ── Menu (grille de modules) ── */
.menu-banner {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(165deg,var(--primary) 0%,#223C9E 100%); color: #fff; display: flex; align-items: center;
  gap: 12px; padding: 12px 16px 18px;
}
.menu-avatar {
  width: 46px; height: 46px; border-radius: var(--radius-md); background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 17px; flex-shrink: 0;
}
.menu-name-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.menu-name { font-size: 15px; font-weight: 800; }
.menu-super-badge {
  display: inline-flex; align-items: center; gap: 2px; background: #FFE4D9; color: #C24A26;
  border-radius: 8px; padding: 2px 5px; font-size: 9px; font-weight: 800;
}
.menu-pseudo { font-size: 10px; color: rgba(255,255,255,.55); margin-bottom: 4px; }
.menu-role-row { display: flex; align-items: center; gap: 8px; }
.menu-role-pill {
  display: inline-flex; align-items: center; gap: 3px; border-radius: 20px;
  padding: 3px 8px; font-size: 10px; font-weight: 700;
}
.menu-filiale { font-size: 10px; color: rgba(255,255,255,.6); }
.menu-logout-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: rgba(255,255,255,.85); cursor: pointer; flex-shrink: 0;
}
.menu-logout-btn span { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.7); }

.menu-section-title-row {
  display: flex; justify-content: space-between; align-items: center; padding: 18px 16px 8px;
}
.menu-section-title { font-family: var(--font-display); font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; }
.menu-section-count { font-size: 12px; color: var(--text-light); }

.menu-group { margin-bottom: 18px; }
.menu-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 16px; }
.module-card {
  width: calc(50% - 6px); background: var(--surface); border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: pointer; text-align: left; padding: 0;
  display: flex; flex-direction: column; transition: box-shadow .2s;
}
.module-card:active { box-shadow: var(--shadow-md); }
.module-card-top {
  padding: 14px 14px 12px; display: flex; justify-content: space-between; align-items: flex-start;
}
.module-icon-circle {
  width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
}
.module-icon-circle svg { width: 24px; height: 24px; }
.module-chevron {
  width: 22px; height: 22px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.module-chevron svg { width: 12px; height: 12px; }
.module-badge {
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px;
  background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}
.module-card-body { padding: 2px 14px 12px; }
.module-label { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.module-desc { font-size: 11px; color: var(--text-light); }
.module-accent { height: 3px; }

/* ── Menu en liste groupée par catégorie (une carte par section, une ligne par module) ── */
.module-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface3);
  cursor: pointer;
}
.module-row:last-child { border-bottom: none; }
.module-row:active { background: var(--surface2); }
.module-row-icon {
  width: 42px; height: 42px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.module-row-icon svg { width: 21px; height: 21px; }
.module-row-body { flex: 1; min-width: 0; }
.module-row-label { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.module-row-desc { font-size: 11.5px; color: var(--text-light); }

/* ── Bouton d'action flottant (unique par écran) ── */
.fab {
  position: fixed; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg,var(--cta),#FF8A5B); color: #fff; border: none;
  box-shadow: var(--shadow-lg);
}

/* ── Bouton discret pour replier/déplier des filtres secondaires ── */
.filter-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 20px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 700; color: var(--text-light); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.filter-toggle.open { border-color: var(--primary); color: var(--primary); }

/* ── Modale bottom-sheet ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(25,27,38,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-overlay .modal-sheet {
  background: var(--surface); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0;
  max-height: 88vh; overflow-y: auto; padding-bottom: var(--safe-bottom);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.modal-header h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; }
.modal-body { padding: 18px; }

/* ── Fil d'actualités (style réseau social) ── */
.act-feed { background: var(--surface2); min-height: 100%; }
.act-post {
  background: var(--surface);
  padding: 14px 16px 6px;
  margin-bottom: 8px;
}
.act-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.act-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(140deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0;
}
.act-author { font-size: 13.5px; font-weight: 800; color: var(--text); line-height: 1.2; }
.act-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-light); margin-top: 2px; }
.act-meta svg { width: 11px; height: 11px; }
.act-msg {
  font-size: 13.5px; line-height: 1.5; color: var(--text);
  margin: 0 0 8px; white-space: pre-wrap; word-break: break-word;
}
.act-msg.clamped {
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.act-more {
  background: none; border: 0; padding: 0 0 8px; font: inherit;
  font-size: 12.5px; font-weight: 700; color: var(--text-light); cursor: pointer;
}
.act-reactsum { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-light); padding: 2px 0 8px; }
.act-reactsum .act-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.act-reactsum .act-thumb svg { width: 11px; height: 11px; }
.act-actions { display: flex; border-top: 1px solid var(--border); }
.act-act-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: none; border: 0; padding: 9px 4px; font: inherit;
  font-size: 12.5px; font-weight: 700; color: var(--text-light); cursor: pointer;
  transition: background .15s, color .15s;
}
.act-act-btn:active { background: var(--surface2); }
.act-act-btn.liked { color: var(--primary); }
.act-act-btn.liked svg { animation: actLikePop .3s cubic-bezier(.34,1.56,.64,1); }
.act-act-btn.danger { color: var(--danger); flex: 0 0 auto; padding-left: 16px; padding-right: 16px; }
@keyframes actLikePop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ── Tutoriel de première ouverture ── */
#onboarding {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 22px calc(24px + var(--safe-bottom));
  background: linear-gradient(165deg, #5D80F5 0%, var(--primary) 45%, #1B2F7A 100%);
  animation: onbIn .3s ease both;
}
#onboarding.onb-leaving { animation: onbOut .25s ease forwards; }
@keyframes onbIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes onbOut { to { opacity: 0; transform: scale(1.03); } }
.onb-card {
  width: 100%; max-width: 400px; text-align: center; color: #fff;
  display: flex; flex-direction: column; align-items: center;
}
.onb-skip {
  align-self: flex-end; min-height: 20px; background: none; border: 0;
  color: rgba(255,255,255,.75); font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; padding: 4px 2px; margin-bottom: 8px;
}
.onb-illus {
  width: 96px; height: 96px; border-radius: 30px; margin: 12px 0 26px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  animation: onbPop .45s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes onbPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
.onb-title { font-family: var(--font-display); font-weight: 800; font-size: 22px; margin-bottom: 12px; }
.onb-text { font-size: 14px; line-height: 1.6; color: rgba(255,255,255,.82); max-width: 320px; }
.onb-dots { display: flex; gap: 7px; margin: 30px 0 22px; }
.onb-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.3); transition: width .2s, background .2s; }
.onb-dot.active { width: 22px; border-radius: 4px; background: #fff; }
.onb-next {
  width: 100%; max-width: 300px; padding: 14px; border: 0; border-radius: 14px;
  background: var(--cta); color: #fff; font: inherit; font-size: 15px; font-weight: 800;
  cursor: pointer; box-shadow: 0 12px 28px -10px rgba(255,106,69,.6);
  transition: transform .12s;
}
.onb-next:active { transform: scale(.97); }

/* Écran « Message aux parents » */
.mp-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }

/* ── En-tête repliable au défilement — comportement générique (tous les écrans) ── */
.screen-header { transition: padding .2s ease; }
.screen-header.is-scrolled { padding-top: 10px; padding-bottom: 10px; }
.screen-header.is-scrolled .screen-title { font-size: 16px; }
.screen-header.is-scrolled .screen-subtitle {
  max-height: 0; opacity: 0; margin: 0; overflow: hidden;
}
.screen-header .screen-subtitle {
  transition: max-height .2s ease, opacity .15s ease, margin .2s ease;
  max-height: 24px; overflow: hidden;
}

/* Fiche élève : en-tête qui se réduit davantage (grande carte → bandeau compact) */
.ed-header { padding: 16px 20px 22px; transition: padding .22s ease; }
.ed-header .ed-h-picker { margin-bottom: 14px; transition: margin .22s ease; }
.ed-header .ed-h-avatar,
.ed-header .ed-h-badges {
  overflow: hidden;
  transition: max-height .28s ease, opacity .16s ease, margin .22s ease, transform .22s ease;
  max-height: 120px;
}
.ed-header .ed-h-name {
  font-size: 20px; font-weight: 800; margin: 0 0 10px;
  transition: font-size .22s ease, margin .22s ease;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ed-header.is-scrolled { padding-top: 10px; padding-bottom: 10px; }
.ed-header.is-scrolled .ed-h-picker { margin-bottom: 0; }
.ed-header.is-scrolled .ed-h-avatar { max-height: 0; opacity: 0; margin: 0; transform: scale(.6); border-width: 0; }
.ed-header.is-scrolled .ed-h-badges { max-height: 0; opacity: 0; margin: 0; }
.ed-header.is-scrolled .ed-h-name { font-size: 15px; margin: 0; }

/* Écran Mon profil : le bandeau bleu (hero) se réduit aussi au défilement */
.pf-hero { transition: padding .22s ease; }
.pf-hero .pf-hero-avatar,
.pf-hero .pf-hero-sub,
.pf-hero .pf-hero-badge {
  overflow: hidden;
  transition: max-height .28s ease, opacity .16s ease, margin .22s ease, transform .22s ease;
  max-height: 130px;
}
.pf-hero .pf-hero-name { font-size: 20px; transition: font-size .22s ease, margin .22s ease; }
.hero-gradient.pf-hero.is-scrolled { padding-top: 12px; padding-bottom: 12px; }
.pf-hero.is-scrolled .pf-hero-avatar { max-height: 0; opacity: 0; margin: 0; transform: scale(.5); border-width: 0; }
.pf-hero.is-scrolled .pf-hero-sub { max-height: 0; opacity: 0; margin: 0; }
.pf-hero.is-scrolled .pf-hero-badge { max-height: 0; opacity: 0; margin: 0; }
.pf-hero.is-scrolled .pf-hero-name { font-size: 16px; margin: 0; }

/* Écran Profil — halos décoratifs dans le bandeau + avatar en anneau dégradé avec
   pastille de rôle, dans le style des écrans de connexion (login-orb1/2).
   Bandeau resserré (padding réduit) : .hero-gradient.centered est partagé avec
   d'autres écrans, donc on resserre seulement via .pf-hero-v2, plus spécifique. */
.hero-gradient.pf-hero-v2.centered { padding-top: 30px; padding-bottom: 22px; overflow: hidden; position: relative; }
.pf-hero-v2::before, .pf-hero-v2::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.pf-hero-v2::before {
  width: 200px; height: 200px; top: -80px; right: -60px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.16), rgba(255,255,255,0) 70%);
}
.pf-hero-v2::after {
  width: 150px; height: 150px; bottom: -80px; left: -50px;
  background: radial-gradient(circle at 30% 30%, rgba(255,106,69,.30), rgba(255,106,69,0) 70%);
}
.pf-hero-v2 > * { position: relative; z-index: 1; }

.pf-avatar-ring {
  position: relative; width: 82px; height: 82px; border-radius: 41px; margin: 0 auto 10px;
  padding: 3px; background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.2));
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.35);
}
.pf-role-dot {
  position: absolute; right: -1px; bottom: -1px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  border: 2.5px solid var(--primary-dark); box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Bandeau de repères juste sous le bandeau bleu — Filiale, Année scolaire, Statut,
   en un coup d'œil. Marge POSITIVE (pas de chevauchement) : le bandeau bleu est
   `position:sticky`, un chevauchement négatif se fait donc trancher par lui dès
   qu'on défile (et sa hauteur varie selon l'appareil/la police — jamais fiable). */
.pf-quickfacts {
  margin: 12px 16px 0;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  display: flex; padding: 12px 4px;
}
.pf-qf { flex: 1; min-width: 0; text-align: center; padding: 0 6px; }
.pf-qf + .pf-qf { border-left: 1px solid var(--border); }
.pf-qf-value {
  font-size: 12.5px; font-weight: 800; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-qf-label {
  font-size: 9.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 4px;
}

/* Bouton d'action pleine largeur (Modifier le profil / Se déconnecter) — même
   grammaire visuelle que .card (radius-lg, shadow-sm, bordure). */
.pf-action-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--radius-lg); padding: 15px 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .15s ease;
}
.pf-action-btn:active { transform: scale(.98); }
.pf-action-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.pf-action-btn.danger { background: #FEF2F2; border-color: #FECACA; }

/* Tarifs de la filiale : grille de vignettes plutôt qu'une liste de 9 lignes. */
.pf-tarif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 14px 14px; }
.pf-tarif-tile {
  background: linear-gradient(160deg, #FFF8ED, #FEF3C7);
  border: 1px solid #FDE8C8; border-radius: var(--radius-md); padding: 10px 12px;
}
.pf-tarif-label {
  font-size: 9.5px; font-weight: 700; color: #B45309;
  text-transform: uppercase; letter-spacing: .04em;
}
.pf-tarif-value { font-size: 13.5px; font-weight: 800; color: var(--text); margin-top: 3px; }

/* Carte "À propos" : icône d'app + puces de statut (version / MAJ) + actions en pilules. */
.pf-about-app { display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px; }
.pf-about-icon { width: 48px; height: 48px; border-radius: 14px; box-shadow: var(--shadow-sm); object-fit: cover; flex-shrink: 0; }
.pf-status-row { display: flex; gap: 10px; padding: 0 16px 4px; }
.pf-status-chip { flex: 1; min-width: 0; background: var(--surface2); border-radius: var(--radius-md); padding: 9px 12px; }
.pf-status-label { display: block; font-size: 9.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.pf-status-value { display: block; font-size: 12.5px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pill-row { display: flex; justify-content: center; gap: 10px; padding: 12px 16px 4px; }
.pf-pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer;
}
.pf-pill-btn:active { background: var(--surface3); }

/* Tableau de bord : le bandeau d'accueil se réduit au défilement → juste le nom.
   Bascule INSTANTANÉE (pas de transition) : deux états francs — plié / déplié —
   sans état intermédiaire animé qui « saccadait » sous le bandeau sticky. */
.screen-header.db-hero { transition: none; }
.db-hero .db-hero-greet,
.db-hero .db-hero-meta,
.db-hero .db-hero-chips,
.db-hero .db-hero-side {
  overflow: hidden;
  transition: none;
  max-height: 90px;
}
.db-hero .db-hero-chips { margin-top: 12px; }
.db-hero .db-hero-name { transition: none; }
.db-hero.is-scrolled .db-hero-greet,
.db-hero.is-scrolled .db-hero-meta,
.db-hero.is-scrolled .db-hero-chips,
.db-hero.is-scrolled .db-hero-side { max-height: 0; opacity: 0; margin: 0; }
.db-hero.is-scrolled .db-hero-name { font-size: 16px; }
.db-hero.is-scrolled > .row { align-items: center; }

/* Tableau de bord Parent : en-tête FIXE (data-no-collapse) — ne se replie jamais,
   donc aucun état intermédiaire. Padding resserré puisqu'il reste toujours affiché. */
.screen-header.db-hero-fixed { padding: 14px 18px 14px; }

/* Sélecteur d'enfant intégré au bandeau. */
.db-hero .db-hero-children { margin-top: 12px; padding-bottom: 2px; transition: none; }
.db-hero .db-hero-children .chip {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .32);
  color: #fff;
  box-shadow: none;
}
.db-hero .db-hero-children .chip.active { background: #fff; border-color: #fff; color: var(--primary); }

/* Manuel d'utilisation (tableau de bord Parent) — bloc dépliable */
.dp-manuel > summary { list-style: none; }
.dp-manuel > summary::-webkit-details-marker { display: none; }
.dp-manuel .dp-manuel-caret { transition: transform .2s ease; }
.dp-manuel[open] .dp-manuel-caret { transform: rotate(90deg); }
.dp-manuel ul { color: var(--text-light); }
.dp-manuel li { margin-bottom: 5px; }

/* ── Repli flexbox `gap` (composants) ──────────────────────────────────────
   Même repli que layout.css (.row/.stack.gap-X), mais pour les classes de ce
   fichier qui posent `gap:` directement plutôt que via les utilitaires — sur
   WebView système non mis à jour (Android < 11 sans MAJ Play Store), `gap`
   est ignoré et ces éléments s'affichent collés les uns aux autres.
   Conteneurs qui ne passent jamais à la ligne → marge sur chaque enfant sauf
   le premier. Grilles qui « wrappent » (.kpi-grid, .menu-grid) → technique
   marge négative sur le conteneur + marge positive sur chaque enfant, seule
   approche qui reste correcte quel que soit le nombre de lignes. */
@supports not (gap: 1px) {
  .login-back    > * + *,
  .menu-super-badge > * + * { margin-left: 2px; }
  .menu-role-pill > * + * { margin-left: 3px; }
  .badge > * + *,
  .act-meta > * + * { margin-left: 4px; }
  .lp-mini-btn > * + *,
  .login-count > * + *,
  .act-reactsum > * + * { margin-left: 5px; }
  .login-tabs > * + *,
  .menu-name-row > * + *,
  .filter-toggle > * + *,
  .pf-pill-btn > * + * { margin-left: 6px; }
  .fil-badge > * + *,
  .act-act-btn > * + *,
  .onb-dots > * + * { margin-left: 7px; }
  .chip-row > * + *,
  .err-box > * + *,
  .btn > * + *,
  .menu-role-row > * + *,
  .login-submit > * + * { margin-left: 8px; }
  .login-search > * + * { margin-left: 9px; }
  .section-header > * + *,
  .rg-head > * + *,
  .dark-input-wrap > * + *,
  .act-post-head > * + *,
  .pf-status-row > * + *,
  .pf-pill-row > * + * { margin-left: 10px; }
  .fil-card > * + *,
  .menu-banner > * + *,
  .module-row > * + *,
  .pf-action-btn > * + *,
  .pf-about-app > * + * { margin-left: 12px; }

  .menu-logout-btn > * + * { margin-top: 2px; }
  .empty-state > * + * { margin-top: 6px; }

  .kpi-grid { margin: -5px -5px 9px; }
  .kpi-grid > .kpi-tile { margin: 5px; }
  .menu-grid { margin-top: -6px; margin-bottom: -6px; }
  .menu-grid > .module-card { margin: 6px; }
}
