/* Classeur QSE
   Concept : un registre de suivi. Dates en plaques à gauche, une seule pièce forte :
   le panneau jaune de la prochaine échéance, aux couleurs de sécurité ISO 3864. */
:root {
  --papier: #eef2f0;
  --surface: #ffffff;
  --encre: #13201d;
  --doux: #52605b;
  --trait: #d3dbd7;
  --accent: #005387;
  --accent-encre: #ffffff;
  --accent-fond: #dcebf4;
  --alerte: #a8231b;
  --alerte-fond: #fbe4e1;
  --vigilance: #7a5200;
  --vigilance-fond: #fdf0cf;
  --ok: #1d6e46;
  --panneau: #f9a800;
  --panneau-encre: #111111;
  --ombre: 0 18px 50px rgba(19, 32, 29, .22);
  --titre: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  --texte: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #0e1513;
    --surface: #17201d;
    --encre: #e8eeeb;
    --doux: #9dada7;
    --trait: #2c3733;
    --accent: #79bdec;
    --accent-encre: #06243a;
    --accent-fond: #132b3b;
    --alerte: #f29488;
    --alerte-fond: #3a1a17;
    --vigilance: #f4c25b;
    --vigilance-fond: #352a10;
    --ok: #66c896;
    --ombre: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #0e1513;
  --surface: #17201d;
  --encre: #e8eeeb;
  --doux: #9dada7;
  --trait: #2c3733;
  --accent: #79bdec;
  --accent-encre: #06243a;
  --accent-fond: #132b3b;
  --alerte: #f29488;
  --alerte-fond: #3a1a17;
  --vigilance: #f4c25b;
  --vigilance-fond: #352a10;
  --ok: #66c896;
  --ombre: 0 18px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 400 16px/1.5 var(--texte);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 {
  font-family: var(--titre);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* En-tête */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--surface);
}
.barre {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--trait);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.barre-in {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
  padding-block: 10px;
}
.marque {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--encre);
  text-decoration: none;
  white-space: nowrap;
}
.marque small {
  font-family: var(--texte);
  font-weight: 500;
  font-size: .78rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--doux);
  margin-left: 6px;
}
.onglets { display: flex; gap: 4px; flex: 1 1 auto; }
.onglets a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--doux);
  font-weight: 600;
  text-decoration: none;
}
.onglets a:hover { color: var(--encre); background: var(--papier); }
.onglets a[aria-current="page"] { color: var(--accent-encre); background: var(--accent); }
.moi { display: flex; gap: 4px; align-items: center; margin-left: auto; }
@media (max-width: 560px) {
  .barre-in { gap: 2px 12px; padding-block: 6px 8px; }
  .onglets { order: 3; flex: 1 1 100%; }
  .marque small { display: none; }
}

/* Pages */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding-block: 24px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 28px;
}
.colonnes { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .colonnes { grid-template-columns: minmax(0, 1fr) 310px; }
  .colonnes.egales { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.pile { display: grid; gap: 28px; min-width: 0; }
.bandeau {
  background: var(--accent-fond);
  color: var(--encre);
  padding-block: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  font-size: .9rem;
  text-align: center;
}

/* Le panneau de la prochaine échéance */
.panneau {
  background: var(--panneau);
  color: var(--panneau-encre);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 28px;
  padding: 26px 24px 20px;
  position: relative;
}
.panneau::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 9px;
  background: repeating-linear-gradient(-45deg, #111111 0 12px, #f9a800 12px 24px);
}
.panneau-j {
  font-family: var(--titre);
  font-weight: 700;
  font-size: clamp(4.2rem, 13vw, 7.4rem);
  line-height: .9;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.panneau-j.mot { font-size: clamp(2.8rem, 9vw, 4.6rem); }
.panneau-txt { min-width: 0; display: grid; gap: 4px; }
.panneau .surtitre { color: var(--panneau-encre); }
.panneau h2 { font-size: clamp(1.5rem, 3.6vw, 2.15rem); }
.panneau a { color: var(--panneau-encre); font-weight: 600; }
@media (max-width: 460px) {
  .panneau { grid-template-columns: minmax(0, 1fr); }
}

.surtitre {
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--doux);
}
.section-tete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-tete h2 { font-size: 1.6rem; }
.page-tete { display: grid; gap: 6px; }
.page-tete h1 { font-size: clamp(2rem, 5vw, 2.9rem); }
.page-tete .actions { margin-top: 8px; }
.discret { color: var(--doux); }
.petit { font-size: .86rem; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid var(--trait);
  background: var(--surface);
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--encre);
}
.btn:hover { border-color: var(--doux); }
.btn.fort { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); }
.btn.fort:hover { filter: brightness(1.1); }
.btn.alerte { color: var(--alerte); border-color: var(--alerte); background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }
.lien {
  background: none;
  border: 0;
  padding: 6px 8px;
  min-height: 36px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}
.lien:hover { background: var(--accent-fond); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Filtres */
.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.filtre {
  border: 1px solid var(--trait);
  background: transparent;
  border-radius: 999px;
  padding: 5px 12px;
  min-height: 34px;
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
  color: var(--doux);
}
.filtre[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: var(--papier); }

/* Lignes du registre */
.mois {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: capitalize;
  padding: 18px 0 6px;
}
.mois:first-child { padding-top: 0; }
.registre { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ligne {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
  text-decoration: none;
}
a.ligne:hover { border-color: var(--accent); }
.ligne.passee { opacity: .62; }
.plaque { display: grid; justify-items: center; line-height: 1; }
.plaque b { font-family: var(--titre); font-size: 1.85rem; font-weight: 700; }
.plaque span { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); }
.ligne-txt { min-width: 0; display: grid; gap: 2px; }
.ligne-titre { font-weight: 600; overflow-wrap: anywhere; }
.ligne-sous { font-size: .9rem; color: var(--doux); overflow-wrap: anywhere; }
.ligne-fin { display: flex; align-items: center; gap: 6px; justify-self: end; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
@media (max-width: 520px) {
  .ligne { grid-template-columns: 48px minmax(0, 1fr); }
  .ligne-fin { grid-column: 2; justify-self: start; }
}

.tag {
  display: inline-block;
  font-size: .74rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--trait);
  color: var(--doux);
  white-space: nowrap;
}
.tag.examen { background: var(--encre); border-color: var(--encre); color: var(--papier); }
.tag.oral { border-color: var(--accent); color: var(--accent); }
.tag.rendu { background: var(--accent-fond); border-color: transparent; color: var(--accent); }
.tag.confirmer { background: var(--vigilance-fond); border-color: transparent; color: var(--vigilance); }

.j {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 2px 9px;
  border-radius: 5px;
  background: var(--papier);
  color: var(--doux);
  white-space: nowrap;
}
.j.proche { background: var(--vigilance-fond); color: var(--vigilance); }
.j.urgent { background: var(--alerte-fond); color: var(--alerte); }

/* Matières */
.recherche { width: 100%; }
.groupe-ue { display: grid; gap: 8px; }
.groupe-ue h2 { font-size: 1.3rem; }
.ue-ects { font-family: var(--texte); font-size: .84rem; font-weight: 500; color: var(--doux); margin-left: 6px; white-space: nowrap; }
.ligne.matiere { grid-template-columns: minmax(0, 1fr) auto; }
.compte { font-size: .86rem; color: var(--doux); white-space: nowrap; }
@media (max-width: 520px) {
  .ligne.matiere { grid-template-columns: minmax(0, 1fr); }
  .ligne.matiere .ligne-fin { grid-column: 1; }
}

/* Cours */
.fichier {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: 10px 12px;
}
.fichier button.ouvrir, .fichier a.ouvrir {
  all: unset;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.fichier button.ouvrir:focus-visible, .fichier a.ouvrir:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.depot {
  border: 2px dashed var(--trait);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  color: var(--doux);
  font-size: .92rem;
}
.depot.survol { border-color: var(--accent); background: var(--accent-fond); color: var(--encre); }

/* Vides, erreurs */
.vide {
  border: 1px dashed var(--trait);
  border-radius: 8px;
  padding: 16px;
  color: var(--doux);
  font-size: .94rem;
}
.erreur-page { display: grid; gap: 12px; max-width: 560px; margin: 12vh auto 0; padding: 0 16px; }
.erreur-page h1 { font-size: 2rem; }

/* Connexion */
.connexion {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-block: 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.connexion form { width: 100%; max-width: 400px; display: grid; gap: 16px; }
.connexion .panneau { padding: 26px 22px 18px; display: block; }
.connexion h1 { font-size: 2.7rem; text-transform: uppercase; }

/* Formulaires et fenêtres */
.champ { display: grid; gap: 4px; min-width: 0; }
.champ label, .champ .legende { font-weight: 600; font-size: .9rem; }
.aide { font-size: .82rem; color: var(--doux); }
input[type="text"], input[type="url"], input[type="date"], input[type="number"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--doux);
  border-radius: 6px;
  background: var(--surface);
  color: var(--encre);
}
input[type="file"] { width: 100%; font-size: .92rem; }
textarea { min-height: 76px; resize: vertical; }
.coche { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.formulaire { display: grid; gap: 14px; }
.msg-erreur { color: var(--alerte); font-weight: 500; }
.choix { display: flex; gap: 8px; flex-wrap: wrap; }
.choix label {
  flex: 1 1 120px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--trait);
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
}
dialog {
  border: 1px solid var(--trait);
  border-radius: 10px;
  padding: 20px;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  background: var(--surface);
  color: var(--encre);
  box-shadow: var(--ombre);
}
dialog::backdrop { background: rgba(10, 18, 16, .55); }
dialog h2 { font-size: 1.6rem; margin-bottom: 14px; }
.pied-fenetre { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 2px; }
.pied-fenetre .droite { display: flex; gap: 8px; margin-left: auto; }

#annonce {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 32px);
  background: var(--encre);
  color: var(--papier);
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 500;
  box-shadow: var(--ombre);
}

.pied {
  border-top: 1px solid var(--trait);
  padding-top: 14px;
  color: var(--doux);
  font-size: .84rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
}

@media (prefers-reduced-motion: no-preference) {
  .ligne { transition: border-color .12s ease; }
}
