/* EGM Administration — mêmes couleurs, même logo et mêmes composants que
   l'application Superviseur (egm-superviseur.vercel.app). */

:root {
  --bleu: #1b75bc;
  --bleu-fonce: #14578c;
  --rouge: #e11b22;
  --vert: #3aaa35;
  --orange: #f7941d;
  --ardoise: #2a3441;
  --gris: #5a6470;
  --fond: #e9ebee;
  --fond-bleu: #eaf1f8;
  --blanc: #ffffff;
  --bord: #d5dae1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--fond);
  color: var(--ardoise);
  font-size: 16px;
  line-height: 1.45;
}
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- En-tête et navigation ---------- */
.entete {
  background: var(--bleu);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.entete .marque { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: #fff; }
.entete .marque a { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.entete .sous-titre { font-size: 12px; font-weight: 400; opacity: 0.9; display: block; }
.entete .espace { flex: 1; }
.entete .utilisateur { font-size: 14px; opacity: 0.95; }
.plaque-logo { background: #fff; border-radius: 8px; padding: 5px 10px; display: inline-flex; align-items: center; }
.plaque-logo img { height: 24px; width: auto; display: block; }

.nav {
  background: var(--bleu-fonce);
  padding: 6px 12px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav a {
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.nav a:hover, .nav a.actif { background: rgba(255, 255, 255, 0.18); text-decoration: none; }
.nav a.bientot { opacity: 0.55; }

.contenu { max-width: 1180px; margin: 0 auto; padding: 16px; }

/* ---------- Cartes et statistiques ---------- */
.carte {
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.carte h2 { font-size: 17px; margin-bottom: 12px; color: var(--bleu); }
.carte h3 { font-size: 15px; margin: 12px 0 8px; }

.grille-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-left: 5px solid var(--bleu);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat .valeur { font-size: 26px; font-weight: 800; }
.stat .libelle { font-size: 13px; color: var(--gris); }
.stat.vert { border-left-color: var(--vert); }
.stat.orange { border-left-color: var(--orange); }
.stat.rouge { border-left-color: var(--rouge); }

/* ---------- Tableaux ---------- */
.defile { overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; font-size: 14px; }
table.liste th {
  text-align: left;
  background: var(--fond-bleu);
  color: var(--bleu-fonce);
  padding: 8px 10px;
  border-bottom: 2px solid var(--bord);
  white-space: nowrap;
}
table.liste td { padding: 8px 10px; border-bottom: 1px solid var(--fond); vertical-align: middle; }
table.liste tr:hover td { background: #f7f9fb; }
table.liste td.actions { white-space: nowrap; text-align: right; }
table.liste input[type="checkbox"] { width: 18px; height: 18px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.valide { background: #e4f4e3; color: #1f7a1b; }
.badge.attente { background: #fdeedd; color: #b26206; }
.badge.rejete { background: #fbe2e3; color: var(--rouge); }
.badge.neutre { background: var(--fond); color: var(--gris); }
.badge.bleu { background: var(--fond-bleu); color: var(--bleu-fonce); }

/* ---------- Formulaires ---------- */
form.pile { display: flex; flex-direction: column; gap: 10px; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
label.champ { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--gris); }
label.case { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ardoise); padding: 3px 0; }
label.case input { width: 18px; height: 18px; flex: none; }
input, select, textarea {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  color: var(--ardoise);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bleu); border-color: var(--bleu); }
textarea { min-height: 70px; resize: vertical; }

.bouton {
  display: inline-block;
  background: var(--bleu);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
}
.bouton:hover { background: var(--bleu-fonce); text-decoration: none; color: #fff; }
.bouton.vert { background: var(--vert); }
.bouton.vert:hover { background: #2e8a2a; }
.bouton.rouge { background: var(--rouge); }
.bouton.rouge:hover { background: #b3151b; }
.bouton.orange { background: var(--orange); }
.bouton.discret { background: var(--fond-bleu); color: var(--bleu-fonce); }
.bouton.discret:hover { background: #d9e8f5; color: var(--bleu-fonce); }
.bouton.petit { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.bouton.large { display: block; width: 100%; font-size: 17px; padding: 15px; }
.bouton:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Messages ---------- */
.message { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; font-size: 14.5px; }
.message.ok { background: #e4f4e3; color: #1f7a1b; border: 1px solid #bfe3bd; }
.message.erreur { background: #fbe2e3; color: var(--rouge); border: 1px solid #f3bcbe; }
.message.info { background: var(--fond-bleu); color: var(--bleu-fonce); border: 1px solid #c3d9ec; }
.message.code { background: #fff8e6; color: #7a4d00; border: 1px solid #f3dca0; font-weight: 500; }
.message.code strong { font-size: 18px; letter-spacing: 1px; }

/* ---------- Divers ---------- */
.ligne-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.espace-flex { flex: 1; }
.muet { color: var(--gris); font-size: 13px; }
.titre-page { font-size: 21px; margin: 4px 0 14px; }
.titre-page small { display: block; font-size: 13.5px; font-weight: 400; color: var(--gris); }
.vide { text-align: center; color: var(--gris); padding: 22px 10px; }
.barre-filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.barre-filtres > * { flex: 1 1 150px; min-width: 130px; }
.barre-filtres .fixe { flex: 0 0 auto; }

.onglets { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 2px solid var(--bord); }
.onglets button {
  background: none; border: none; font: inherit; font-weight: 700; color: var(--gris);
  padding: 9px 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.onglets button.actif { color: var(--bleu); border-bottom-color: var(--bleu); }

.liste-cases { max-height: 320px; overflow-y: auto; border: 1px solid var(--bord); border-radius: 8px; padding: 6px 10px; margin: 8px 0; }

/* ---------- Fenêtre modale ---------- */
.fond-modal {
  position: fixed; inset: 0; background: rgba(20, 30, 45, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 12px; overflow-y: auto; z-index: 50;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.large { max-width: min(1200px, 96vw); }
.modal h2 { font-size: 18px; color: var(--bleu); margin-bottom: 12px; }
.modal .pied { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Connexion ---------- */
.page-connexion { max-width: 420px; margin: 8vh auto; padding: 16px; }
.page-connexion .carte { text-align: center; padding-top: 28px; }
.page-connexion form { text-align: left; }
.page-connexion img.logo-connexion { height: 54px; width: auto; margin-bottom: 12px; }

/* ---------- QR ---------- */
.qr-boite { text-align: center; }
.qr-boite img { width: 100%; max-width: 280px; background: #fff; border: 1px solid var(--bord); border-radius: 8px; }

#carte-pointage { height: 380px; border-radius: 10px; border: 1px solid var(--bord); }
.carte-trace { height: clamp(380px, 62vh, 640px); border-radius: 10px; border: 1px solid var(--bord); }

/* ---------- Barres (statistiques) ---------- */
.barres { display: flex; flex-direction: column; gap: 6px; }
.barre { display: grid; grid-template-columns: 160px 1fr 120px; gap: 8px; align-items: center; }
.barre .nom { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre .rail { background: var(--fond); border-radius: 6px; height: 18px; }
.barre .rail div { background: var(--bleu); height: 18px; border-radius: 6px; }
.barre .val { font-size: 13px; }

/* ---------- Photos ---------- */
.grille-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grille-photos img { max-width: 100%; border-radius: 10px; border: 1px solid var(--bord); background: #f3f4f6; min-height: 90px; object-fit: contain; }
.grille-photos figcaption { font-size: 13px; margin-top: 4px; }

/* ---------- Pastille de notifications ---------- */
.cloche { position: relative; }
.cloche .compte { background: var(--rouge); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 6px; margin-left: 4px; font-weight: 700; }
.notif { border-left: 4px solid var(--orange); background: #fff8e6; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.notif.lue { border-left-color: var(--bord); background: #f7f9fb; opacity: .75; }
.notif strong { display: block; }

/* ---------- Document imprimable ---------- */
.document { background: #fff; }
.document .bandeau-doc { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--bleu); padding-bottom: 12px; margin-bottom: 14px; }
.document .bandeau-doc img { height: 40px; width: auto; }
.document .bandeau-doc small { font-size: 12px; color: var(--gris); }
.signatures { display: flex; justify-content: space-between; gap: 24px; margin-top: 30px; font-size: 13.5px; flex-wrap: wrap; }
.signatures > div { text-align: center; }
.signatures .trait { border-top: 1px solid var(--ardoise); width: 190px; margin-top: 52px; }
table.fiche { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.fiche th, table.fiche td { border: 1px solid #8a94a0; padding: 8px 10px; vertical-align: middle; }
table.fiche th { background: var(--fond-bleu); color: var(--bleu-fonce); text-align: left; }

@media print {
  .nav, .entete, .bouton, .non-imprimable, .onglets, #messages { display: none !important; }
  body { background: #fff; }
  .contenu { max-width: none; padding: 0; }
  .carte { border: none; padding: 0; }
  .defile { overflow: visible; }
}

@media (max-width: 640px) {
  .barre { grid-template-columns: 100px 1fr 90px; }
  .contenu { padding: 10px; }
  .entete { padding: 10px 12px; }
  table.liste { font-size: 13px; }
}


/* ---------- Carte en direct (accueil) ---------- */
.contenu.plein-ecran { max-width: none; padding: 8px 10px 0; }
.carte-direct { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 480px); gap: 10px; height: calc(100vh - 150px); min-height: 420px; }
.zone-carte { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--bord); background: #fff; min-height: 0; }
#grande-carte { position: absolute; inset: 0; }
.legende-carte { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: rgba(255, 255, 255, 0.95); border: 1px solid var(--bord); border-radius: 8px;
  padding: 6px 10px; display: flex; gap: 12px; font-size: 12.5px; }
.pt, .voyant { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; }
.pt.vert, .voyant.vert { background: var(--vert); box-shadow: 0 0 0 3px rgba(58, 170, 53, 0.25); }
.pt.orange, .voyant.orange { background: var(--orange); }
.pt.gris, .voyant.gris { background: #9aa3ad; }
.panneau-hotesses { background: #fff; border: 1px solid var(--bord); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; }
.entete-panneau { padding: 12px 12px 8px; border-bottom: 1px solid var(--bord); }
.entete-panneau h2 { font-size: 16px; color: var(--bleu); margin-bottom: 6px; }
.compteurs { display: flex; gap: 12px; font-size: 12.5px; color: var(--gris); margin-bottom: 8px; flex-wrap: wrap; }
.compteurs strong { color: var(--ardoise); font-size: 15px; }
.liste-hotesses { overflow-y: auto; flex: 1; min-height: 0; }
.ligne-hotesse { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #eef0f3; cursor: pointer; }
.ligne-hotesse:hover { background: var(--fond-bleu); }
.ligne-hotesse.choisie { background: #dcebf8; }
.ligne-hotesse .identite { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ligne-hotesse .identite strong { font-size: clamp(14px, 1vw, 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-hotesse .identite small { color: var(--gris); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arret-num { background: var(--orange); color: #fff; border-radius: 50%; width: 24px; height: 24px; line-height: 24px; text-align: center; font-weight: 700; border: 2px solid #fff; }
@media (max-width: 800px) {
  .carte-direct { grid-template-columns: 1fr; height: auto; }
  .zone-carte { height: 55vh; }
  .panneau-hotesses { max-height: 50vh; }
}

/* ---------- Cloche et notifications ---------- */
.cloche { position: relative; color: #fff; font-size: 20px; text-decoration: none; padding: 2px 6px; }
.cloche:hover { text-decoration: none; }
.cloche span { position: absolute; top: -6px; right: -6px; background: var(--rouge); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center; }
.notif { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid #eef0f3; }
.notif.nouvelle { background: #fffaf2; }
.notif-icone { font-size: 20px; }
.notif-texte { flex: 1; }


/* ---------- Tracé d'un trajet ---------- */
.fleche-trace { color: #0f4c7d; font-size: 15px; line-height: 16px; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.repere-coupure { background: var(--orange); color: #fff; width: 26px; height: 26px; line-height: 26px; border-radius: 50%; text-align: center; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.legende-trace { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--gris); margin-top: 8px; }
.legende-trace i.trait-bleu { display: inline-block; width: 22px; height: 5px; background: #1b75bc; border-radius: 3px; vertical-align: middle; }
.pt.rouge { background: var(--rouge); }
.mini-coupure { display: inline-block; background: var(--orange); color: #fff; border-radius: 50%; width: 16px; height: 16px; line-height: 16px; text-align: center; font-size: 9px; }
