/* ============================================================
   NOUBYA PLANIFICATION — MAQUETTE V2
   Identité visuelle originale. Aucun élément emprunté à un tiers.
   Données entièrement fictives. Aucune dépendance externe.
   ============================================================ */

:root {
  /* Identité Noubya : sarcelle profond + neutres chauds */
  --n-encre:      #16232b;
  --n-encre-doux: #5f6f79;
  --n-fond:       #f4f2ef;   /* neutre chaud, distinct du gris bleuté habituel */
  --n-surface:    #ffffff;
  --n-surface-2:  #faf9f7;
  --n-bord:       #dfdad3;
  --n-bord-fort:  #c3bcb3;
  --n-accent:     #0f6b6b;   /* sarcelle */
  --n-accent-2:   #e4efee;
  --n-accent-3:   #0a4f4f;
  --n-ok:         #1c6b46;
  --n-ok-2:       #e6f1ea;
  --n-attente:    #8a5510;
  --n-attente-2:  #fbf0df;
  --n-alerte:     #973030;
  --n-alerte-2:   #fbeaea;
  --n-r:          5px;
  --nav-l:        224px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --n-encre: #e8e6e3; --n-encre-doux: #9aa5ac;
    --n-fond: #12171a; --n-surface: #1a2126; --n-surface-2: #202930;
    --n-bord: #2d363d; --n-bord-fort: #3f4a52;
    --n-accent: #4fb0ab; --n-accent-2: #16292b; --n-accent-3: #6fc8c3;
    --n-ok: #6bbd91; --n-ok-2: #14251c;
    --n-attente: #d3a24e; --n-attente-2: #29211430;
    --n-alerte: #d98383; --n-alerte-2: #2a1a1a;
  }
}

* { box-sizing: border-box; }

/* Le fond doit être porté par html : sinon, quand le contenu est plus court
   que la fenêtre, une bande blanche apparaît sous la page. */
html { height: 100%; background: var(--n-fond); }

body {
  margin: 0;
  min-height: 100vh;
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--n-encre); background: var(--n-fond);
  overflow-x: hidden;
}

/* La coquille : c'est ICI que la navigation et la zone principale se partagent
   la largeur. #app est le seul conteneur commun — sans display:flex sur lui,
   la barre latérale et le contenu s'empilent verticalement. */
#app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}

a { color: var(--n-accent); }

/* ---------- BARRE LATÉRALE ---------- */
.nav {
  width: var(--nav-l); flex: 0 0 var(--nav-l);
  background: var(--n-surface); border-right: 1px solid var(--n-bord);
  display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
}
.nav .marque {
  padding: 16px 18px 14px; font-weight: 700; font-size: 15px;
  letter-spacing: -.01em; display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid var(--n-bord);
}
.nav .marque .sceau {
  width: 22px; height: 22px; border-radius: 5px; flex: 0 0 22px;
  background: var(--n-accent); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.nav .marque small { display: block; font-size: 10.5px; font-weight: 500; color: var(--n-encre-doux); letter-spacing: .04em; text-transform: uppercase; }
.nav .liens { padding: 10px 8px; flex: 1; overflow-y: auto; }
/* Réserve la hauteur du ruban de maquette, qui est fixé en bas de fenêtre. */
.nav .pied { padding: 8px 8px 30px; border-top: 1px solid var(--n-bord); }
.nav a.item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 1px; border-radius: var(--n-r);
  color: var(--n-encre-doux); text-decoration: none; font-size: 13.5px;
  border-left: 3px solid transparent;
}
.nav a.item:hover { background: var(--n-surface-2); color: var(--n-encre); }
.nav a.item.actif {
  background: var(--n-accent-2); color: var(--n-accent-3);
  font-weight: 650; border-left-color: var(--n-accent);
}
.nav .ico { width: 17px; text-align: center; flex: 0 0 17px; opacity: .85; }
.nav .bascule {
  margin: 8px; padding: 8px 10px; border-radius: var(--n-r);
  background: var(--n-surface-2); border: 1px dashed var(--n-bord-fort);
  font-size: 11.5px; color: var(--n-encre-doux);
}
.nav .bascule strong { display: block; color: var(--n-encre); font-size: 12px; margin-bottom: 4px; }
.nav .bascule button {
  width: 100%; padding: 5px; margin-top: 4px; cursor: pointer;
  border: 1px solid var(--n-bord-fort); border-radius: 3px;
  background: var(--n-surface); color: var(--n-encre); font-size: 11.5px;
}
.nav .bascule button:hover { background: var(--n-accent-2); }
.nav .bascule .ctx { display: block; }
.nav .bascule .l-court { display: none; }

/* ---------- ZONE PRINCIPALE ---------- */
/* flex:1 pour occuper toute la largeur restante ; min-width:0 pour qu'un
   tableau large puisse défiler à l'intérieur au lieu d'élargir la page. */
.zone { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tete {
  background: var(--n-surface); border-bottom: 1px solid var(--n-bord);
  padding: 13px 28px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
}
.tete h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.tete .contexte { color: var(--n-encre-doux); font-size: 12.5px; }
.tete .droite { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Le contenu occupe toute la zone, et n'est bridé qu'au-delà d'un très grand
   écran — le centrage se fait DANS la zone principale, jamais dans la page. */
.corps {
  flex: 1; width: 100%; min-width: 0;
  max-width: 1680px; margin: 0 auto;
  padding: 22px 28px 64px;
}
/* Les écrans de saisie restent plus étroits — lisibilité des formulaires. */
.corps.etroit { max-width: 900px; }

/* ---------- ONGLETS ---------- */
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--n-bord); margin-bottom: 16px; flex-wrap: wrap; }
.onglets button {
  padding: 8px 13px; border: none; background: none; cursor: pointer;
  color: var(--n-encre-doux); font-size: 13px; border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 7px; font-family: inherit;
}
.onglets button:hover { color: var(--n-encre); }
.onglets button.actif { color: var(--n-accent-3); border-bottom-color: var(--n-accent); font-weight: 650; }
.onglets .compteur {
  background: var(--n-bord); color: var(--n-encre-doux);
  border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 600; min-width: 18px; text-align: center;
}
.onglets button.actif .compteur { background: var(--n-accent); color: #fff; }

/* ---------- BOUTONS ---------- */
.b {
  padding: 6px 12px; border: 1px solid var(--n-bord-fort); border-radius: var(--n-r);
  background: var(--n-surface); color: var(--n-encre); font-size: 13px; cursor: pointer;
  font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.b:hover { background: var(--n-surface-2); }
.b.p { background: var(--n-accent); border-color: var(--n-accent); color: #fff; font-weight: 600; }
.b.p:hover { background: var(--n-accent-3); }
.b.off { opacity: .4; cursor: not-allowed; }
.b.mini { padding: 3px 8px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- CHAMPS ---------- */
.ch { padding: 6px 9px; border: 1px solid var(--n-bord-fort); border-radius: var(--n-r);
      background: var(--n-surface); color: var(--n-encre); font-size: 13px; font-family: inherit; }
.rech { min-width: 190px; }
.filtres {
  background: var(--n-surface); border: 1px solid var(--n-bord); border-radius: var(--n-r);
  padding: 12px 14px; margin-bottom: 14px; display: none; gap: 12px; flex-wrap: wrap; align-items: flex-end;
}
.filtres.ouvert { display: flex; }
.filtres label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
                 color: var(--n-encre-doux); margin-bottom: 3px; }

/* ---------- CARTES ET TUILES ---------- */
.carte { background: var(--n-surface); border: 1px solid var(--n-bord); border-radius: var(--n-r); margin-bottom: 16px; }
.carte > header {
  padding: 11px 14px; border-bottom: 1px solid var(--n-bord); font-size: 13px; font-weight: 650;
  display: flex; align-items: center; gap: 10px;
}
.carte > header .droite { margin-left: auto; font-weight: 400; }
.carte > .in { padding: 14px; }
/* Grilles adaptatives : le nombre de colonnes suit la largeur disponible,
   sans point de rupture arbitraire. */
.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.tuile {
  background: var(--n-surface); border: 1px solid var(--n-bord); border-radius: var(--n-r);
  padding: 14px 15px; text-decoration: none; color: inherit; display: block;
}
a.tuile:hover { border-color: var(--n-accent); background: var(--n-accent-2); }
.tuile .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--n-encre-doux); }
.tuile .val { font-size: 27px; font-weight: 650; margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tuile .sub { font-size: 12px; color: var(--n-encre-doux); }

/* ---------- TABLEAUX ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--n-bord); }
th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
     color: var(--n-encre-doux); font-weight: 650; background: var(--n-surface-2); white-space: nowrap; }
tbody tr.clic { cursor: pointer; }
tbody tr.clic:hover { background: var(--n-accent-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.tot td { font-weight: 700; background: var(--n-surface-2); border-top: 2px solid var(--n-bord-fort); }
td .s2 { display: block; font-size: 11.5px; color: var(--n-encre-doux); margin-top: 1px; }

/* ---------- BADGES ---------- */
.bg { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px;
      font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.bg.ok { background: var(--n-ok-2); color: var(--n-ok); border-color: var(--n-ok); }
.bg.at { background: var(--n-attente-2); color: var(--n-attente); border-color: var(--n-attente); }
.bg.al { background: var(--n-alerte-2); color: var(--n-alerte); border-color: var(--n-alerte); }
.bg.ne { background: var(--n-surface-2); color: var(--n-encre-doux); border-color: var(--n-bord-fort); }
.bg.in { background: var(--n-accent-2); color: var(--n-accent-3); border-color: var(--n-accent); }

/* ---------- CALENDRIER PAR RESSOURCE (lignes = professeurs/groupes) ---------- */
.res { border: 1px solid var(--n-bord); border-radius: var(--n-r); overflow-x: auto; background: var(--n-surface); }
.res-grille { display: grid; grid-template-columns: 210px repeat(5, minmax(110px,1fr)) 84px; min-width: 880px; }
.res-th { background: var(--n-surface-2); padding: 8px 10px; font-size: 11.5px; font-weight: 650;
          border-bottom: 1px solid var(--n-bord); border-right: 1px solid var(--n-bord); white-space: nowrap; }
.res-th.jr { text-align: center; }
.res-th.jr small { display: block; font-weight: 400; color: var(--n-encre-doux); font-size: 11px; }
.res-th.tot { text-align: right; }
.res-th:last-child { border-right: none; }
.res-nom { padding: 9px 10px; border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord);
           display: flex; gap: 9px; align-items: flex-start; background: var(--n-surface); }
.res-nom .av { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px; background: var(--n-accent-2);
               color: var(--n-accent-3); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
/* Le nom et le total d'heures doivent s'empiler : sans display:block, les deux
   spans restent en ligne et se chevauchent. */
.res-nom > span:last-child { min-width: 0; }
.res-nom .n { display: block; font-size: 13px; font-weight: 600; line-height: 1.25; }
.res-nom .h { display: block; font-size: 11.5px; color: var(--n-encre-doux); margin-top: 2px; }
.res-c { border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord);
         padding: 3px; display: flex; flex-direction: column; gap: 3px; min-height: 58px; }
.res-t { border-bottom: 1px solid var(--n-bord); padding: 9px 10px; text-align: right;
         font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13px; background: var(--n-surface-2); }
.res-pied { background: var(--n-surface-2); padding: 9px 10px; font-size: 12px; font-weight: 650;
            border-right: 1px solid var(--n-bord); border-top: 2px solid var(--n-bord-fort); }
.res-pied.jr { text-align: center; font-variant-numeric: tabular-nums; }
.res-pied.tot { text-align: right; border-right: none; }
.qt {
  border-left: 3px solid var(--n-accent); background: var(--n-surface);
  border-top: 1px solid var(--n-bord); border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord);
  border-radius: 3px; padding: 4px 7px; font-size: 11px; line-height: 1.3; cursor: pointer;
}
.qt:hover { background: var(--n-accent-2); }
.qt.ind { border-left-color: var(--n-ok); }
.qt.cft { border-left-color: var(--n-alerte); background: var(--n-alerte-2); }
.qt.brl { opacity: .55; border-left-style: dashed; }
.qt b { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.qt span { color: var(--n-encre-doux); display: block; }

/* ---------- CALENDRIER ---------- */
.cal { border: 1px solid var(--n-bord); border-radius: var(--n-r); overflow-x: auto; background: var(--n-surface); }
.cal-grille { display: grid; grid-template-columns: 56px repeat(5, minmax(120px,1fr)); min-width: 660px; }
.cal-th { background: var(--n-surface-2); padding: 8px 6px; font-size: 12px; font-weight: 650;
          text-align: center; border-bottom: 1px solid var(--n-bord); border-right: 1px solid var(--n-bord); }
.cal-th:last-child { border-right: none; }
.cal-th small { display: block; font-weight: 400; color: var(--n-encre-doux); font-size: 11px; }
.cal-h { padding: 4px 7px 0 0; font-size: 11px; color: var(--n-encre-doux); text-align: right;
         border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord);
         background: var(--n-surface-2); height: 52px; }
.cal-c { border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord); padding: 2px; height: 52px; }
.cal-c:nth-child(6n) { border-right: none; }
.sc {
  border-left: 3px solid var(--n-accent); background: var(--n-accent-2);
  border-radius: 3px; padding: 4px 7px; font-size: 11.5px; line-height: 1.3;
  cursor: pointer; height: 100%; overflow: hidden;
}
.sc:hover { filter: brightness(.97); }
.sc.ind { border-left-color: var(--n-ok); background: var(--n-ok-2); }
.sc.cft { border-left-color: var(--n-alerte); background: var(--n-alerte-2); }
.sc.brl { opacity: .6; border-left-style: dashed; }
.sc b { font-weight: 650; display: block; }
.sc span { color: var(--n-encre-doux); }
.cal-mois { display: grid; grid-template-columns: repeat(7, minmax(90px,1fr)); border: 1px solid var(--n-bord);
            border-radius: var(--n-r); overflow-x: auto; background: var(--n-surface); }
.cal-mois .j { border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord);
               min-height: 82px; padding: 5px 6px; font-size: 11.5px; }
.cal-mois .j .n { color: var(--n-encre-doux); font-weight: 650; }
.cal-mois .j.hors { background: var(--n-surface-2); }
.cal-mois .pt { display: block; margin-top: 3px; padding: 2px 5px; border-radius: 3px;
                background: var(--n-accent-2); color: var(--n-accent-3); font-size: 10.5px; }
.cal-jour { border: 1px solid var(--n-bord); border-radius: var(--n-r); overflow: hidden; background: var(--n-surface); }
.cal-jour .ligne { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--n-bord); cursor: pointer; }
.cal-jour .ligne:hover { background: var(--n-accent-2); }
.cal-jour .ligne:last-child { border-bottom: none; }
.cal-jour .hh { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 110px; }

/* ---------- PANNEAU LATÉRAL ---------- */
.voile { position: fixed; inset: 0; background: rgba(22,35,43,.28); z-index: 40; display: none; }
.voile.ouvert { display: block; }
.panneau {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw;
  background: var(--n-surface); border-left: 1px solid var(--n-bord); z-index: 41;
  transform: translateX(100%); transition: transform .16s ease; display: flex; flex-direction: column;
}
.panneau.ouvert { transform: none; }
.panneau header { padding: 14px 16px; border-bottom: 1px solid var(--n-bord); display: flex; align-items: center; gap: 10px; }
.panneau header h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panneau header button { margin-left: auto; border: none; background: none; font-size: 18px;
                         cursor: pointer; color: var(--n-encre-doux); line-height: 1; }
.panneau .in { padding: 16px; overflow-y: auto; flex: 1; }
.panneau dl { margin: 0; display: grid; grid-template-columns: 40% 1fr; gap: 9px 12px; font-size: 13px; }
.panneau dt { color: var(--n-encre-doux); }
.panneau dd { margin: 0; }
.panneau footer { padding: 14px 16px; border-top: 1px solid var(--n-bord); display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- DOCUMENT (aperçu PDF) ---------- */
.doc { background: #fff; color: #16232b; border: 1px solid var(--n-bord-fort);
       border-radius: var(--n-r); padding: 28px 32px; max-width: 700px; font-size: 12.5px; }
.doc h3 { margin: 0 0 3px; font-size: 15px; }
.doc .fil { display: inline-block; border: 1px dashed #c3bcb3; background: #fbf0df; color: #8a5510;
            padding: 3px 9px; font-size: 10.5px; font-weight: 700; margin-bottom: 15px; border-radius: 3px; }
.doc table { font-size: 12px; }
.doc th { background: #f4f2ef; color: #5f6f79; }
.doc th, .doc td { border-bottom: 1px solid #dfdad3; }
.doc tr.tot td { background: #f4f2ef; }

/* ---------- DIVERS ---------- */
.avis { border-left: 3px solid var(--n-accent); background: var(--n-accent-2);
        padding: 9px 13px; border-radius: 0 var(--n-r) var(--n-r) 0; font-size: 12.5px; margin: 12px 0; }
.avis.at { border-left-color: var(--n-attente); background: var(--n-attente-2); }
.avis.al { border-left-color: var(--n-alerte); background: var(--n-alerte-2); }
.doux { color: var(--n-encre-doux); }
.pt2 { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.vide { padding: 40px 20px; text-align: center; color: var(--n-encre-doux); font-size: 13px; }
.fil-etat { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; margin-bottom: 14px; }
.fil-etat .e { padding: 4px 9px; border: 1px solid var(--n-bord-fort); border-radius: var(--n-r); background: var(--n-surface); }
.fil-etat .e.fait { background: var(--n-ok-2); border-color: var(--n-ok); color: var(--n-ok); font-weight: 600; }
.fil-etat .e.cur { background: var(--n-accent-2); border-color: var(--n-accent); color: var(--n-accent-3); font-weight: 700; }
.fil-etat .fl { color: var(--n-encre-doux); }
.ruban {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--n-encre); color: var(--n-fond); text-align: center;
  font-size: 11px; padding: 4px; letter-spacing: .03em;
}
@media (prefers-color-scheme: dark) { .ruban { background: #000; color: #9aa5ac; } }

/* ---------- MODALES ---------- */
.modale-voile { position: fixed; inset: 0; background: rgba(22,35,43,.34); z-index: 60;
                display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modale {
  background: var(--n-surface); border: 1px solid var(--n-bord-fort); border-radius: 7px;
  width: 100%; max-width: 620px; box-shadow: 0 8px 28px rgba(22,35,43,.18);
}
.modale.large { max-width: 880px; }
.modale > header { padding: 15px 18px; border-bottom: 1px solid var(--n-bord); display: flex; align-items: center; gap: 10px; }
.modale > header h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.modale > header .fermer { margin-left: auto; border: none; background: none; font-size: 19px;
                           cursor: pointer; color: var(--n-encre-doux); line-height: 1; padding: 0 4px; }
.modale > .in { padding: 18px; max-height: 68vh; overflow-y: auto; }
.modale > footer { padding: 14px 18px; border-top: 1px solid var(--n-bord);
                   display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.modale > footer .droite { margin-left: auto; display: flex; gap: 8px; }

/* ---------- FORMULAIRES ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 13px; }
.form .plein { grid-column: 1 / -1; }
.form label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
              color: var(--n-encre-doux); margin-bottom: 4px; font-weight: 600; }
.form label .req { color: var(--n-alerte); }
.form input, .form select, .form textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--n-bord-fort); border-radius: var(--n-r);
  background: var(--n-surface); color: var(--n-encre); font-size: 13px; font-family: inherit;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--n-accent); outline-offset: -1px; }
.form textarea { min-height: 62px; resize: vertical; }
.form .aide { font-size: 11.5px; color: var(--n-encre-doux); margin-top: 3px; }
.etapes-form { counter-reset: e; }
.etapes-form > .et { border-left: 2px solid var(--n-bord); padding: 0 0 16px 16px; position: relative; }
.etapes-form > .et:last-child { border-left-color: transparent; padding-bottom: 0; }
.etapes-form > .et::before {
  counter-increment: e; content: counter(e);
  position: absolute; left: -11px; top: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--n-accent); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.etapes-form > .et > h4 { margin: 0 0 8px; font-size: 12.5px; font-weight: 650; }
.choix { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px;
         border: 1px solid var(--n-bord); border-radius: var(--n-r); margin-bottom: 6px; cursor: pointer; }
.choix:hover { background: var(--n-surface-2); }
.choix.off { opacity: .55; cursor: not-allowed; }
.choix input { width: auto; margin-top: 2px; flex: 0 0 auto; }
.choix .t { font-size: 13px; font-weight: 600; }
.choix .s { font-size: 11.5px; color: var(--n-encre-doux); display: block; margin-top: 1px; }
.bascule-ligne { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px;
                 background: var(--n-surface-2); border: 1px solid var(--n-bord); border-radius: var(--n-r); }
.bascule-ligne input { width: auto; margin-top: 2px; }

/* ---------- MESSAGES ---------- */
/* La pile de messages flotte au-dessus des modales : sans pointer-events:none,
   un message couvre les boutons d'une modale et intercepte le clic. */
.pile-msg { position: fixed; right: 18px; bottom: 42px; z-index: 80; display: flex;
            flex-direction: column; gap: 8px; max-width: 380px; pointer-events: none; }
.msg { background: var(--n-surface); border: 1px solid var(--n-bord-fort); border-left-width: 4px;
       border-radius: var(--n-r); padding: 10px 13px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(22,35,43,.14); }
.msg.ok { border-left-color: var(--n-ok); }
.msg.at { border-left-color: var(--n-attente); }
.msg.al { border-left-color: var(--n-alerte); }
.msg b { display: block; margin-bottom: 2px; }

/* ---------- MENU CONTEXTUEL ---------- */
.menu-hote { position: relative; display: inline-block; }
.menu-pts { border: 1px solid var(--n-bord-fort); background: var(--n-surface); border-radius: var(--n-r);
            cursor: pointer; padding: 2px 8px; font-size: 15px; line-height: 1.1; color: var(--n-encre-doux); }
.menu-pts:hover { background: var(--n-surface-2); color: var(--n-encre); }
.menu {
  position: absolute; right: 0; top: calc(100% + 3px); z-index: 25; min-width: 205px;
  background: var(--n-surface); border: 1px solid var(--n-bord-fort); border-radius: var(--n-r);
  box-shadow: 0 5px 18px rgba(22,35,43,.16); padding: 5px; display: none;
}
.menu.ouvert { display: block; }
.menu button { display: block; width: 100%; text-align: left; border: none; background: none;
               padding: 7px 10px; border-radius: 3px; cursor: pointer; font-size: 13px;
               color: var(--n-encre); font-family: inherit; }
.menu button:hover { background: var(--n-accent-2); color: var(--n-accent-3); }
.menu hr { border: none; border-top: 1px solid var(--n-bord); margin: 4px 0; }

/* ---------- FIL D'ARIANE ---------- */
.fil-ariane { display: flex; gap: 6px; align-items: center; font-size: 12.5px;
              color: var(--n-encre-doux); margin-bottom: 12px; flex-wrap: wrap; }
.fil-ariane a { text-decoration: none; }
.fil-ariane a:hover { text-decoration: underline; }
.fil-ariane .sep { opacity: .6; }

/* ---------- APERÇU DE RAPPORT ---------- */
.apercu { border: 1px solid var(--n-bord-fort); border-radius: var(--n-r); background: var(--n-surface); }
.apercu > header { padding: 14px 16px; border-bottom: 1px solid var(--n-bord); background: var(--n-surface-2); }
.apercu > header h3 { margin: 0 0 3px; font-size: 15px; }
.apercu > header .meta { font-size: 12px; color: var(--n-encre-doux); }
.apercu > .in { padding: 0; }
.cible-focus { outline: 2px solid var(--n-accent); outline-offset: 3px; border-radius: var(--n-r); }

/* ---------- RESPONSIVE ---------- */

/* Sous 1200 px : la barre latérale se réduit aux icônes, la zone de travail
   récupère 165 px. Le libellé reste accessible en info-bulle. */
@media (max-width: 1200px) {
  :root { --nav-l: 58px; }
  .nav .marque { padding: 14px 0; justify-content: center; }
  .nav .marque span:not(.sceau) { display: none; }
  .nav a.item { justify-content: center; padding: 10px 0; gap: 0; border-left-width: 2px; }
  .nav a.item .lbl { display: none; }
  .nav .bascule { margin: 6px 5px; padding: 5px 3px; border-style: solid; }
  .nav .bascule strong, .nav .bascule .ctx { display: none; }
  .nav .bascule .l-long { display: none; }
  .nav .bascule .l-court { display: inline; }
  .nav .bascule button { font-size: 11px; padding: 5px 2px; margin-top: 0; }
  .corps, .tete { padding-left: 18px; padding-right: 18px; }
}

/* Sous 820 px : la navigation passe en barre horizontale au-dessus du contenu. */
@media (max-width: 820px) {
  #app { flex-direction: column; }
  .nav {
    width: 100%; flex: 0 0 auto; height: auto;
    position: sticky; top: 0; align-self: stretch; z-index: 20;
    flex-direction: row; align-items: center;
    border-right: none; border-bottom: 1px solid var(--n-bord);
    overflow-x: auto;
  }
  .nav .marque { border-bottom: none; padding: 10px 12px; }
  .nav .liens { display: flex; flex: 1; padding: 6px; overflow-x: auto; }
  .nav .pied { display: flex; border-top: none; padding: 6px; }
  .nav a.item { margin-bottom: 0; border-left: none; border-bottom: 2px solid transparent; }
  .nav a.item.actif { border-left: none; border-bottom-color: var(--n-accent); }
  .nav .bascule { margin: 6px; flex: 0 0 auto; align-self: center; padding: 4px 6px; }
  .nav .bascule button { width: auto; white-space: nowrap; }
  .tete { position: static; padding: 12px 16px; }
  /* Le ruban passe sur deux lignes en dessous de 820 px : réserve davantage. */
  .corps { padding: 16px 16px 80px; }
  .panneau { width: 100%; }
  .tuile .val { font-size: 23px; }
}

/* Sous 560 px : densité réduite. */
@media (max-width: 560px) {
  .corps { padding: 12px 12px 60px; }
  .tete h1 { font-size: 16px; }
  .b { padding: 5px 10px; font-size: 12.5px; }
  .ch.rech { min-width: 130px; }
}

@media print {
  .nav, .ruban, .actions, .onglets { display: none; }
  #app { display: block; }
  .corps { max-width: none; padding: 0; }
  .doc { border: none; padding: 0; }
}

/* ============================================================
   HORAIRES ÉTENDUS : grille hebdomadaire, séries, gestes
   ============================================================ */

.masque { display: none !important; }
.calcul { font: 600 16px/1.5 inherit; color: var(--n-accent); padding: 8px 0; }
.calcul .err { color: var(--n-alerte); }
.lab-plat { margin: 0; text-transform: none; letter-spacing: 0; font-size: 13px; color: inherit; }
.preregl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.preregl .doux { font-size: 12px; }
kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--n-fond); border: 1px solid var(--n-bord);
      border-bottom-width: 2px; border-radius: 4px; padding: 3px 5px; }

/* --- Grille de sélection : plages × jours --- */
.grille-hebdo { display: grid; grid-template-columns: 150px repeat(7, minmax(44px, 1fr));
  border: 1px solid var(--n-bord); border-radius: var(--n-r); overflow: hidden; background: var(--n-surface); }
.gh-th { background: var(--n-fond); padding: 8px 6px; text-align: center;
  font: 600 11px/1.3 inherit; text-transform: uppercase; letter-spacing: .04em;
  color: var(--n-encre-doux); border-bottom: 1px solid var(--n-bord); }
.gh-th:first-child { text-align: left; padding-left: 12px; }
.gh-th.we, .gh-c.we { background: var(--n-surface-2); }
.gh-lib { padding: 9px 12px; border-top: 1px solid var(--n-bord); display: flex;
  flex-direction: column; gap: 1px; font-size: 13px; }
.gh-lib .mono { font-size: 11px; }
.gh-c { border-top: 1px solid var(--n-bord); border-left: 1px solid var(--n-bord);
  display: flex; align-items: center; justify-content: center; padding: 6px 0; }
.gh-c label { margin: 0; cursor: pointer; display: block; }
.gh-c input { position: absolute; opacity: 0; width: 0; height: 0; }
.gh-case { display: block; width: 20px; height: 20px; border: 1.5px solid var(--n-bord);
  border-radius: 5px; background: var(--n-surface); transition: .12s; }
.gh-c label:hover .gh-case { border-color: var(--n-accent); }
.gh-c input:checked + .gh-case { background: var(--n-accent); border-color: var(--n-accent);
  box-shadow: inset 0 0 0 3px var(--n-surface); }
.gh-c input:focus-visible + .gh-case { outline: 2px solid var(--n-accent); outline-offset: 2px; }

/* --- Plages retenues --- */
.plages-ret { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.pl-ligne { display: grid; gap: 8px 10px; align-items: end; padding: 10px 12px;
  grid-template-columns: 130px repeat(2, 96px) 72px 110px 1fr 1fr 32px;
  border: 1px solid var(--n-bord); border-radius: var(--n-r); background: var(--n-surface); }
.pl-ligne.err { border-color: var(--n-alerte); background: var(--n-alerte-2); }
.pl-ligne label { font-size: 10px; margin-bottom: 3px; }
.pl-ligne .ch { padding: 6px 8px; font-size: 13px; }
.pl-ligne .calcul { font-size: 13px; padding: 5px 0; }
.pl-jour { display: flex; flex-direction: column; gap: 1px; padding-bottom: 5px; }
.pl-jour .doux { font-size: 11px; }
.pl-x { padding-bottom: 2px; }
.pl-err { grid-column: 1 / -1; font-size: 12px; color: var(--n-alerte); }

/* --- Résumé et occurrences d'une série --- */
.resume-serie { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  background: var(--n-surface); border: 1px solid var(--n-bord);
  border-radius: var(--n-r); overflow: hidden; margin-bottom: 14px; }
.rs { padding: 9px 12px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--n-bord); border-bottom: 1px solid var(--n-bord); }
.rs-l { font: 600 10px/1.3 inherit; text-transform: uppercase;
  letter-spacing: .05em; color: var(--n-encre-doux); }
.rs-v { font-size: 13px; line-height: 1.45; }
.occ-liste { max-height: 340px; overflow: auto; border: 1px solid var(--n-bord); border-radius: var(--n-r); }
.occ-liste table { font-size: 12.5px; }
.occ-liste thead th { position: sticky; top: 0; z-index: 1; }
.occ-liste tr.exclue td { opacity: .45; text-decoration: line-through; }
.occ-liste tr.exclue td:first-child { text-decoration: none; opacity: 1; }
.occ-liste tr.en-conflit { background: var(--n-alerte-2); }
.mini-case { margin: 0; display: block; }

/* --- Portée d'une action sur une série --- */
.portee { border: 1px solid var(--n-accent); border-radius: var(--n-r);
  padding: 12px 14px; margin-bottom: 16px; background: var(--n-accent-2); }
.portee-t { font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
.avance { border: 1px solid var(--n-bord); border-radius: var(--n-r); padding: 10px 14px; background: var(--n-surface); }
.avance summary { cursor: pointer; font: 600 13px/1.4 inherit; }
.cmd-liste { display: flex; flex-direction: column; gap: 8px; }
.cmd-liste .b { justify-content: flex-start; text-align: left; }

/* --- Calendrier en grille : heures × jours --- */
.gcal { display: grid; grid-template-columns: 62px repeat(7, minmax(0, 1fr));
  border: 1px solid var(--n-bord); border-radius: var(--n-r);
  background: var(--n-surface); overflow: hidden; user-select: none; }
.gc-th { background: var(--n-fond); border-bottom: 1px solid var(--n-bord); padding: 8px 6px;
  text-align: center; font: 600 12px/1.3 inherit; }
.gc-th small { display: block; font-weight: 400; font-size: 10.5px; color: var(--n-encre-doux); }
.gc-th.we, .gc-col.we { background: var(--n-surface-2); }
.gc-heures { position: relative; height: var(--gh-haut); border-right: 1px solid var(--n-bord); }
.gc-h { height: var(--gh-px); position: relative; }
.gc-h span { position: absolute; top: -7px; right: 8px; font: 500 10.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--n-encre-doux); }
.gc-col { position: relative; height: var(--gh-haut); border-left: 1px solid var(--n-bord); cursor: crosshair; }
.gc-ligne { position: absolute; left: 0; right: 0; height: 1px; background: var(--n-bord); pointer-events: none; }
.gc-carte { position: absolute; overflow: hidden; cursor: grab;
  background: var(--n-accent-2); border-left: 3px solid var(--n-accent);
  border-radius: 5px; padding: 4px 6px; font-size: 11.5px; line-height: 1.3; }
.gc-carte b { display: block; font: 600 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.gc-carte span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-carte.ind { background: var(--n-ok-2); border-left-color: var(--n-ok); }
.gc-carte.cft { background: var(--n-alerte-2); border-left-color: var(--n-alerte); }
.gc-carte.brl { border-left-style: dotted; }
.gc-carte.serie { box-shadow: inset -3px 0 0 var(--n-accent); }
.gc-carte.en-geste { opacity: .35; }
.gc-duree { position: absolute; right: 6px; bottom: 3px; font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--n-encre-doux); }
.gc-cmd { position: absolute; right: 2px; top: 2px; }
.gc-cmd button { border: 0; background: var(--n-surface); border-radius: 4px;
  cursor: pointer; font-size: 12px; line-height: 1; padding: 2px 4px; color: var(--n-encre-doux); }
.gc-cmd button:hover { background: var(--n-surface); color: var(--n-encre); }
.poignee { position: absolute; left: 0; right: 0; height: 7px; cursor: ns-resize; z-index: 2; }
.poignee.haut { top: 0; } .poignee.bas { bottom: 0; }
.poignee:hover { background: var(--n-accent); opacity: .35; }
.gc-fantome { position: absolute; left: 3px; right: 3px; z-index: 3; pointer-events: none;
  background: var(--n-accent-2); border: 1.5px dashed var(--n-accent);
  border-radius: 5px; padding: 4px 6px; font-size: 11px; line-height: 1.3; }
.gc-fantome b { display: block; font: 600 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.gc-fantome span { display: block; }
.gc-fantome.cft { background: var(--n-alerte-2); border-color: var(--n-alerte); }
.cft-t { color: var(--n-alerte); font-weight: 600; }
.res-th.jr.we { background: var(--n-surface-2); }

@media (max-width: 1000px) {
  .pl-ligne { grid-template-columns: 1fr 1fr; }
  .pl-jour { grid-column: 1 / -1; }
  .grille-hebdo { grid-template-columns: 108px repeat(7, minmax(32px, 1fr)); font-size: 12px; }
  .gh-lib { padding: 8px; }
}
/* Repli compact : masqué tant que la grille est utilisable. */
.gcal-compact, .seul-etroit { display: none; }
.gcc-jour { border: 1px solid var(--n-bord); border-radius: var(--n-r);
  background: var(--n-surface); margin-bottom: 10px; overflow: hidden; }
.gcc-jour > header { background: var(--n-surface-2); border-bottom: 1px solid var(--n-bord);
  padding: 8px 12px; font: 600 13px/1.4 inherit; display: flex; }
.gcc-jour > header .droite { margin-left: auto; color: var(--n-encre-doux); }
.gcc-l { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  padding: 9px 12px; border-top: 1px solid var(--n-bord); cursor: pointer; }
.gcc-jour > .gcc-l:first-of-type { border-top: 0; }
.gcc-l:hover { background: var(--n-surface-2); }
.gcc-n { flex: 1 1 150px; min-width: 0; font-size: 13px; }
.gcc-a { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .gcal, .seul-large { display: none; }
  .gcal-compact, .seul-etroit { display: block; }
  .resume-serie { grid-template-columns: 1fr; }
  .grille-hebdo { grid-template-columns: 90px repeat(7, minmax(28px, 1fr)); }
  .gh-lib { font-size: 11px; padding: 7px 6px; }
  .gh-lib .mono { display: none; }
}

/* ============================================================
   CONFIRMATION HEBDOMADAIRE ET RELEVÉ MENSUEL
   ============================================================ */

/* --- Les cinq natures d'heures --- */
.natures { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  border: 1px solid var(--n-bord); border-radius: var(--n-r); overflow: hidden;
  background: var(--n-surface); margin-bottom: 14px; }
.nt { padding: 11px 13px; border-right: 1px solid var(--n-bord);
  border-bottom: 1px solid var(--n-bord); display: flex; flex-direction: column; gap: 3px; }
.nt-c { font: 700 10px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em; color: var(--n-accent-3); background: var(--n-accent-2);
  border: 1px solid var(--n-accent); border-radius: 9px; padding: 1px 7px; align-self: flex-start; }
.nt-l { font: 600 12px/1.35 inherit; }
.nt-v { font: 650 22px/1.2 inherit; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; margin: 2px 0; }
.nt-d { font-size: 11px; line-height: 1.4; color: var(--n-encre-doux); }

/* --- Suivi hebdomadaire et écarts --- */
/* Sans plancher, la colonne « Professeur » se comprime à deux mots par ligne
   sur petit écran : le tableau défile déjà dans son cadre, autant le laisser. */
.tbl-suivi td:first-child, .tbl-suivi th:first-child { min-width: 200px; }
.tbl-suivi td:last-child { min-width: 120px; }
tbody tr.ecart td { background: var(--n-attente-2); }
tbody tr.exclue-rel td { opacity: .62; }
.pastille { display: inline-block; min-width: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--n-alerte); color: #fff; font: 700 10.5px/17px inherit; text-align: center; }

/* --- Formulaire de confirmation du professeur --- */
.conf-lignes { display: flex; flex-direction: column; gap: 12px; }
.conf-l { border: 1px solid var(--n-bord); border-left: 3px solid var(--n-bord-fort);
  border-radius: var(--n-r); padding: 12px 14px; background: var(--n-surface-2); }
.conf-l.ecart { border-left-color: var(--n-attente); background: var(--n-attente-2); }
.conf-t { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 10px; }
.conf-t strong { font-size: 13.5px; }
.conf-t .doux { font-size: 12px; }
.conf-err:empty { display: none; }
.conf-err .avis { margin-bottom: 0; }

/* --- Listes de définition sur deux colonnes --- */
.dl2 { display: grid; grid-template-columns: 34% 1fr; gap: 9px 12px; margin: 0; font-size: 13px; }
.dl2 dd { margin: 0; }

/* --- Notifications --- */
.notifs { display: flex; flex-direction: column; gap: 9px; }
.notif { border: 1px solid var(--n-bord); border-left: 3px solid var(--n-bord-fort);
  border-radius: var(--n-r); padding: 10px 13px; background: var(--n-surface); }
.notif.neuf { border-left-color: var(--n-accent); background: var(--n-accent-2); }
.nf-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 5px; }
.nf-t { font-size: 13px; }

/* --- Relevé imprimable --- */
.doc-releve { max-width: 780px; }
.doc-releve .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-releve th { text-align: left; }

@media print {
  .seul-ecran, .fil-ariane, .natures { display: none; }
  .doc-releve { max-width: none; }
  /* Les tableaux du document défilent à l'écran étroit. À l'impression, un cadre
     à défilement se réduirait à sa partie visible : on le rend transparent pour
     que le tableau s'imprime en entier. */
  .doc .tbl-wrap { overflow: visible; }
}

@media (max-width: 820px) {
  .natures { grid-template-columns: 1fr; }
  .dl2 { grid-template-columns: 1fr; gap: 2px 0; }
  .dl2 dt { margin-top: 8px; }
  /* Sur écran étroit, sans largeur plancher le navigateur comprime la colonne
     des définitions jusqu'à deux caractères par ligne. On lui garde une largeur
     lisible et c'est le cadre qui défile — aucune colonne n'est masquée. */
  .doc .tbl-wrap > table.tbl-doc { min-width: 520px; }
}
