/* Pilotage Hapsout — d'après la maquette validée le 27/11/2026 (orange du logo, fond neutre). */
:root {
  --encre: #15191f; --texte: #3a424e; --discret: #5b6472; --bord: #e3e6eb; --bord-fort: #d5dae1;
  --fond: #f4f5f7; --surface: #fff; --surface-2: #f7f8fa;
  --marque: #ff5f00; --accent: #e35400; --accent-texte: #b54400; --accent-fonce: #7a2e00;
  --accent-fond: #fff1e8; --accent-zone: #fff6ef;
  --rouge: #b42318; --rouge-fond: #fdf3f2; --rouge-bord: #f4c7c3; --vert: #1e7a4f;
  --titres: "Space Grotesk", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--encre); background: var(--fond); }
a { color: var(--accent-texte); } a:hover { color: var(--accent-fonce); }
h1 { margin: 0; font: 600 26px/1.2 var(--titres); letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
h3 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; }
main > h1 { margin-bottom: 8px; }
main > h2 { margin-top: 8px; }
code { font-size: 12px; color: var(--discret); }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.note, .sous-titre { margin: 0; font-size: 13px; color: var(--discret); }

/* Cadre : menu latéral + page */
.cadre { display: flex; min-height: 100vh; }
.lateral { flex: 0 0 232px; padding: 20px 12px; background: var(--surface); border-right: 1px solid var(--bord); display: flex; flex-direction: column; gap: 20px; }
.marque { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--encre); text-decoration: none; }
.marque span { display: flex; flex-direction: column; }
.marque strong { font: 600 16px var(--titres); }
.marque small { font-size: 12px; color: var(--discret); }
.marque.mobile { display: none; }
.nav { display: flex; flex-direction: column; gap: 16px; }
.nav .groupe { display: flex; flex-direction: column; gap: 2px; }
.etiquette { padding: 0 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--discret); }
.nav a { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--texte); text-decoration: none; font-size: 14px; }
.nav a:hover { background: #eceef2; color: var(--encre); }
.nav a.actif { background: var(--accent-fond); color: #8a3300; font-weight: 600; box-shadow: inset 3px 0 0 var(--marque); }
.pastille { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent-fond); color: #8a3300; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.page { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.haut { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 32px 0; }
.fraicheur { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fraicheur li { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--bord); font-size: 13px; color: var(--texte); white-space: nowrap; }
.fraicheur .point { width: 8px; height: 8px; border-radius: 50%; background: var(--vert); }
.fraicheur li.jamais { background: var(--rouge-fond); border-color: var(--rouge-bord); color: #9b1c13; }
.fraicheur li.jamais .point { background: none; border: 2px solid var(--rouge); }
main { padding: 16px 32px 48px; max-width: 1240px; width: 100%; display: flex; flex-direction: column; gap: 20px; }
.onglets { display: none; }

/* Blocs */
.entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.entete > div:first-child, .entete { row-gap: 4px; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.carte.sans-marge { padding: 18px 0 8px; }
.carte.sans-marge > .titre-carte { padding: 0 20px; }
.titre-carte { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.titre-carte p { margin: 0; font-size: 14px; }
.rangee { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.rangee > .carte { flex: 1 1 340px; }
.rangee > .carte.large { flex: 999 1 520px; }
.boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.bouton, button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--bord-fort); background: var(--surface); font: 500 14px Inter, -apple-system, sans-serif; color: var(--encre); cursor: pointer; text-decoration: none; white-space: nowrap; }
.bouton:hover, button:hover { background: var(--surface-2); color: var(--encre); }
.bouton.plein { background: var(--accent-texte); border-color: var(--accent-texte); color: #fff; }
.bouton.plein:hover { background: #963800; color: #fff; }
input, select, textarea { font: inherit; min-height: 40px; padding: 6px 10px; border: 1px solid #c5cbd3; border-radius: 8px; background: var(--surface); color: var(--encre); min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; accent-color: var(--accent); }
form.ligne, .ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
form.pile { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
form.pile label, .ligne label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.ligne label { flex: 1 1 160px; }
form.pile > button { align-self: flex-start; }
.erreur { color: var(--rouge); font-weight: 600; }
p.erreur[role=alert] { margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--rouge-fond); border: 1px solid var(--rouge-bord); }
.liste { margin: 0; padding-left: 18px; }

/* Chiffres clés */
.cles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.cle { gap: 6px; padding: 16px 18px; }
.cle h2 { font-size: 13px; font-weight: 400; color: var(--discret); }
.cle p { margin: 0; font-size: 13px; color: var(--texte); }
.cle summary { font: 600 24px/1.15 var(--titres); }
.cle.forte { border-color: #ffd3b8; box-shadow: inset 0 3px 0 var(--marque); }
details.montant { display: inline-block; }
details.montant summary { cursor: pointer; list-style: none; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; flex-wrap: wrap; align-items: center; justify-content: inherit; gap: 4px 8px; }
details.montant summary::-webkit-details-marker { display: none; }
details.montant[open] summary { text-decoration: underline dotted; }
details.montant ul { font: 12px/1.4 Inter, sans-serif; color: var(--discret); margin: 6px 0 0; padding-left: 16px; text-align: left; white-space: normal; }
.negatif { color: var(--rouge); } .inconnu { color: var(--discret); font-style: italic; }
.estimation { font: 600 11px Inter, sans-serif; color: var(--discret); border: 1px solid var(--bord-fort); border-radius: 4px; padding: 1px 5px; vertical-align: middle; }

/* Courbe */
.courbe { width: 100%; height: auto; display: block; max-height: 280px; }
.courbe .axes { font: 11px Inter, sans-serif; fill: var(--discret); }
.courbe .axes line { stroke: #edeff2; }
.courbe .axes line.zero { stroke: var(--bord-fort); }
.courbe .zone-projection { fill: var(--accent-zone); }
.courbe .legende { font: 11px Inter, sans-serif; fill: var(--discret); }
.courbe polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.courbe polyline.projete { stroke-dasharray: 6 5; }
.courbe .bas { fill: var(--encre); stroke: #fff; stroke-width: 2; }
.legende-courbe { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--texte); }
.legende-courbe .trait { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--accent); margin-left: 8px; }
.legende-courbe .trait.pointille { height: 0; background: none; border-top: 3px dashed var(--accent); }

/* Listes de l'accueil */
.points, .actions, .questions, .leviers { list-style: none; margin: 0; padding: 0; }
.points { display: flex; flex-direction: column; gap: 6px; }
.points li { padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.points li.alerte { background: var(--rouge-fond); color: var(--rouge); font-weight: 600; }
.points a { color: inherit; }
.actions { display: flex; flex-direction: column; gap: 4px; }
.actions form { margin: 0; }
.actions label { display: flex; gap: 12px; padding: 10px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.35; }
.actions label > span { display: flex; flex-direction: column; gap: 4px; }
.actions input[type=checkbox] { flex: none; margin: 1px 0 0; }
.actions .meta { font-size: 12px; color: var(--discret); }
.actions .delai { color: var(--texte); }
.actions li.retard label { background: var(--rouge-fond); }
.actions li.retard .delai { color: var(--rouge); }
.actions li.faite .texte { text-decoration: line-through; color: var(--discret); }
.ajout > summary { list-style: none; align-self: flex-start; display: inline-flex; }
.ajout > summary::-webkit-details-marker { display: none; }
.ajout[open] > summary { margin-bottom: 12px; }
.questions { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.questions li { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--bord); border-radius: 10px; background: #fbfbfc; font-size: 14px; }
.questions a { font-size: 13px; font-weight: 500; }
.leviers { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.leviers li { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--bord); border-radius: 10px; background: #fbfbfc; }
.leviers .nom, .leviers .quand { font-size: 12px; color: var(--discret); }
.leviers .valeur { font: 600 18px var(--titres); }
details.repli > summary { cursor: pointer; }
details.repli > summary h2 { display: inline; }

/* Tableaux */
.defilement { overflow-x: auto; padding-bottom: 14px; } /* la barre de défilement superposée ne masque pas la dernière ligne */
table { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 13px; }
main > .defilement:has(> table.synthese) { align-self: flex-start; max-width: 100%; }
main > .defilement, main > table { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; }
th, td { padding: 8px 12px; border-bottom: 1px solid #edeff2; white-space: nowrap; text-align: left; }
thead th { font-weight: 600; color: var(--texte); background: var(--surface); }
thead th:first-child { position: sticky; left: 0; z-index: 1; }
tbody th[scope=row] { font-weight: 400; color: var(--texte); position: sticky; left: 0; background: var(--surface); }
td.n, th.n { text-align: right; }
tr.groupe th, tr.groupe td { background: var(--surface-2); }
tr.groupe th { font-weight: 600; color: var(--encre); }
/* Mois en cours : une bande continue sur toute la colonne. */
th.futur, td.futur { background: #fff9f5; }
th.courant, td.courant, tr.groupe td.courant { background: var(--accent-fond); box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
thead th.courant { color: #8a3300; box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent), inset 0 2px 0 var(--accent); }
tbody tr:last-child td.courant, tr.total td.courant { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent), inset 0 -2px 0 var(--accent); }
tr.total th, tr.total td { font-weight: 600; color: var(--encre); border-top: 2px solid var(--encre); border-bottom: 0; }
tr.total td.point-bas { background: var(--encre); color: #fff; }
tr.total td.point-bas .negatif { color: #ffb4ab; }

/* Téléphone */
@media (max-width: 860px) {
  .lateral { display: none; }
  .marque.mobile { display: flex; padding: 0; margin-right: auto; }
  .haut { padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--bord); justify-content: flex-start; flex-wrap: wrap; }
  .fraicheur li { height: 26px; font-size: 12px; }
  main { padding: 14px 16px 96px; gap: 14px; }
  h1 { font-size: 22px; }
  .cles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cle.forte { grid-column: 1 / -1; }
  .cle summary { font-size: 19px; }
  .cle.forte summary { font-size: 28px; }
  .carte { padding: 14px 16px; }
  .onglets { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--bord); padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); }
  .onglets a { flex: 1 1 0; display: flex; align-items: center; justify-content: center; min-height: 52px; font-size: 13px; font-weight: 500; color: var(--discret); text-decoration: none; }
  .onglets a.actif { color: #8a3300; box-shadow: inset 0 3px 0 var(--marque); }
}

/* Mode serveur : utilisateur connecté et page de connexion */
.haut .utilisateur { display: flex; align-items: center; gap: .6rem; margin-left: auto; font-size: .85rem; }
.connexion { min-height: 100vh; max-width: none; display: grid; place-items: center; padding: 16px; }
.connexion .carte { max-width: 380px; text-align: center; display: grid; gap: .8rem; justify-items: center; }
