/* Cockpit SEO — feuille de style unique.
   Densite avant decoration : c'est un ecran de lundi matin, on doit voir
   trente-trois clients sans faire defiler. */

:root {
  --rail: #10151c;
  --rail-actif: #1d2836;
  --fond: #f4f6f8;
  --carte: #ffffff;
  --bord: #e2e6eb;
  --bord-fort: #cfd5dd;
  --texte: #161c24;
  --attenue: #6b7481;
  --accent: #2563eb;
  --positif: #0f7b3f;
  --positif-fond: #e8f5ec;
  --negatif: #b3261e;
  --negatif-fond: #fdecea;
  --alerte: #8a5a00;
  --alerte-fond: #fff5e0;
  --ombre: 0 1px 2px rgba(16, 21, 28, .06), 0 1px 3px rgba(16, 21, 28, .04);
  --rayon: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 14px/1.45 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Structure ---------- */

.coque { display: flex; min-height: 100vh; }

.rail {
  width: 216px;
  flex: 0 0 216px;
  background: var(--rail);
  color: #aeb8c4;
  padding: 14px 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail .marque {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 4px 18px 2px;
  letter-spacing: .2px;
}

.rail .semaine {
  color: #7d8896;
  font-size: 12px;
  padding: 0 18px 14px;
  border-bottom: 1px solid #1e2732;
  margin-bottom: 10px;
}

.rail a {
  display: block;
  padding: 7px 18px;
  color: #aeb8c4;
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.rail a:hover { background: #171f29; color: #e6ecf3; text-decoration: none; }
.rail a.actif {
  background: var(--rail-actif);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}

.rail .groupe {
  color: #5c6673;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 14px 18px 5px;
}

.contenu { flex: 1; min-width: 0; padding: 18px 22px 60px; }

.entete {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.entete h1 { font-size: 20px; margin: 0; font-weight: 650; }
.entete .sous { color: var(--attenue); font-size: 13px; }
.entete .droite { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- Cartes de synthese ---------- */

.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 11px 13px;
  box-shadow: var(--ombre);
}
.carte .libelle {
  color: var(--attenue);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 5px;
}
.carte .valeur { font-size: 23px; font-weight: 650; letter-spacing: -.4px; }
.carte .precision { color: var(--attenue); font-size: 11.5px; margin-top: 3px; }
.carte .valeur.positif { color: var(--positif); }
.carte .valeur.negatif { color: var(--negatif); }

/* ---------- Blocs ---------- */

.bloc {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  margin-bottom: 16px;
  overflow: hidden;
}
.bloc > h2 {
  font-size: 13.5px;
  font-weight: 650;
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--bord);
  display: flex;
  align-items: center;
  gap: 10px;
}
.bloc > h2 .compte {
  color: var(--attenue);
  font-weight: 400;
  font-size: 12px;
}
.bloc .corps { padding: 12px 14px; }
.deux-colonnes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) { .deux-colonnes { grid-template-columns: 1fr; } }

/* ---------- Tableaux ---------- */

.defilement { overflow-x: auto; max-height: 78vh; overflow-y: auto; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }

thead th {
  position: sticky;
  top: 0;
  background: #f7f9fb;
  border-bottom: 1px solid var(--bord-fort);
  padding: 7px 9px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  color: #48515c;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}
thead th:hover { color: var(--texte); }
thead th.num, td.num { text-align: right; }
thead th::after { content: ""; }
thead th.tri-asc::after { content: " ▲"; font-size: 9px; }
thead th.tri-desc::after { content: " ▼"; font-size: 9px; }

tbody td {
  padding: 6px 9px;
  border-bottom: 1px solid #eef1f4;
  white-space: nowrap;
}
tbody tr:hover { background: #f8fafc; }
td.long { white-space: normal; min-width: 260px; max-width: 460px; }

.positif { color: var(--positif); }
.negatif { color: var(--negatif); }
.neutre { color: var(--attenue); }

td.cellule-positif { background: var(--positif-fond); color: var(--positif); font-weight: 600; }
td.cellule-negatif { background: var(--negatif-fond); color: var(--negatif); font-weight: 600; }
td.cellule-alerte { background: var(--alerte-fond); color: var(--alerte); font-weight: 600; }

.pastille {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.pastille.perte { background: var(--negatif-fond); color: var(--negatif); }
.pastille.opportunite { background: #e8f1fe; color: #1d4ed8; }
.pastille.hygiene { background: #f1f0fb; color: #5b4bb5; }
.pastille.p1 { background: var(--negatif); color: #fff; }
.pastille.p2 { background: #fde9c8; color: #8a5a00; }
.pastille.p3 { background: #eceff3; color: #59626d; }
.pastille.pack { background: #eceff3; color: #59626d; font-weight: 500; }
.pastille.revenu { background: #ffe8e6; color: var(--negatif); }

/* ---------- Statuts d'action ---------- */

.statuts { display: inline-flex; gap: 2px; }
.statuts button {
  border: 1px solid var(--bord-fort);
  background: #fff;
  color: #59626d;
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.5;
}
.statuts button:first-child { border-radius: 4px 0 0 4px; }
.statuts button:last-child { border-radius: 0 4px 4px 0; }
.statuts button:hover { background: #f1f4f8; }
.statuts button.actif { background: var(--rail); color: #fff; border-color: var(--rail); }
.statuts button.actif[data-statut="fait"] { background: var(--positif); border-color: var(--positif); }
.statuts button.actif[data-statut="ecarte"] { background: #7c848f; border-color: #7c848f; }
.statuts button.actif[data-statut="pris"] { background: var(--accent); border-color: var(--accent); }

/* ---------- Notes de lecture ---------- */

.notes { margin-bottom: 14px; display: grid; gap: 7px; }
.note {
  border-left: 3px solid var(--alerte);
  background: var(--alerte-fond);
  color: #4a3a12;
  padding: 8px 12px;
  font-size: 12.5px;
  border-radius: 0 6px 6px 0;
}
.note.alerte { border-left-color: var(--negatif); background: var(--negatif-fond); color: #6b1c17; }
.note strong { font-weight: 650; }
.notes.repliees .note { display: none; }
.bascule-notes {
  background: none;
  border: 1px solid var(--bord-fort);
  border-radius: 20px;
  color: var(--attenue);
  font-size: 11.5px;
  padding: 2px 11px;
  cursor: pointer;
}
.bascule-notes:hover { color: var(--texte); border-color: var(--attenue); }

/* ---------- Formulaires ---------- */

select, input[type="text"], input[type="password"], input[type="search"] {
  border: 1px solid var(--bord-fort);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--texte);
  max-width: 260px;
}
select:focus, input:focus { outline: 2px solid #bfd3fb; border-color: var(--accent); }

.filtres {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filtres label { color: var(--attenue); font-size: 12px; }

.bouton {
  border: 1px solid var(--bord-fort);
  background: #fff;
  border-radius: 6px;
  padding: 5px 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--texte);
}
.bouton:hover { background: #f1f4f8; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { background: #1d4ed8; }

/* ---------- Graphiques ---------- */

.graphique { position: relative; height: 260px; }
.graphique.haut { height: 330px; }

/* ---------- Connexion ---------- */

.connexion {
  max-width: 320px;
  margin: 14vh auto;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 22px;
  box-shadow: var(--ombre);
}
.connexion h1 { font-size: 17px; margin: 0 0 4px; }
.connexion p { color: var(--attenue); font-size: 13px; margin: 0 0 16px; }
.connexion input { width: 100%; max-width: none; margin-bottom: 10px; }
.connexion .bouton { width: 100%; }
.erreur { color: var(--negatif); font-size: 12.5px; margin-bottom: 10px; }

.vide { color: var(--attenue); padding: 22px 14px; text-align: center; font-size: 13px; }

/* ---------- Declaration d'intervention ---------- */

.voile {
  position: fixed;
  inset: 0;
  background: rgba(16, 21, 28, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.dialogue {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: 0 10px 40px rgba(16, 21, 28, .25);
  padding: 20px 22px;
  width: min(440px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialogue h3 { margin: 0; font-size: 16px; }
.dialogue .precision { margin: -6px 0 4px; color: var(--attenue); font-size: 12px; }

.dialogue label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--attenue);
}

.dialogue input,
.dialogue select {
  font: inherit;
  font-weight: 400;
  color: var(--texte);
  padding: 7px 9px;
  border: 1px solid var(--bord-fort);
  border-radius: 6px;
  background: #fff;
}

.dialogue .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ---------- Verdicts d'impact ---------- */

.pastille.apris { background: var(--positif-fond); color: var(--positif); }
.pastille.aregresse { background: var(--negatif-fond); color: var(--negatif); }
.pastille.neutre { background: #eceff3; color: #59626d; }
.pastille.troptot { background: var(--alerte-fond); color: var(--alerte); }
.pastille.sanstemoin,
.pastille.nonmesurable { background: #f1f0fb; color: #5b4bb5; }

.pastille.manuel { background: #eceff3; color: #59626d; }
.pastille.valide { background: #e8f1fe; color: #1d4ed8; }
.pastille.auto { background: var(--positif-fond); color: var(--positif); }
