/* ------------------------------------------------------------------
   Emploi du temps — feuille de style unique.
   Style « signalétique » : blanc franc, condensée, une couleur par niveau.
   ------------------------------------------------------------------ */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #0B0B0B;
  --muted: #6E6E6E;
  --label: #8A8A8A;
  --border: #E4E4E4;
  --dim: #C4C4C4;

  --n5: #31869B;  --n5-ink: #FFFFFF;
  --n4: #7030A0;  --n4-ink: #FFFFFF;
  --n3: #FF9900;  --n3-ink: #2B1900;
  --task: #92D050; --task-ink: #0B0B0B;

  --btn-bg: #0B0B0B;
  --btn-ink: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #0D0D0D;
    --surface: #131313;
    --ink: #FFFFFF;
    --muted: #9A9A9A;
    --label: #7A7A7A;
    --border: #2E2E2E;
    --dim: #4A4A4A;

    --n5: #58B6CE;  --n5-ink: #04252E;
    --n4: #A96AD8;  --n4-ink: #24063A;
    --n3: #FFAB33;  --n3-ink: #2E1A00;

    --btn-bg: #FFFFFF;
    --btn-ink: #0D0D0D;
  }
}

:root[data-theme="sombre"] {
  --bg: #0D0D0D;
  --surface: #131313;
  --ink: #FFFFFF;
  --muted: #9A9A9A;
  --label: #7A7A7A;
  --border: #2E2E2E;
  --dim: #4A4A4A;

  --n5: #58B6CE;  --n5-ink: #04252E;
  --n4: #A96AD8;  --n4-ink: #24063A;
  --n3: #FFAB33;  --n3-ink: #2E1A00;

  --btn-bg: #FFFFFF;
  --btn-ink: #0D0D0D;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: var(--n4); }

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

.ecran { display: none; flex: 1; flex-direction: column; }
.ecran.actif { display: flex; }

/* --- typographie --- */
.condensed { font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-weight: 400; }
.label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--label);
}

/* --- en-tête --- */
.entete {
  padding: 14px 18px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.entete h1 {
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif;
  font-size: 36px; font-weight: 400; line-height: 0.92; margin: 0;
  text-transform: uppercase;
}
.entete-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pastille {
  background: var(--ink); color: var(--bg);
  padding: 4px 9px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
}
.bouton-icone {
  width: 44px; height: 44px; border: 2px solid var(--ink); background: none;
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}

/* --- barre des jours --- */
.jours { display: flex; gap: 4px; padding: 14px 18px 0; }
.jour {
  flex: 1; height: 56px; border: 2px solid var(--border); background: none;
  color: var(--muted); font-family: inherit; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.jour small { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.jour b {
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif;
  font-size: 24px; font-weight: 400; line-height: 1;
}
.jour.actif { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.jour.auj:not(.actif) { border-color: var(--ink); color: var(--ink); }

/* --- bandeau du cours --- */
.bandeau {
  margin: 18px 18px 0; padding: 16px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
  border: none; width: calc(100% - 36px); text-align: left;
  font-family: inherit; cursor: pointer;
}
.bandeau.neutre {
  background: none; border: 2px dashed var(--border); color: var(--muted);
  cursor: default; align-items: center; text-align: center;
}
.bandeau-haut { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bandeau-haut .label { color: inherit; opacity: 1; }
.bandeau-reste { font-size: 12px; font-weight: 600; opacity: 0.75; }
.bandeau-corps { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.bandeau-classe {
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif;
  font-size: 58px; line-height: 0.82;
}
.bandeau-droite { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.bandeau-salle { font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-size: 32px; line-height: 0.9; }
.bandeau-creneau { font-size: 12px; font-weight: 700; opacity: 0.8; }
.jauge { height: 4px; background: rgba(0, 0, 0, 0.22); }
.jauge span { display: block; height: 4px; background: currentColor; }
.bandeau-bas { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }

/* --- liste des créneaux --- */
.liste { padding: 20px 18px 0; display: flex; flex-direction: column; gap: 8px; }
.liste .label + * { margin-top: 0; }

.ligne {
  display: flex; align-items: stretch; gap: 10px;
  background: none; border: none; padding: 0; width: 100%;
  font-family: inherit; color: inherit; text-align: left; cursor: pointer;
}
.ligne-code {
  width: 46px; flex-shrink: 0; display: flex; flex-direction: column;
  justify-content: center; gap: 2px;
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif;
  font-size: 25px; line-height: 1;
}
.ligne-code em { font-family: 'Archivo', sans-serif; font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: 0.09em; }
.ligne-bloc {
  width: 54px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-size: 26px; line-height: 1;
  padding: 12px 4px;
}
.ligne-corps {
  flex: 1; border: 2px solid var(--border); border-left: none;
  padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; gap: 3px;
  min-height: 56px;
}
.ligne-titre { font-size: 13px; font-weight: 600; }
.ligne-detail { font-size: 12px; color: var(--muted); }
.ligne.passe { opacity: 0.42; }
.ligne.libre { cursor: default; }
.ligne.libre .ligne-code { color: var(--dim); }
.ligne.libre .ligne-vide { flex: 1; height: 48px; border: 2px dashed var(--border); }

.puce {
  background: var(--ink); color: var(--bg);
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 5px;
  display: inline-block;
}

.separateur { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.separateur i { flex: 1; height: 2px; background: var(--border); }
.separateur span { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--dim); }

/* niveaux */
.n5 { background: var(--n5); color: var(--n5-ink); }
.n4 { background: var(--n4); color: var(--n4-ink); }
.n3 { background: var(--n3); color: var(--n3-ink); }

/* --- barre d'onglets --- */
.onglets {
  margin-top: auto; position: sticky; bottom: 0;
  display: flex; background: var(--bg);
  border-top: 2px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.onglet {
  flex: 1; min-height: 68px; background: none; border: none; color: var(--dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  cursor: pointer; text-transform: uppercase;
}
.onglet.actif { color: var(--ink); font-weight: 700; }

/* --- écrans secondaires --- */
.barre-haut {
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px;
}
.barre-haut .titre { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.lien-texte {
  background: none; border: none; color: var(--label); font-family: inherit;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; cursor: pointer; padding: 12px 2px;
  text-transform: uppercase;
}
.contenu { flex: 1; padding: 0 18px 24px; display: flex; flex-direction: column; gap: 22px; }
.bloc { display: flex; flex-direction: column; gap: 10px; }

.barres { display: flex; gap: 4px; }
.barres i { flex: 1; height: 6px; background: var(--border); }
.barres i.faite { background: var(--ink); }

.encadre { background: var(--surface); border: 2px solid var(--border); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.encadre p { margin: 0; font-size: 14px; line-height: 1.4; }

/* --- formulaires --- */
.choix { display: flex; gap: 6px; }
.choix button {
  flex: 1; min-height: 62px; border: 2px solid var(--border); background: none;
  color: var(--muted); font-family: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: 0.05em; line-height: 1.3; cursor: pointer; text-transform: uppercase;
}
.choix button.actif { background: var(--ink); border-color: var(--ink); color: var(--bg); }

textarea, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 2px solid var(--ink); padding: 12px 14px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible { outline: 3px solid var(--n4); outline-offset: 2px; }

.bouton {
  width: 100%; min-height: 54px; background: var(--btn-bg); color: var(--btn-ink);
  border: none; font-family: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
}
.bouton.secondaire { background: none; color: var(--ink); border: 2px solid var(--ink); }
.bouton[disabled] { opacity: 0.45; cursor: default; }
.pied { padding: 14px 18px calc(20px + env(safe-area-inset-bottom)); }

/* --- réglages --- */
.grille-edt { display: flex; gap: 4px; }
.grille-col { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.grille-col > small { text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--label); }
.case {
  height: 46px; border: 2px solid var(--border); background: none; padding: 0;
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-size: 18px; line-height: 1;
  color: var(--dim); cursor: pointer;
}
.gouttiere { width: 34px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.gouttiere > small { height: 14px; }
.gouttiere > b {
  height: 46px; display: flex; align-items: center;
  font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-size: 17px; font-weight: 400; color: var(--muted);
}

.rangee {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 2px solid var(--border); padding: 10px 12px; min-height: 56px;
}
.rangee-nom { font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-size: 24px; line-height: 1; }
.rangee-info { font-size: 12px; color: var(--muted); }
.ligne-champs { display: flex; gap: 6px; }
.ligne-champs input { flex: 1; }
.ligne-champs .bouton { width: auto; padding: 0 18px; }

/* --- feuille de choix --- */
.voile {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.voile[hidden] { display: none; }
.feuille {
  width: 100%; max-width: 480px; background: var(--bg); border-top: 2px solid var(--ink);
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; max-height: 80dvh; overflow-y: auto;
}
.feuille-choix { display: flex; flex-wrap: wrap; gap: 6px; }
.feuille-choix button {
  min-height: 52px; min-width: 72px; padding: 0 14px; border: 2px solid var(--ink);
  background: none; color: var(--ink); font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif;
  font-size: 22px; line-height: 1; cursor: pointer;
}

/* --- messages --- */
.message { padding: 12px 14px; font-size: 13px; font-weight: 600; }
.message.erreur { background: var(--n3); color: var(--n3-ink); }
.message.info { background: var(--border); color: var(--ink); }
.message[hidden] { display: none; }

.vide { padding: 26px 0; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* --- connexion --- */
.connexion { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 32px 22px; }
.connexion h1 { font-family: 'Bebas Neue', 'Archivo Narrow', sans-serif; font-size: 46px; margin: 0; line-height: 0.9; }
.connexion .champ { display: flex; flex-direction: column; gap: 6px; }
