/* ══════════════════════════════════════════════════════════════════════
   PERFORM YL.2 — Version téléphone (moins de 768 px), reprise de PERFORM YL.1
   Chargée par partials/_mobile.html, pour toutes les pages.
   TOUTES les règles sont sous 768 px et sous body.m-on : sur PC, rien ne change.
   Charte inchangée : couleurs, polices, pastilles et dégradés de perform.css.
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {

/* ── Socle ─────────────────────────────────────────────────────────── */
body.m-on{padding-top:58px !important;padding-bottom:calc(66px + env(safe-area-inset-bottom)) !important;
          height:auto !important;min-height:100%;overflow-x:hidden;}
html:has(body.m-on){overflow-x:hidden;}
/* Barre du bas figée (iPhone compris) : la page elle-même est le SEUL élément qui défile. Pas de hauteur imposée à
   html et body (sinon le contenu déborde du corps et passe sous la barre, et iOS décroche les éléments fixes), pas de
   colonne flexible ni de défilement interne dans le corps ; « clip » coupe le débordement horizontal sans créer de
   conteneur de défilement (iOS 16+ ; « hidden » au-dessus pour les plus anciens). */
html:has(body.m-on){height:auto !important;overflow-x:clip;}
body.m-on{display:block !important;overflow-x:clip;}
body.m-on .page-body, body.m-on .content{overflow:visible !important;flex:none !important;}
body.m-on #m-nav, body.m-on #m-entete{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);
          -webkit-backface-visibility:hidden;backface-visibility:hidden;}
/* Application installée (viewport-fit=cover) : en-tête sous la barre d'état, barre du bas au-dessus de la zone basse */
body.m-on #m-entete{padding-top:env(safe-area-inset-top);height:calc(56px + env(safe-area-inset-top)) !important;}
body.m-on{padding-top:calc(58px + env(safe-area-inset-top)) !important;}
body.m-on #m-plus.m-ouvert{top:calc(56px + env(safe-area-inset-top)) !important;}
body.m-on.m-hors-session{padding-top:0 !important;padding-bottom:0 !important;}
body.m-on .kente-band, body.m-on .topbar, body.m-on .greeting-bar, body.m-on .tab-bar, body.m-on > header.entete{display:none !important;}
body.m-on img, body.m-on canvas, body.m-on video{max-width:100%;}
body.m-on .page-body, body.m-on .content{padding:12px 12px 16px !important;max-width:100% !important;}
body.m-on .page-head{flex-wrap:wrap;gap:8px;margin-bottom:10px;}
body.m-on .page-head .page-icon, body.m-on .page-head .page-title{display:none;}
body.m-on .page-sub{font-size:12px;}
body.m-on .page-actions{flex-wrap:wrap;gap:8px;}

/* ── En-tête compact bleu marine ───────────────────────────────────── */
body.m-on #m-entete{display:flex !important;position:fixed;top:0;left:0;right:0;z-index:1040;height:56px;align-items:center;gap:10px;
  padding:0 8px 0 12px;background:var(--noir,#0c2461);border-bottom:2px solid var(--noir3,#1241a8);color:#fff;}
#m-entete .m-logo img{width:34px;height:34px;object-fit:contain;display:block;}
#m-entete .m-retour{display:flex;align-items:center;justify-content:center;width:44px;height:44px;margin-left:-8px;
  color:#fff;font-size:22px;text-decoration:none;}
#m-entete .m-titres{flex:1;min-width:0;line-height:1.2;}
#m-entete .m-titre{font-size:16px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#m-entete .m-sous-titre{font-size:11px;color:rgba(255,255,255,.6);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#m-entete .m-icone{width:44px;height:44px;border:0;background:transparent;color:#fff;font-size:19px;border-radius:10px;}
#m-entete .m-icone[hidden]{display:none;}
#m-entete .m-icone.actif{background:rgba(255,255,255,.14);}

/* ── Barre de navigation du bas ────────────────────────────────────── */
body.m-on #m-nav{display:flex !important;position:fixed;left:0;right:0;bottom:0;z-index:1040;background:#fff;
  border-top:1px solid #d6e0f5;box-shadow:0 -2px 12px rgba(12,36,97,.08);padding-bottom:env(safe-area-inset-bottom);}
#m-nav .m-onglet{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:64px;
  color:#7a869e;text-decoration:none;font-size:11px;font-weight:700;border-top:3px solid transparent;}
#m-nav .m-onglet i{font-size:20px;}
#m-nav .m-onglet.actif{color:var(--noir,#0c2461);border-top-color:#1a56db;}

/* ── Page « Plus » ─────────────────────────────────────────────────── */
body.m-on #m-plus.m-ouvert{display:block !important;position:fixed;top:56px;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));
  z-index:1035;overflow-y:auto;background:var(--off,#f0f5ff);padding:4px 0 16px;}
#m-plus .m-plus-groupe{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:#7a869e;padding:14px 16px 6px;}
#m-plus .m-plus-ligne{display:flex;align-items:center;gap:12px;min-height:52px;padding:0 16px;background:#fff;
  border-bottom:1px solid #e6ecf8;color:var(--noir,#0c2461);text-decoration:none;font-size:15px;font-weight:600;}
#m-plus .m-plus-ic{width:22px;text-align:center;font-size:18px;color:#1241a8;}
#m-plus .m-plus-ligne span{flex:1;min-width:0;}
#m-plus .m-chevron{color:#b4bfd6;font-size:14px;}
#m-plus .m-quitter, #m-plus .m-quitter .m-plus-ic{color:var(--rouge,#b91c1c);}
body.m-plus-ouvert{overflow:hidden;}

/* ── Accueil ────────────────────────────────────────────────────────── */
/* Compteurs en grille de 3, tuiles par 2 ; le bas de page laisse la place à la barre du bas. */
body.m-on.m-page-accueil{padding-bottom:calc(150px + env(safe-area-inset-bottom)) !important;}
body.m-on.m-page-accueil .content{padding:12px 12px 8px !important;}
body.m-on.m-page-accueil .pastilles{display:grid !important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px !important;
  max-width:none !important;margin:0 0 12px !important;}
body.m-on.m-page-accueil .pastilles .stat-chip{display:flex !important;flex-direction:column;align-items:flex-start;justify-content:flex-start;
  gap:2px;min-height:68px;padding:9px 10px;border-radius:12px;white-space:normal;font-size:11.5px;line-height:1.25;
  font-weight:600;min-width:0;overflow-wrap:anywhere;color:#4b5a75;}
body.m-on.m-page-accueil .pastilles .stat-chip .num{font-size:20px;line-height:1.1;}
body.m-on.m-page-accueil .pastilles .stat-chip .lib{font-weight:600;}
body.m-on.m-page-accueil .pastilles .m-tout-voir{display:flex !important;align-items:center;justify-content:center;
  border-style:dashed;color:#1a56db;font-weight:800;font-size:12.5px;}
body.m-on.m-page-accueil .modules-grid{display:grid !important;grid-auto-flow:row !important;
  grid-template-columns:1fr 1fr !important;grid-auto-columns:auto !important;gap:10px !important;}
/* Tuiles identiques (2 × 2) : icône centrée en haut, titre, sous-titre ; la principale ne diffère que par sa couleur */
body.m-on.m-page-accueil .module-card{min-height:112px;align-items:center;justify-content:center;text-align:center;
  gap:6px;padding:12px 10px;margin:0;}
body.m-on.m-page-accueil .module-card .mc-title{font-size:14px;}
body.m-on.m-page-accueil .module-card .mc-sub{display:block;font-size:11px;line-height:1.3;}
body.m-on.m-page-accueil .m-coin{display:block !important;position:absolute;top:8px;right:8px;min-width:22px;height:22px;padding:0 6px;
  border-radius:999px;background:#fff;color:#b91c1c;font-size:12px;font-weight:800;line-height:22px;text-align:center;}
body.m-on.m-page-accueil .m-action-rapide{display:inline-flex !important;align-items:center;gap:8px;position:fixed;right:14px;z-index:1030;
  bottom:calc(76px + env(safe-area-inset-bottom));min-height:48px;padding:0 20px;border-radius:999px;background:#1a56db;color:#fff;
  font-size:15px;font-weight:800;text-decoration:none;box-shadow:0 6px 18px rgba(12,36,97,.35);}
body.m-on.m-page-accueil .alertes-zone{border-radius:12px;}
body.m-on.m-page-accueil .alerte-item{min-height:48px;align-items:center;}
body.m-on.m-page-accueil .mention-bientot{font-size:10.5px;top:8px;right:8px;}
#m-entete .m-icone-lien{display:flex;align-items:center;justify-content:center;position:relative;text-decoration:none;color:#fff;}
#m-entete .m-badge-rouge{position:absolute;top:4px;right:2px;min-width:18px;height:18px;padding:0 4px;border-radius:999px;
  background:#dc2626;color:#fff;font-size:11px;font-weight:800;line-height:18px;text-align:center;}
#m-nav .m-onglet{min-height:48px;}
#m-nav .m-onglet.actif i{background:#e3ebfb;border-radius:999px;padding:2px 14px;}
body.m-on #m-nav{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;}
#m-nav::-webkit-scrollbar{display:none;}
#m-nav .m-onglet{flex:1 0 19vw;min-width:64px;}
body.m-on.m-page-accueil .content{touch-action:pan-y;}
/* « Plus » : cartes */
#m-plus .m-plus-cartes{display:flex;flex-direction:column;gap:10px;padding:12px;}
#m-plus .m-plus-carte{display:flex;align-items:center;gap:12px;min-height:60px;padding:10px 14px;background:#fff;border:1px solid #d6e0f5;
  border-radius:12px;color:var(--noir,#0c2461);text-decoration:none;}
#m-plus .m-plus-carte .m-plus-ic{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:10px;
  background:#eef3fd;color:#1241a8;font-size:18px;flex:none;}
#m-plus .m-plus-txt{flex:1;min-width:0;display:flex;flex-direction:column;}
#m-plus .m-plus-txt strong{font-size:15px;}
#m-plus .m-plus-txt small{font-size:12px;color:#6b7a95;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#m-plus .m-plus-carte.m-quitter strong{color:var(--rouge,#b91c1c);}

/* ── Pastilles et filtres en pastilles défilant horizontalement ────── */
body.m-on .filters-bar, body.m-on .filter-bar, body.m-on .filtres{display:flex !important;flex-direction:row !important;align-items:center !important;flex-wrap:nowrap !important;overflow-x:auto;
  gap:8px;padding-bottom:6px;scrollbar-width:none;-webkit-overflow-scrolling:touch;max-width:100%;}
body.m-on .filters-bar::-webkit-scrollbar{display:none;}
body.m-on .filters-bar > *{flex:0 0 auto;}
body.m-on .filters-bar .filter-label{display:none;}
body.m-on .filters-bar select, body.m-on .filters-bar .filter-sel, body.m-on .filters-bar .filter-date,
body.m-on .filters-bar .btn-filter, body.m-on .filters-bar .btn-filter-reset{border-radius:999px !important;min-height:40px;font-size:14px !important;max-width:72vw;}
body.m-on .m-zone-recherche{display:none !important;}
body.m-on.m-recherche .m-zone-recherche{display:flex !important;}
body.m-on .m-zone-recherche input{flex:1 1 auto;min-width:0;}

/* ── Tableaux en cartes ────────────────────────────────────────────── */
body.m-on .table-scroll, body.m-on .table-wrap, body.m-on .table-responsive{overflow:visible !important;max-width:100%;border:0 !important;
  background:transparent !important;box-shadow:none !important;}
body.m-on table.m-cartes, body.m-on table.m-pile{display:block;width:100% !important;min-width:0 !important;border:0 !important;background:transparent !important;}
body.m-on table.m-cartes thead, body.m-on table.m-pile thead{display:none;}
body.m-on table.m-cartes tbody, body.m-on table.m-pile tbody, body.m-on table.m-cartes tfoot, body.m-on table.m-pile tfoot{display:flex;flex-direction:column;gap:10px;}
body.m-on table.m-cartes tr, body.m-on table.m-pile tr{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:10px;row-gap:3px;
  background:#fff !important;border:1px solid #d6e0f5;border-radius:12px;padding:12px 14px;box-shadow:0 1px 6px rgba(12,36,97,.06);}
body.m-on table.m-cartes td, body.m-on table.m-pile td, body.m-on table.m-cartes th, body.m-on table.m-pile th{display:block;border:0 !important;
  padding:1px 0 !important;background:transparent !important;min-width:0;width:auto !important;white-space:normal !important;
  overflow-wrap:anywhere;text-align:left !important;font-size:13px;}
body.m-on table.m-cartes td.m-cache{display:none !important;}
body.m-on table.m-cartes td.m-titre{grid-column:1;grid-row:1;color:var(--noir,#0c2461);font-weight:800;font-size:15px;}
body.m-on table.m-cartes td.m-titre a{color:var(--noir,#0c2461);}
body.m-on table.m-cartes td.m-etat{grid-column:2;grid-row:1;justify-self:end;align-self:start;max-width:55vw;text-align:right !important;}
body.m-on table.m-cartes td.m-etat .badge, body.m-on table.m-cartes td.m-etat [class*="badge-"]{white-space:normal;}
body.m-on table.m-cartes td.m-info, body.m-on table.m-cartes td.m-actions, body.m-on table.m-pile td{grid-column:1 / -1;color:#333;}
body.m-on table.m-cartes td.m-info[data-label]:not([data-label=""])::before,
body.m-on table.m-pile td[data-label]:not([data-label=""])::before{content:attr(data-label) " · ";color:#7a869e;font-weight:700;font-size:12px;}
body.m-on table.m-pile td[data-label]:not([data-label=""])::before{display:block;content:attr(data-label);}
body.m-on table.m-cartes td.m-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px;}
body.m-on table.m-cartes tr.m-vide, body.m-on table.m-pile tr.m-vide{display:block;}
body.m-on table.m-cartes tr.m-cliquable{cursor:pointer;}
body.m-on table.m-cartes tr.m-cliquable:active{background:#eef3fd !important;}
body.m-on table.m-pile input, body.m-on table.m-pile select, body.m-on table.m-pile textarea{width:100% !important;max-width:100%;}
body.m-on table.m-etroit{width:100% !important;min-width:0 !important;table-layout:auto;}
body.m-on table.m-etroit td, body.m-on table.m-etroit th{white-space:normal !important;overflow-wrap:anywhere;}

/* ── Formulaires : une colonne, 16 px, zones de 44 px ──────────────── */
body.m-on input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]),
body.m-on select, body.m-on textarea{font-size:16px !important;min-height:44px;max-width:100%;}
body.m-on textarea{min-height:88px;}
body.m-on button, body.m-on .btn, body.m-on [class^="btn-"], body.m-on [class*=" btn-"]{min-height:44px;}
body.m-on input[type=checkbox], body.m-on input[type=radio]{min-width:20px;min-height:20px;}
body.m-on .form-grid, body.m-on .grid-2, body.m-on .grid-3, body.m-on .form-row, body.m-on .tuiles,
body.m-on .mod-grid{grid-template-columns:minmax(0,1fr) !important;}
body.m-on .form-grid > *, body.m-on .span2, body.m-on .span-2{grid-column:1 / -1 !important;}
body.m-on form .row > [class*="col-"]{flex:0 0 100%;max-width:100%;}
body.m-on .m-choix{display:flex;gap:8px;flex-wrap:wrap;}
body.m-on .m-choix{display:flex !important;}
body.m-on .m-choix button{flex:1 1 0;min-height:48px;border-radius:10px;border:1.5px solid #c0d0f0;background:#fff;
  color:var(--noir,#0c2461);font-weight:800;font-size:15px;}
body.m-on .m-choix button.choisi{background:var(--noir,#0c2461);border-color:var(--noir,#0c2461);color:#fff;}
body.m-on select.m-choix-court{display:none !important;}

/* ── Bouton principal fixé en bas, bouton « + » flottant ───────────── */
body.m-on .m-action-fixe{position:fixed !important;left:12px;right:12px;bottom:calc(72px + env(safe-area-inset-bottom));z-index:1030;
  width:auto !important;min-height:50px;font-size:16px !important;justify-content:center;box-shadow:0 4px 16px rgba(12,36,97,.25);}
body.m-on.m-a-action{padding-bottom:calc(136px + env(safe-area-inset-bottom)) !important;}
body.m-on .m-fab{position:fixed !important;right:16px;bottom:calc(80px + env(safe-area-inset-bottom));z-index:1030;width:56px;height:56px;
  min-height:56px;padding:0 !important;border-radius:50% !important;font-size:0 !important;display:flex !important;align-items:center;
  justify-content:center;box-shadow:0 6px 18px rgba(12,36,97,.35);}
body.m-on .m-fab i{font-size:26px !important;margin:0 !important;}

/* ── Volets et fenêtres en plein écran ─────────────────────────────── */
body.m-on .modal-overlay .modal-box, body.m-on .modal-dialog{width:100% !important;max-width:100% !important;height:100%;max-height:100% !important;
  margin:0 !important;border-radius:0 !important;display:flex;flex-direction:column;}
body.m-on .modal-overlay{padding:0 !important;align-items:stretch !important;z-index:1050;}
body.m-on .modal-content{height:100%;border-radius:0 !important;}
body.m-on .modal-box form{display:flex;flex-direction:column;flex:1;min-height:0;}
body.m-on .modal-body{overflow-y:auto;flex:1;}
body.m-on .modal-footer{position:sticky;bottom:0;background:#fff;z-index:2;padding:10px 12px calc(10px + env(safe-area-inset-bottom)) !important;}
body.m-on .modal-footer > *{flex:1;}

/* ── Journaux (classe m-journal) : une carte par entrée — date courte et nom, puis le texte ── */
body.m-on table.m-journal{display:block;width:100% !important;min-width:0 !important;border:0 !important;background:transparent !important;}
body.m-on table.m-journal thead{display:none;}
body.m-on table.m-journal tbody{display:flex;flex-direction:column;gap:8px;}
body.m-on table.m-journal tr{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:10px;row-gap:3px;align-items:baseline;
  background:#fff !important;border:1px solid #d6e0f5 !important;border-radius:10px;padding:9px 12px;}
body.m-on table.m-journal td{display:block;border:0 !important;padding:0 !important;background:transparent !important;min-width:0;}
body.m-on table.m-journal td.j-quand{grid-column:1;grid-row:1;white-space:nowrap !important;font-weight:800;font-size:12.5px;color:var(--noir,#0c2461);}
body.m-on table.m-journal td.j-qui{grid-column:2;grid-row:1;white-space:nowrap !important;overflow:hidden;text-overflow:ellipsis;font-size:12.5px;color:#4b5875;}
body.m-on table.m-journal td.j-quoi, body.m-on table.m-journal td.j-plus{grid-column:1 / -1;font-size:13px !important;line-height:1.35;
  white-space:normal !important;overflow-wrap:break-word;}
body.m-on table.m-journal td.j-plus{color:#6b7a95;font-size:12px !important;}
body.m-on table.m-journal td[colspan]{grid-column:1 / -1;}
body.m-on table.m-journal .j-long{display:none !important;}
body.m-on table.m-journal .j-court{display:inline !important;}

/* ── Divers YL.2 ───────────────────────────────────────────────────── */
body.m-on .rubrique{text-align:left;margin:18px 2px 8px;}
body.m-on.m-page-accueil{padding-bottom:calc(86px + env(safe-area-inset-bottom)) !important;}
body.m-on .carte-centre{margin:12px auto;}

/* ── Pastilles ─────────────────────────────────────────────────────── */
body.m-on .stat-bar, body.m-on .pastilles{gap:6px;}
body.m-on .stat-chip{font-size:12px;}

}

/* Hors téléphone : rien de la version téléphone n'apparaît */
@media (min-width: 768px) {
  #m-entete, #m-nav, #m-plus, .m-choix{display:none !important;}
}
/* Sous-onglets et fiche (référentiel) */
@media (max-width: 767.98px) {
  body.m-on .sous-onglets a{min-height:44px;font-size:14px;}
  body.m-on .fiche-grille{grid-template-columns:1fr 1fr;}
  body.m-on table.m-cartes td.td-nombre{text-align:left !important;}
}
@media (max-width: 767.98px) {
  body.m-on .liste-cases{grid-template-columns:1fr;max-height:none;}
  body.m-on .liste-cases label{min-height:40px;font-size:15px;}
  body.m-on .ligne-statut{flex-wrap:wrap;}
}
@media (max-width: 767.98px) {
  body.m-on .resultat-grille{grid-template-columns:1fr 1fr;}
  body.m-on .resultat-terrain{position:sticky;bottom:calc(66px + env(safe-area-inset-bottom));z-index:5;box-shadow:0 -4px 14px rgba(12,36,97,.12);}
  body.m-on .resultat-detail{display:none;}
  body.m-on .grille-usages{grid-template-columns:1fr 1fr !important;}
  body.m-on .photo-btns .btn-ghost{flex:1;justify-content:center;min-height:48px;}
  body.m-on .plus-details summary{min-height:44px;display:flex;align-items:center;gap:.4rem;font-size:15px;}
}
@media (max-width: 767.98px) {
  body.m-on .choix-boutons label{flex:1 1 45%;}
  body.m-on .choix-boutons span{width:100%;min-height:48px;font-size:14px;border-radius:10px;}
  body.m-on .liste-questions{grid-template-columns:1fr;}
  body.m-on .liste-materiel label{font-size:15px;min-height:40px;}
}
@media (max-width: 767.98px) {
  body.m-on .barre-score{grid-template-columns:minmax(0,1fr) 3rem;}
  body.m-on .barre-score .piste{grid-column:1 / -1;grid-row:2;}
  body.m-on .question-exigence{font-size:17px;}
  body.m-on .question-aide{font-size:14px;}
  body.m-on .question-nav a,body.m-on .question-nav button{flex:1 1 45%;justify-content:center;min-height:46px;}
}
@media (max-width: 767.98px) {
  body.m-on .chiffres-cles,body.m-on .etapes{grid-template-columns:1fr 1fr;}
  body.m-on .chiffre-cle .val{font-size:16px;}
}
/* Accueil en onglets : points de repère sous l'en-tête, on glisse d'un onglet à l'autre */
@media (max-width: 767.98px) {
  body.m-on.m-page-accueil .tab-bar{display:none !important;}
  body.m-on.m-page-accueil .m-points{display:flex !important;align-items:center;justify-content:center;gap:8px;padding:10px 12px 2px;}
  body.m-on.m-page-accueil .m-point{width:8px;height:8px;border-radius:50%;background:#c0d0f0;cursor:pointer;}
  body.m-on.m-page-accueil .m-point.actif{width:22px;border-radius:999px;background:#1241a8;}
  body.m-on.m-page-accueil .m-point-titre{font-size:13px;font-weight:800;color:#0c2461;margin-left:6px;}
  body.m-on.m-page-accueil .modules-grid{grid-template-columns:1fr 1fr !important;}
}
