/* ==========================================================================
   Projet Brésil — design system
   Dark glassmorphism · accents Brésil (vert / jaune / bleu) · mobile-first
   ========================================================================== */

:root {
  --fond:        #0a0a0f;
  --fond-2:      #101018;
  --verre:       rgba(32, 36, 62, .62);
  --verre-fort:  rgba(24, 27, 48, .94);
  --bord:        rgba(255, 255, 255, .09);
  --bord-clair:  rgba(255, 255, 255, .18);
  --texte:       #eef0f6;
  --texte-doux:  #a3a9bd;
  --texte-faible:#6f7590;

  --vert:        #2ecc71;   /* Brésil */
  --jaune:       #ffd700;   /* Brésil */
  --bleu:        #4ea1ff;   /* Brésil */
  --vert-sombre: #00b862;
  --rouge:       #e94560;
  --accent:      var(--vert);
  --accent-dim:  #1c8f52;

  --rayon:       18px;
  --rayon-petit: 12px;
  --ombre:       0 12px 40px rgba(0, 0, 0, .45);
  --flou:        blur(18px) saturate(150%);
  --mono:        ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Règle d'or : l'attribut hidden doit toujours gagner (cf. pièges CSS) */
[hidden] { display: none !important; }

img, canvas, iframe, svg, table { max-width: 100%; }

a { color: var(--bleu); text-decoration: none; }
a:hover { color: #7cbcff; }

/* ------------------------------ Halos décoratifs ------------------------- */
.halos {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.halo {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .42;
}
.halo-1 { width: 46vw; height: 46vw; background: #1f8a4c; top: -12vw; left: -10vw;
          animation: derive1 26s ease-in-out infinite; }
.halo-2 { width: 40vw; height: 40vw; background: #1d5fa8; bottom: -14vw; right: -8vw;
          animation: derive2 32s ease-in-out infinite; }
.halo-3 { width: 30vw; height: 30vw; background: #b8912a; top: 42%; left: 48%;
          animation: derive3 38s ease-in-out infinite; }

@keyframes derive1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(6vw, 4vw) scale(1.12); }
}
@keyframes derive2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-5vw, -3vw) scale(1.08); }
}
@keyframes derive3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-46%, -54%) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .halo { animation: none; }
}

/* --------------------------------- En-tête ------------------------------- */
.entete {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(12px, 2.4vw, 26px);
  background: rgba(14, 16, 30, .9);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-bottom: 1px solid var(--bord);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.marque {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.marque .drapeau {
  flex: 0 0 auto;
  width: 26px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--vert) 0 100%);
  position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14) inset;
}
.marque .drapeau::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 40%, rgba(255,215,0,.95) 40% 100%),
    linear-gradient(90deg, rgba(46,204,113,.9) 0 34%, rgba(255,215,0,.9) 34% 67%, rgba(78,161,255,.9) 67% 100%);
  opacity: .0;
}
.marque .drapeau {
  background:
    linear-gradient(135deg, transparent 44%, rgba(255,215,0,.95) 44% 56%, transparent 56%),
    linear-gradient(90deg, rgba(46,204,113,1) 0 36%, rgba(255,215,0,1) 36% 66%, rgba(78,161,255,1) 66% 100%);
}
.marque-titre {
  font-weight: 650;
  letter-spacing: -.01em;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.marque-titre span { color: var(--texte-doux); font-weight: 450; }
.entete-actions { display: flex; align-items: center; gap: 8px; }

/* ------------------------------ Barre d'onglets -------------------------- */
.nav {
  position: sticky;
  top: 60px;
  z-index: 90;
  background: rgba(12, 14, 26, .86);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--bord);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { display: none; }
.nav-inner {
  display: flex;
  gap: 4px;
  padding: 8px clamp(12px, 2.4vw, 26px);
  min-width: max-content;
}
.nav a {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 100px;
  font-size: .86rem;
  font-weight: 520;
  color: var(--texte-doux);
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: var(--texte); }
.nav a.actif {
  background: linear-gradient(135deg, rgba(46,204,113,.22), rgba(78,161,255,.16));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

/* -------------------------------- Contenu -------------------------------- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(12px, 2.4vw, 26px) 80px;
}
.page-titre {
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  font-weight: 680;
  letter-spacing: -.02em;
  margin: 0 0 6px;
}
.page-sous {
  color: var(--texte-doux);
  margin: 0 0 26px;
  font-size: .95rem;
}
h2.section {
  font-size: 1.16rem;
  font-weight: 640;
  margin: 38px 0 14px;
  letter-spacing: -.01em;
}
h2.section:first-of-type { margin-top: 8px; }

/* --------------------------------- Cartes -------------------------------- */
.carte {
  background: var(--verre);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: clamp(16px, 2.2vw, 24px);
  box-shadow: var(--ombre), inset 0 1px 0 rgba(255, 255, 255, .09);
  backdrop-filter: var(--flou);
  -webkit-backdrop-filter: var(--flou);
}
.grille {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
}
.grille > * { min-width: 0; }
/* Bordure tricolore subtile : marqueur « projet Brésil » */
.carte.nation {
  background:
    linear-gradient(90deg, var(--vert) 0 4px, var(--jaune) 4px 8px, var(--bleu) 8px 12px)
    left top / 12px 100% no-repeat,
    var(--verre);
  padding-left: calc(clamp(16px, 2.2vw, 24px) + 8px);
}

/* -------------------------------- Statistiques --------------------------- */
.stats {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  margin-bottom: 26px;
}
.stat {
  background: var(--verre);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: var(--flou);
  -webkit-backdrop-filter: var(--flou);
}
.stat .k {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--texte-faible);
  font-weight: 600;
}
.stat .v {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat .d { font-size: .8rem; color: var(--texte-doux); margin-top: 2px; }
.v.vert { color: var(--vert); }
.v.jaune { color: var(--jaune); }
.v.rouge { color: var(--rouge); }
.v.bleu { color: var(--bleu); }

/* --------------------------------- Barres -------------------------------- */
.jauge {
  height: 9px;
  border-radius: 100px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
}
.jauge > i {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--vert), var(--jaune));
  transition: width .5s ease;
}

/* -------------------------------- Pastilles ------------------------------ */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 620;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--bord);
  color: var(--texte-doux);
}
.pastille.critique { background: rgba(233,69,96,.16); color: #ff8fa3; border-color: rgba(233,69,96,.35); }
.pastille.eleve    { background: rgba(255,215,0,.14); color: #ffe066; border-color: rgba(255,215,0,.32); }
.pastille.ok       { background: rgba(46,204,113,.15); color: #7ee2a8; border-color: rgba(46,204,113,.34); }
.pastille.gele     { background: rgba(155,140,255,.15); color: #bdb2ff; border-color: rgba(155,140,255,.34); }
.pastille.abandonne{ background: rgba(255,255,255,.05); color: var(--texte-faible); }
.pastille.critique::before,
.pastille.eleve::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

/* ------------------------------- Alertes --------------------------------- */
.alerte {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: var(--rayon);
  border: 1px solid var(--bord);
  background: var(--verre);
  backdrop-filter: var(--flou);
  -webkit-backdrop-filter: var(--flou);
  margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.alerte.critique { border-left: 4px solid var(--rouge); }
.alerte.eleve    { border-left: 4px solid var(--jaune); }
.alerte .icone {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1rem;
  background: rgba(255,255,255,.06);
}
.alerte.critique .icone { background: rgba(233,69,96,.18); }
.alerte.eleve .icone { background: rgba(255,215,0,.16); }
.alerte h4 { margin: 0 0 3px; font-size: .98rem; font-weight: 640; }
.alerte p { margin: 0; font-size: .87rem; color: var(--texte-doux); }
.alerte .compte {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: .82rem;
  color: var(--texte-doux);
  white-space: nowrap;
}
.alerte.critique .compte { color: #ff8fa3; }
.alerte.eleve .compte { color: #ffe066; }

/* --------------------------------- Gantt --------------------------------- */
.gantt {
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  overflow: hidden;
  background: var(--verre);
  backdrop-filter: var(--flou);
  -webkit-backdrop-filter: var(--flou);
  box-shadow: var(--ombre);
}
.gantt-tete {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  border-bottom: 1px solid var(--bord);
  background: rgba(255, 255, 255, .035);
}
.gantt-tete .col-nom {
  padding: 11px 14px;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--texte-faible);
  font-weight: 640;
}
.axe { position: relative; height: 38px; }
.axe .repere {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, .07);
}
.axe .repere span {
  position: absolute;
  top: 11px;
  left: 6px;
  font-size: .7rem;
  color: var(--texte-faible);
  white-space: nowrap;
  font-weight: 600;
}
.gantt-ligne {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  min-height: 46px;
}
.gantt-ligne:last-child { border-bottom: 0; }
.gantt-ligne .col-nom {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.gantt-ligne .col-nom b { font-size: .84rem; font-weight: 620; }
.gantt-ligne .col-nom small { font-size: .68rem; color: var(--texte-faible); font-variant-numeric: tabular-nums; }
.piste { position: relative; min-height: 46px; }
.piste .barre {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: .7rem;
  font-weight: 650;
  color: #08080d;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .35);
  min-width: 30px;
}
.piste .barre.critique::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.12) 0 6px, transparent 6px 12px);
}
.ligne-aujourdhui {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--rouge);
  box-shadow: 0 0 10px var(--rouge);
  z-index: 3;
}
.ligne-aujourdhui::before {
  content: "aujourd'hui";
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: .62rem;
  color: var(--rouge);
  white-space: nowrap;
  font-weight: 700;
}
.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: .78rem;
  color: var(--texte-doux);
}
.legende i {
  display: inline-block;
  width: 22px; height: 10px;
  border-radius: 100px;
  margin-right: 6px;
  vertical-align: middle;
}

@media (max-width: 640px) {
  .gantt-tete, .gantt-ligne { grid-template-columns: 118px minmax(0, 1fr); }
  .gantt-tete .col-nom, .gantt-ligne .col-nom { padding: 8px 9px; }
  .gantt-ligne .col-nom b { font-size: .76rem; }
  .piste .barre { font-size: 0; padding: 0; }
  .axe .repere span { font-size: .6rem; left: 3px; }
}

/* -------------------------------- Phases --------------------------------- */
.phase { margin-bottom: 16px; }
.phase-tete {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.phase-tete .puce {
  width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto;
  box-shadow: 0 0 12px currentColor;
}
.phase-tete h3 { margin: 0; font-size: 1.02rem; font-weight: 650; }
.phase-tete .dates { font-size: .78rem; color: var(--texte-faible); font-variant-numeric: tabular-nums; }
.phase-tete .prog { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.phase-tete .prog .jauge { width: 110px; }

.taches { list-style: none; margin: 0; padding: 0; }
.taches li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--rayon-petit);
  border: 1px solid rgba(255, 255, 255, .05);
  background: rgba(255, 255, 255, .022);
  margin-bottom: 6px;
  transition: background .16s, border-color .16s;
}
.taches li:hover { background: rgba(255, 255, 255, .05); border-color: var(--bord); }
.coche {
  width: 21px; height: 21px;
  border-radius: 7px;
  border: 1.6px solid rgba(255, 255, 255, .28);
  display: grid; place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .03);
  color: transparent;
  font-size: .78rem;
  font-weight: 800;
  transition: all .16s;
  padding: 0;
}
.coche:hover { border-color: var(--vert); }
.coche.fait {
  background: linear-gradient(135deg, var(--vert), var(--vert-sombre));
  border-color: transparent;
  color: #06210f;
  box-shadow: 0 0 14px rgba(46, 204, 113, .45);
}
.taches .libelle { font-size: .89rem; min-width: 0; }
.taches li.fait .libelle { color: var(--texte-faible); text-decoration: line-through; }
.taches .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: .72rem;
  color: var(--texte-faible);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.taches .note {
  grid-column: 2 / -1;
  font-size: .76rem;
  color: var(--jaune);
  margin-top: -2px;
}
@media (max-width: 560px) {
  .taches li { grid-template-columns: auto minmax(0, 1fr); }
  .taches .meta { grid-column: 2; justify-content: flex-start; }
}

/* ------------------------------- Tableaux -------------------------------- */
.wrap {
  border: 1px solid var(--bord);
  border-radius: 14px;
  overflow: auto;
  background: var(--verre);
  backdrop-filter: var(--flou);
  -webkit-backdrop-filter: var(--flou);
  box-shadow: var(--ombre);
}
table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: .87rem; }
thead th {
  position: sticky; top: 0;
  background: rgba(20, 23, 42, .97);
  text-align: left;
  padding: 11px 14px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--texte-faible);
  font-weight: 660;
  border-bottom: 1px solid var(--bord);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, .016); }
tbody tr:hover { background: rgba(255, 255, 255, .04); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.mise-en-avant { background: rgba(255, 215, 0, .07) !important; }
tr.ferme td { color: var(--texte-faible); }
.gras { font-weight: 650; }

/* --------------------------------- Listes -------------------------------- */
.points { list-style: none; margin: 0; padding: 0; }
.points li {
  position: relative;
  padding: 8px 0 8px 22px;
  font-size: .89rem;
  color: var(--texte-doux);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.points li:last-child { border-bottom: 0; }
.points li::before {
  content: "";
  position: absolute;
  left: 4px; top: 16px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* -------------------------------- Boutons -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 100px;
  border: 1px solid var(--bord);
  background: rgba(255, 255, 255, .06);
  color: var(--texte);
  font-size: .87rem;
  font-weight: 560;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}
.btn:hover { background: rgba(255, 255, 255, .1); border-color: var(--bord-clair); }
.btn.principal {
  background: linear-gradient(135deg, var(--vert), var(--vert-sombre));
  color: #06210f;
  border-color: transparent;
  font-weight: 660;
}
.btn.principal:hover { filter: brightness(1.08); }
.btn.discret { background: transparent; color: var(--texte-doux); }

.champ {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--rayon-petit);
  border: 1px solid var(--bord);
  background: rgba(255, 255, 255, .05);
  color: var(--texte);
  font-size: .92rem;
  font-family: inherit;
  margin-bottom: 10px;
}
.champ:focus { outline: none; border-color: var(--vert); box-shadow: 0 0 0 3px rgba(46, 204, 113, .16); }
textarea.champ { min-height: 96px; resize: vertical; }
label.etiq { display: block; font-size: .78rem; color: var(--texte-faible); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* -------------------------------- Connexion ------------------------------ */
.porte {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.porte .carte { width: 100%; max-width: 400px; }

/* -------------------------------- Journal -------------------------------- */
.entree {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin-bottom: 20px;
}
.entree .quand { font-size: .74rem; color: var(--texte-faible); font-variant-numeric: tabular-nums; }
.entree h4 { margin: 2px 0 5px; font-size: .95rem; font-weight: 640; }
.entree p { margin: 0; font-size: .87rem; color: var(--texte-doux); }

/* -------------------------------- Divers --------------------------------- */
.hr { height: 1px; background: var(--bord); margin: 30px 0; border: 0; }
.flex { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { color: var(--texte-doux); }
.petit { font-size: .78rem; }
.mono { font-family: var(--mono); font-size: .84rem; }
footer.pied {
  text-align: center;
  color: var(--texte-faible);
  font-size: .76rem;
  padding: 30px 16px 40px;
}
.page > * { min-width: 0; }

/* ---------- Rendu markdown (page Rédactions) ---------- */
.markdown { font-size: .93rem; line-height: 1.65; }
.markdown h1, .markdown h2 {
  font-size: 1rem; margin: 20px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.markdown h3 { font-size: .95rem; margin: 16px 0 8px; }
.markdown p { margin: 0 0 10px; }
.markdown ul, .markdown ol { margin: 0 0 12px; padding-left: 22px; }
.markdown li { margin-bottom: 4px; }
.markdown blockquote {
  margin: 10px 0; padding: 8px 14px; font-style: italic;
  border-left: 3px solid var(--accent, #00d4aa);
  background: rgba(255,255,255,.03); border-radius: 0 8px 8px 0;
}
.markdown table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .86rem; }
.markdown th, .markdown td {
  padding: 7px 10px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.markdown th { color: #00d4aa; font-weight: 600; }
.markdown strong { color: #fff; }
.markdown code {
  background: rgba(255,255,255,.08); padding: 1px 5px;
  border-radius: 4px; font-size: .85em;
}
