/* Forme — feuille unique, vanilla, comme le reste du parc.
   Sombre par défaut : l'application se consulte le matin et le soir, rarement en
   plein jour. Le thème clair suit la préférence du système. */

:root {
  --fond: #0f1115;
  --carte: #171a21;
  --bord: #262b36;
  --texte: #e6e8ec;
  --doux: #9aa3b2;
  --accent: #6ea8fe;
  --alerte: #e5806b;
  --ok: #6cc48f;
  --absent: #4a5060;   /* la couleur du « pas de donnée » — jamais celle du zéro */
}

@media (prefers-color-scheme: light) {
  :root {
    --fond: #f7f8fa; --carte: #ffffff; --bord: #e2e5ea;
    --texte: #1a1d23; --doux: #5c6473; --absent: #c3c8d2;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
}

header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--bord);
}

h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--doux); font-weight: 600; }

main { padding: 24px; max-width: 1100px; }
footer { padding: 16px 24px; color: var(--doux); font-size: 12px; }

.lien {
  background: none; border: none; color: var(--doux);
  cursor: pointer; font: inherit; padding: 0; text-decoration: underline;
}

/* ── Connexion ────────────────────────────────────────────────────────────── */
.connexion { max-width: 340px; margin: 12vh auto; padding: 0 24px; }
.connexion .sous { color: var(--doux); margin-top: -8px; }
.connexion form { display: grid; gap: 14px; margin-top: 24px; }
.connexion label { display: grid; gap: 5px; font-size: 13px; color: var(--doux); }

input, button {
  font: inherit; padding: 9px 11px; border-radius: 7px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
}
button[type=submit] { background: var(--accent); color: #0b0d12; border-color: transparent; font-weight: 600; cursor: pointer; }
.erreur { color: var(--alerte); font-size: 13px; }

/* ── Cartes ───────────────────────────────────────────────────────────────── */
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 14px 16px; }
.chiffre { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.doux { color: var(--doux); font-size: 13px; }
.attente { color: var(--doux); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--bord); }
th { color: var(--doux); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Le vide se dit, il ne se dessine pas comme un zéro. */
.absent { color: var(--absent); font-style: italic; }
.pastille { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.pastille.ok { background: var(--ok); }
.pastille.erreur { background: var(--alerte); }
.pastille.inconnu { background: var(--absent); }

/* ── Onglets ──────────────────────────────────────────────────────────────── */
.onglets { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px;
  border-bottom: 1px solid var(--bord); }
.onglets button {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--doux); cursor: pointer; font: inherit; font-size: 14px;
  padding: 8px 12px; border-radius: 0;
}
.onglets button:hover { color: var(--texte); }
.onglets button.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 600; }

.barre-outils { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.barre-outils label { color: var(--doux); font-size: 13px; }
select, input { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte); }

/* ── Graphiques ───────────────────────────────────────────────────────────── */
.graphe { width: 100%; height: auto; display: block; }
.grille { stroke: var(--bord); stroke-width: 1; }
.axe { fill: var(--doux); font-size: 11px; font-family: inherit; }
.ligne { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pt { stroke: var(--carte); stroke-width: 1; }
.barre { rx: 2; }

/* Six teintes distinctes, lisibles sur fond clair comme sur fond sombre. Elles ne
   portent JAMAIS d'information a elles seules : chaque serie est aussi nommee dans la
   legende, et chaque point porte son infobulle. */
.s0 { stroke: #6ea8fe; fill: #6ea8fe; }
.s1 { stroke: #6cc48f; fill: #6cc48f; }
.s2 { stroke: #e5a06b; fill: #e5a06b; }
.s3 { stroke: #b98fe0; fill: #b98fe0; }
.s4 { stroke: #e5806b; fill: #e5806b; }
.s5 { stroke: #61c0c8; fill: #61c0c8; }

.legende-g { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px;
  font-size: 12px; color: var(--doux); }
.legende-g span { display: flex; align-items: center; gap: 5px; }
.pastille-c { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* Un avertissement de KPI n'est pas une decoration : il dit qu'une courbe ne veut pas
   dire ce qu'elle semble dire. Il se lit avant le graphique, pas apres. */
.avert-kpi {
  border-left: 3px solid var(--alerte); background: var(--carte);
  color: var(--doux); font-size: 12.5px; padding: 8px 12px; margin: 0 0 12px;
  border-radius: 0 6px 6px 0;
}

/* ── Page du protocole : la seule pensee pour le TELEPHONE ─────────────────────
   Cibles tactiles d'au moins 44 px (la recommandation d'accessibilite tactile), une
   seule colonne, et rien qui demande de viser. Le reste de l'application se consulte
   assis ; cette page se remplit debout, apres une seance. */
header.mob, main.mob, footer.mob { max-width: 560px; margin: 0 auto; }
header.mob { padding: 16px 18px; }
main.mob { padding: 0 18px 40px; }
footer.mob { padding: 12px 18px 28px; }

.blocs { display: grid; gap: 10px; margin: 14px 0 20px; }
.bloc {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 62px; padding: 10px 16px; text-align: left; cursor: pointer;
  border: 1px solid var(--bord); border-radius: 12px;
  background: var(--carte); color: var(--texte); font: inherit;
  transition: background .12s, border-color .12s;
}
.bloc .lettre {
  flex: 0 0 40px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; background: var(--fond); border: 1px solid var(--bord);
  font-size: 19px; font-weight: 700;
}
.bloc .quoi { font-size: 13.5px; color: var(--doux); line-height: 1.35; }
/* L'etat « fait » se lit a la teinte ET au contraste du pastille : sur un ecran en
   plein soleil, la couleur seule ne suffit pas. */
.bloc.fait { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--carte)); }
.bloc.fait .lettre { background: var(--ok); border-color: var(--ok); color: #0b0d12; }
.bloc.fait .quoi { color: var(--texte); }

.champ { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--doux); }
.champ input[type=text], .champ input:not([type]), .champ input[type=date] {
  min-height: 44px; font-size: 16px;   /* 16px : en deca, iOS zoome au focus */
}
.champ input[type=range] { min-height: 44px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
output { float: right; font-weight: 700; color: var(--texte); }

button.principal {
  width: 100%; min-height: 48px; margin-top: 6px;
  background: var(--accent); color: #0b0d12; border: none;
  border-radius: 10px; font-weight: 600; cursor: pointer;
}

.assiduite { display: flex; gap: 6px; align-items: flex-end; height: 90px; margin-top: 10px; }
.sem { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
       align-items: center; height: 100%; gap: 4px; }
.sem .jauge { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.sem span { font-size: 10px; color: var(--doux); }

/* En-tête : la page du protocole doit être atteignable depuis l'accueil — sans lien,
   elle existait sans que rien n'y mène. */
nav.entete { display: flex; align-items: center; gap: 16px; }
.bouton-lien {
  color: var(--accent); text-decoration: none; font-size: 14px; font-weight: 600;
  border: 1px solid var(--bord); border-radius: 8px; padding: 6px 12px;
}
.bouton-lien:hover { border-color: var(--accent); }

/* Repères business sur les graphiques. Discrets par construction : ils éclairent la
   courbe, ils ne la remplacent pas. */
.jalon { stroke: var(--doux); stroke-width: 1; stroke-dasharray: 3 3; opacity: .65; }
.periode { fill: var(--accent); opacity: .10; }
