/* Polices de la charte, servies depuis le dossier du Cockpit (projets.json → "polices"). Repli : Century Gothic. */
@font-face { font-family: "Avant"; src: url(/polices/avant-garde-book.otf) format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Avant"; src: url(/polices/avant-garde-medium.otf) format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Avant"; src: url(/polices/avant-garde-demi.otf) format("opentype"); font-weight: 600 700; font-display: swap; }

:root {
  color-scheme: light;
  /* Charte Boreana */
  --bleu: #4361aa;
  --indigo: #29347d;
  --turquoise: #74c4be;
  --rose: #df2883;

  --fond: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --encre: #12163a;
  --encre-2: #4a5072;
  --encre-3: #767c98;
  --filet: #e3e6ef;
  --filet-fort: #cfd4e3;
  --accent: var(--bleu);
  --accent-doux: #e8edf8;
  --ombre: 0 1px 2px rgba(18, 22, 58, 0.04), 0 12px 32px -20px rgba(18, 22, 58, 0.25);

  /* Une couleur par projet (validées daltonisme, ordre fixe) */
  --p-sav: #4361aa;
  --p-cockpit: #e0782a;
  --p-page: #1baf9a;
  --p-site: #c2306f;
  --p-tous: #767c98;

  --ok: #1e7a4c;
  --ok-fond: #e3f4ea;
  --attention: #9a5b00;
  --attention-fond: #fdf1dc;

  --entete: #12163a;
  --entete-encre: #ffffff;

  --r: 6px;
  --r-feuille: 2px 18px 2px 18px;
  --f: "Avant", "Century Gothic", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fond: #0b0e24;
    --surface: #141833;
    --surface-2: #191e3d;
    --encre: #eef0f8;
    --encre-2: #b9bed6;
    --encre-3: #8a90ad;
    --filet: #262b4d;
    --filet-fort: #343a63;
    --accent: #8ea3e3;
    --accent-doux: #1e2550;
    --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -20px rgba(0, 0, 0, 0.6);
    --p-sav: #6b86d6;
    --p-cockpit: #d96f26;
    --p-page: #22a891;
    --p-site: #b03a72;
    --p-tous: #8a90ad;
    --ok: #6fd3a0;
    --ok-fond: #12301f;
    --attention: #f2b55a;
    --attention-fond: #33260f;
    --entete: #070918;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #0b0e24;
  --surface: #141833;
  --surface-2: #191e3d;
  --encre: #eef0f8;
  --encre-2: #b9bed6;
  --encre-3: #8a90ad;
  --filet: #262b4d;
  --filet-fort: #343a63;
  --accent: #8ea3e3;
  --accent-doux: #1e2550;
  --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -20px rgba(0, 0, 0, 0.6);
  --p-sav: #6b86d6;
  --p-cockpit: #d96f26;
  --p-page: #22a891;
  --p-site: #b03a72;
  --p-tous: #8a90ad;
  --ok: #6fd3a0;
  --ok-fond: #12301f;
  --attention: #f2b55a;
  --attention-fond: #33260f;
  --entete: #070918;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 15px/1.55 var(--f);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--filet);
  border-radius: 4px;
  padding: 0 0.3em;
}
strong { font-weight: 600; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.entete { background: var(--entete); color: var(--entete-encre); position: relative; overflow: hidden; }
.entete::after {
  content: "";
  position: absolute; inset: auto 0 0 0; height: 3px;
  background: linear-gradient(90deg, var(--bleu) 0 33%, var(--turquoise) 33% 66%, var(--rose) 66%);
}
.entete__inner {
  max-width: 1280px; margin: 0 auto; padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: 14px; }
.marque h1 { font-size: 20px; }
.marque__sous { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.66); }
.marque__logo { display: flex; align-items: flex-end; gap: 3px; height: 30px; }
.marque__logo i { display: block; width: 7px; border-radius: 1px 5px 1px 5px; }
.marque__logo i:nth-child(1) { height: 14px; background: var(--bleu); }
.marque__logo i:nth-child(2) { height: 22px; background: var(--turquoise); }
.marque__logo i:nth-child(3) { height: 30px; background: var(--rose); }
.entete__actions { display: flex; align-items: center; gap: 10px; }
.maj { font-size: 13px; color: rgba(255, 255, 255, 0.66); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06); color: #fff; cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn--icone { width: 38px; padding: 0; justify-content: center; }
.btn.tourne svg { animation: tourne 0.8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* ---------- Page ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 24px 64px; display: grid; gap: 20px; }
.carte { background: var(--surface); border: 1px solid var(--filet); border-radius: var(--r); box-shadow: var(--ombre); }
.sous { margin: 2px 0 0; color: var(--encre-3); font-size: 13px; }
.alerte {
  padding: 12px 16px; border-radius: var(--r);
  background: var(--attention-fond); color: var(--attention); border: 1px solid currentColor;
  font-size: 14px; margin-bottom: 8px;
}

/* ---------- Cartes projets ---------- */
.projets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.projet {
  position: relative; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--filet); border-radius: var(--r);
  box-shadow: var(--ombre); padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.projet::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--c); border-radius: var(--r) 0 0 var(--r);
}
.projet:hover { border-color: var(--filet-fort); transform: translateY(-1px); }
.projet[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), var(--ombre); }
.projet__tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.projet__nom { font-size: 16px; font-weight: 600; }
.projet__desc { font-size: 12.5px; color: var(--encre-3); margin-top: 2px; }
.version {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--filet); color: var(--encre-2);
}
.projet__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; color: var(--encre-2); }
.projet__stats b { display: block; font-size: 18px; color: var(--encre); font-weight: 600; font-variant-numeric: tabular-nums; }
.etat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px; }
.etat svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.etat--ok { background: var(--ok-fond); color: var(--ok); }
.etat--attention { background: var(--attention-fond); color: var(--attention); }
.projet__pied { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; font-size: 13px; }
.liens { display: flex; gap: 12px; }
.liens a { display: inline-flex; align-items: center; gap: 4px; }
.liens svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Chiffres ---------- */
.chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.chiffre { padding: 16px 18px; }
.chiffre__val { font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chiffre__lib { font-size: 13px; color: var(--encre-3); margin-top: 4px; }

/* ---------- Activité ---------- */
.activite { padding: 18px 20px 12px; }
.carte__tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.carte__tete h2 { font-size: 16px; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--encre-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.graphe { position: relative; width: 100%; }
.graphe svg { display: block; width: 100%; height: 220px; overflow: visible; }
.graphe .grille { stroke: var(--filet); stroke-width: 1; }
.graphe .axe { fill: var(--encre-3); font-size: 11px; font-family: var(--f); }
.graphe .cible { fill: transparent; cursor: default; }
.graphe .colonne.active .cible { fill: var(--surface-2); }
.graphe .aujourdhui { stroke: var(--encre-3); stroke-dasharray: 3 3; }

.bulle {
  position: fixed; z-index: 10; pointer-events: none; min-width: 170px;
  background: var(--surface); color: var(--encre); border: 1px solid var(--filet-fort);
  border-radius: var(--r); box-shadow: var(--ombre); padding: 10px 12px; font-size: 13px;
}
.bulle__titre { font-weight: 600; margin-bottom: 6px; }
.bulle__ligne { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.bulle__ligne span { display: inline-flex; align-items: center; gap: 6px; color: var(--encre-2); }
.bulle__ligne i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.bulle__ligne b { font-variant-numeric: tabular-nums; }
.bulle__total { border-top: 1px solid var(--filet); margin-top: 6px; padding-top: 6px; }

/* ---------- Reste à faire ---------- */
.reste {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--accent-doux); border: 1px solid var(--filet); border-left: 4px solid var(--rose);
  border-radius: var(--r); padding: 14px 18px;
}
.reste svg { width: 20px; height: 20px; margin-top: 2px; fill: none; stroke: var(--rose); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reste h2 { font-size: 14px; margin-bottom: 2px; }
.reste p { margin: 0; color: var(--encre-2); font-size: 14px; }

/* ---------- Filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--filet-fort); background: var(--surface); color: var(--encre-2); font-size: 13px;
}
.puce i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.puce[aria-pressed="true"] { background: var(--encre); color: var(--surface); border-color: var(--encre); }
.recherche {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; min-width: 240px;
  border: 1px solid var(--filet-fort); border-radius: var(--r); background: var(--surface);
}
.recherche svg { width: 16px; height: 16px; fill: none; stroke: var(--encre-3); stroke-width: 2; stroke-linecap: round; }
.recherche input { border: 0; outline: 0; background: transparent; color: var(--encre); font: inherit; width: 100%; }

/* ---------- Onglets ---------- */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--filet-fort); }
.onglets button {
  background: none; border: 0; cursor: pointer; padding: 10px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; color: var(--encre-3); font-weight: 500;
}
.onglets button[aria-selected="true"] { color: var(--encre); border-bottom-color: var(--rose); }
.compte { font-size: 12px; color: var(--encre-3); font-variant-numeric: tabular-nums; margin-left: 2px; }
.vide { padding: 40px 20px; text-align: center; color: var(--encre-3); }

/* ---------- Journal ---------- */
.jour { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 20px; padding: 6px 0 22px; }
.jour + .jour { border-top: 1px solid var(--filet); padding-top: 22px; }
.jour__date { position: sticky; top: 12px; align-self: start; }
.jour__num { font-size: 34px; font-weight: 600; line-height: 1; }
.jour__mois { font-size: 13px; color: var(--encre-2); text-transform: capitalize; }
.jour__sem { font-size: 12px; color: var(--encre-3); text-transform: capitalize; }
.jour__corps { display: grid; gap: 12px; }
.jour__titre { font-size: 19px; }
.types { display: flex; flex-wrap: wrap; gap: 6px; }
.type { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--filet-fort); color: var(--encre-2); background: var(--surface); }
.section { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--filet); }
.section__titre { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.section__titre i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.section__remarque { font-size: 12px; font-weight: 400; color: var(--encre-3); }
.section__commits { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--encre-3); }
.section ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.section li { color: var(--encre-2); font-size: 14px; }
.section li::marker { color: var(--c); }
.section li strong { color: var(--encre); }
.jour__reste { font-size: 13.5px; color: var(--encre-2); padding: 10px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--filet-fort); }
.jour__reste b { color: var(--encre); }
mark { background: color-mix(in srgb, var(--rose) 22%, transparent); color: inherit; border-radius: 2px; }

/* ---------- Historique Git ---------- */
.git-jour { margin-bottom: 18px; }
.git-jour__tete {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--encre-3); padding: 0 4px 6px; border-bottom: 1px solid var(--filet);
}
.git-jour__tete b { color: var(--encre); font-size: 14px; text-transform: capitalize; }
.commit {
  display: grid; grid-template-columns: 4px 56px 130px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--filet); font-size: 14px;
}
.commit__barre { align-self: stretch; border-radius: 2px; background: var(--c); }
.commit__heure { color: var(--encre-3); font-variant-numeric: tabular-nums; font-size: 13px; }
.commit__projet { font-size: 12.5px; color: var(--encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commit__sujet { min-width: 0; }
.commit__hash { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.tag-version {
  display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; background: var(--accent-doux); color: var(--accent); border: 1px solid var(--filet-fort);
}

/* ---------- Bilans ---------- */
.bilan { padding: 22px 26px; margin-bottom: 16px; }
.bilan__fichier { font-size: 12px; color: var(--encre-3); margin-bottom: 8px; }
.md h1 { font-size: 22px; margin: 0 0 10px; }
.md h2 { font-size: 17px; margin: 18px 0 8px; }
.md h3 { font-size: 15px; margin: 14px 0 6px; }
.md p, .md li { color: var(--encre-2); }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--filet-fort); padding: 6px 10px; text-align: left; }
.md blockquote { margin: 8px 0; padding: 4px 14px; border-left: 3px solid var(--filet-fort); color: var(--encre-3); }

/* ---------- Petits écrans ---------- */
@media (max-width: 1100px) {
  .projets, .chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---------- Verrou (version en ligne sans session) : faux tableau de bord flouté + mot de passe ---------- */
.btn[hidden] { display: none; }
body.verrouille .page { filter: blur(7px) saturate(0.85); pointer-events: none; user-select: none; }
body.verrouille #btn-actualiser { display: none; }
.verrou {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--fond) 35%, transparent);
}
.verrou[hidden] { display: none; }
.verrou__carte { width: min(400px, 100%); padding: 28px 26px 24px; display: grid; gap: 12px; text-align: center; }
.verrou__carte h2 { margin: 4px 0 0; font-size: 20px; color: var(--encre); }
.verrou__icone {
  justify-self: center; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-doux); color: var(--accent);
}
.verrou__icone svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.verrou__champ {
  height: 44px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--filet-fort);
  background: var(--surface-2); color: var(--encre); font: inherit; font-size: 15px;
}
.verrou__champ:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.verrou__erreur { margin: 0; min-height: 18px; font-size: 13px; color: var(--rose); }
.verrou__bouton {
  height: 44px; border: 0; border-radius: var(--r); background: var(--bleu); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.verrou__bouton:hover { background: var(--indigo); }
.verrou__bouton:disabled { opacity: 0.6; cursor: progress; }

@media (max-width: 680px) {
  .page { padding: 16px 16px 48px; }
  .entete__inner { padding: 14px 16px; }
  .projets, .chiffres { grid-template-columns: minmax(0, 1fr); }
  .recherche { margin-left: 0; min-width: 0; width: 100%; }
  .jour { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .jour__date { position: static; display: flex; align-items: baseline; gap: 8px; }
  .commit { grid-template-columns: 4px 44px minmax(0, 1fr); }
  .commit__projet, .commit__hash { display: none; }
  .maj { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
