@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --nuit: #0F1E3D;
  --turquoise: #14B8A6;
  --corail: #F2643D;

  --fond: #F6F7FA;
  --surface: #FFFFFF;
  --surface-2: #EEF1F6;
  --trait: #E3E7EE;
  --texte: #0F1E3D;
  --texte-2: #55617A;
  --accent: #0D7F73;
  --accent-doux: #DDF5F2;
  --alerte: #C8421F;
  --alerte-doux: #FDE9E3;
  --cours: #3F5BD9;
  --cours-doux: #E6EAFB;
  --libre: #0D7F73;
  --libre-doux: #DDF5F2;
  --ombre: 0 1px 2px rgba(15, 30, 61, .05), 0 8px 24px rgba(15, 30, 61, .05);
  --rayon: 14px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --fond: #0B1529;
  --surface: #121F3A;
  --surface-2: #1A2946;
  --trait: #25365A;
  --texte: #F2F5FA;
  --texte-2: #A3AFC6;
  --accent: #2DD4BF;
  --accent-doux: #113B3F;
  --alerte: #FF8A66;
  --alerte-doux: #43241F;
  --cours: #93A6F5;
  --cours-doux: #222F5C;
  --libre: #2DD4BF;
  --libre-doux: #113B3F;
  --ombre: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 400 15px/1.55 "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; }

:root[data-theme="light"] .si-sombre, :root[data-theme="dark"] .si-clair { display: none; }

.evitement { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.evitement:focus { left: 8px; }

.cadre { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }

.lateral {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 14px 18px;
  background: var(--surface);
  border-right: 1px solid var(--trait);
}
.marque { display: block; padding: 2px 10px 22px; }
.marque img { display: block; height: 32px; width: auto; }
.lateral nav { display: grid; gap: 2px; }
.signature { margin-top: auto; padding: 12px 10px 0; font-size: 12px; line-height: 1.5; color: var(--texte-2); }

.lien {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: 9px; background: none;
  color: var(--texte-2); font-weight: 500; text-align: left; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.lien svg { width: 19px; height: 19px; flex: none; }
.lien:hover { background: var(--surface-2); color: var(--texte); }
.lien[aria-current="page"] { background: var(--accent-doux); color: var(--accent); }

.colonne { min-width: 0; }
.entete-mobile { display: none; }
main { max-width: 1040px; margin: 0 auto; padding: 38px 40px 60px; animation: entree .22s ease both; }
@keyframes entree { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.titre-page { font-size: 27px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.sous-titre { margin-top: 6px; color: var(--texte-2); }

.grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.carte {
  padding: 20px; min-width: 0;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}
.carte.large { grid-column: 1 / -1; }
.carte h2 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.carte p { margin-top: 6px; color: var(--texte-2); font-size: 14px; }
.date-jour { font-size: 21px; font-weight: 600; letter-spacing: -.015em; margin-top: 4px; }
.date-jour::first-letter { text-transform: uppercase; }

.etiquette {
  display: inline-block; margin-top: 12px; padding: 3px 10px;
  border-radius: 99px; background: var(--surface-2);
  color: var(--texte-2); font-size: 12.5px; font-weight: 500;
}

.legende { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13.5px; color: var(--texte-2); }
.legende span { display: inline-flex; align-items: center; gap: 7px; }
.legende i { width: 11px; height: 11px; border-radius: 4px; }
.c-cours { background: var(--cours); }
.c-libre { background: var(--libre); }
.c-taches { background: var(--texte-2); }
.c-retard { background: var(--alerte); }

.choix { display: inline-flex; margin-top: 14px; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.choix button {
  padding: 7px 15px; border: 0; border-radius: 8px; background: none;
  color: var(--texte-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.choix button[aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgba(15, 30, 61, .14); }

.porte { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.porte-carte {
  width: 100%; max-width: 380px; padding: 30px 26px;
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: 18px; box-shadow: var(--ombre); text-align: center;
  animation: entree .22s ease both;
}
.porte-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.porte-logo img { height: 40px; width: auto; }
.porte-titre { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.porte-texte { margin-top: 6px; color: var(--texte-2); font-size: 14px; }
.porte-erreur { margin-top: 14px; min-height: 20px; color: var(--alerte); font-size: 13.5px; font-weight: 500; }

.points { display: flex; justify-content: center; gap: 12px; margin: 22px 0 18px; }
.points i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--trait); transition: background-color .12s ease, border-color .12s ease; }
.points i.plein { background: var(--accent); border-color: var(--accent); }
.touches { display: grid; grid-template-columns: repeat(3, 66px); justify-content: center; gap: 10px; }
.touches button {
  height: 54px; border: 1px solid var(--trait); border-radius: 13px;
  background: var(--surface-2); font-size: 20px; font-weight: 500; cursor: pointer;
  transition: background-color .12s ease, transform .08s ease;
}
.touches button:hover { background: var(--accent-doux); }
.touches button:active { transform: scale(.96); }

.champ { display: block; margin-top: 18px; text-align: left; font-size: 13.5px; font-weight: 500; }
.champ input, .champ select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--trait); border-radius: 10px;
  background: var(--surface); color: var(--texte); font: inherit; font-weight: 400;
}
.bouton {
  display: inline-block; width: 100%; margin-top: 16px; padding: 11px 16px;
  border: 0; border-radius: 10px; background: var(--nuit); color: #fff;
  font-weight: 600; cursor: pointer; transition: opacity .15s ease;
}
:root[data-theme="dark"] .bouton { background: var(--accent); color: #06231F; }
.bouton:disabled { opacity: .55; cursor: default; }
.bouton.discret { width: auto; background: var(--surface-2); color: var(--texte); }
.lien-texte { margin-top: 14px; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 500; cursor: pointer; }

.ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--trait); font-size: 14px; }
.ligne:first-of-type { margin-top: 12px; }
.carte p.message { color: var(--accent); font-weight: 500; }
.carte p.message.erreur { color: var(--alerte); }

.barre { display: none; }
.voile { position: fixed; inset: 0; z-index: 30; background: rgba(8, 15, 32, .45); animation: fondu .15s ease both; }
.feuille {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 18px 18px 0 0;
  animation: monte .2s ease both;
}
[hidden] { display: none !important; }
@keyframes fondu { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(14px); opacity: 0; } }

@media (max-width: 820px) {
  .cadre { display: block; }
  .lateral { display: none; }
  .entete-mobile {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    background: var(--surface); border-bottom: 1px solid var(--trait);
    font-weight: 600;
  }
  main { padding: 22px 16px calc(92px + env(safe-area-inset-bottom)); }
  .titre-page { font-size: 23px; }
  .grille { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 18px; }
  .barre {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--trait);
  }
  .barre .lien {
    flex-direction: column; gap: 2px; justify-content: center;
    min-height: 52px; padding: 5px 2px;
    font-size: 11px; line-height: 1.2; text-align: center;
  }
  .barre .lien svg { width: 21px; height: 21px; }
  .barre .lien span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .barre .lien[aria-current="page"] { background: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
