/* =====================================================================
   UDOPER — feuille de style unique
   Vert institutionnel #78B843. Interface pensée pour un usage de terrain :
   gros champs, contrastes francs, lisible sur téléphone.
   ===================================================================== */

:root {
  --vert: #78B843;
  --vert-fonce: #5D9130;
  --vert-pale: #F1F8EA;
  --rouge: #C0392B;
  --rouge-pale: #FDECEA;
  --orange: #B9770E;
  --texte: #1E2A16;
  --gris: #667085;
  --bord: #D8DEE3;
  --fond: #F6F8F4;
  --blanc: #FFFFFF;
  --rayon: 10px;
  --ombre: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

/* --- En-tête --------------------------------------------------------- */
header.barre {
  background: var(--vert);
  color: #fff;
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--ombre);
}
header.barre h1 { font-size: 1.05rem; margin: 0; font-weight: 700; letter-spacing: .2px; }
header.barre .qui { margin-left: auto; font-size: .87rem; opacity: .95; text-align: right; }
header.barre .qui strong { display: block; }

main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }

/* --- Onglets ---------------------------------------------------------
   Le panneau du RAC comptait six sections empilées : on passait son
   temps à faire défiler. Chaque section devient un onglet. */
nav.onglets {
  display: flex;
  gap: .25rem;
  background: var(--blanc);
  border-bottom: 1px solid var(--bord);
  padding: 0 1rem;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 10;
  scrollbar-width: thin;
}
nav.onglets button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--gris);
  font-size: .9rem;
  font-weight: 600;
  padding: .75rem .9rem;
  white-space: nowrap;
}
nav.onglets button:hover { background: var(--vert-pale); color: var(--vert-fonce); }
nav.onglets button[aria-selected="true"] {
  color: var(--vert-fonce);
  border-bottom-color: var(--vert);
  background: none;
}
nav.onglets .pastille {
  display: inline-block;
  min-width: 1.15rem;
  margin-left: .35rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: .72rem;
  line-height: 1.15rem;
  text-align: center;
}
nav.onglets .pastille:empty, nav.onglets .pastille[hidden] { display: none; }

section.panneau[hidden] { display: none; }

/* --- Progression ----------------------------------------------------- */
.jauge {
  height: 9px; border-radius: 999px; background: var(--bord);
  overflow: hidden; margin: .5rem 0;
}
.jauge > div { height: 100%; background: var(--vert); width: 0; transition: width .15s; }

.journal {
  max-height: 260px; overflow-y: auto; font-size: .82rem;
  border: 1px solid var(--bord); border-radius: 7px; padding: .5rem .7rem;
  background: #FBFCFA; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.journal div { padding: .1rem 0; }
.journal .ko { color: var(--rouge); }
.journal .ok { color: var(--vert-fonce); }

/* --- Blocs ----------------------------------------------------------- */
.carte {
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 1.1rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--ombre);
}
.carte h2 { margin: 0 0 .9rem; font-size: 1rem; color: var(--vert-fonce); }

/* --- Compteurs ------------------------------------------------------- */
.compteurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; }
.compteur {
  background: var(--blanc); border: 1px solid var(--bord);
  border-left: 4px solid var(--vert);
  border-radius: var(--rayon); padding: .8rem .9rem;
}
.compteur .valeur { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.compteur .libelle { font-size: .8rem; color: var(--gris); }
.compteur.alerte { border-left-color: var(--orange); }
.compteur.rouge  { border-left-color: var(--rouge); }

/* --- Formulaires ----------------------------------------------------- */
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem 1rem; }
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .25rem; }
label .obl { color: var(--rouge); }
input, select, textarea {
  width: 100%; padding: .55rem .65rem; font-size: .95rem; font-family: inherit;
  border: 1px solid var(--bord); border-radius: 7px; background: var(--blanc); color: var(--texte);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--vert); box-shadow: 0 0 0 3px rgba(120, 184, 67, .18);
}
input[type=file] { padding: .4rem; }
.aide { font-size: .76rem; color: var(--gris); margin-top: .2rem; }

button, .bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .58rem 1.1rem; font-size: .92rem; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; border-radius: 7px; cursor: pointer;
  background: var(--vert); color: #fff; text-decoration: none;
}
button:hover, .bouton:hover { background: var(--vert-fonce); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondaire { background: var(--blanc); color: var(--texte); border-color: var(--bord); }
button.secondaire:hover { background: #EEF2EA; }
button.danger { background: var(--rouge); }
button.danger:hover { background: #982A1E; }

/* --- Tableaux -------------------------------------------------------- */
.tableau-defilant { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--bord); white-space: nowrap; }
th { background: var(--vert-pale); color: var(--vert-fonce); font-weight: 700; position: sticky; top: 0; }
tbody tr:hover { background: #FAFCF8; }
td.nombre, th.nombre { text-align: right; }

/* Fiche en doublon à réattribuer : signalée en rouge, comme demandé. */
tr.a-reattribuer { background: var(--rouge-pale); }
tr.a-reattribuer:hover { background: #FBDDD9; }
tr.a-reattribuer td:first-child { border-left: 4px solid var(--rouge); font-weight: 700; }

/* --- Étiquettes d'état ----------------------------------------------- */
.etat { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.etat.attente  { background: #FEF6E7; color: var(--orange); }
.etat.approuve { background: var(--vert-pale); color: var(--vert-fonce); }
.etat.rejete   { background: var(--rouge-pale); color: var(--rouge); }
.etat.doublon  { background: var(--rouge); color: #fff; }

/* --- Messages -------------------------------------------------------- */
.message { padding: .7rem .9rem; border-radius: 7px; margin-bottom: 1rem; font-size: .9rem; }
.message.succes { background: var(--vert-pale); color: var(--vert-fonce); border: 1px solid #BFE0A0; }
.message.erreur { background: var(--rouge-pale); color: var(--rouge); border: 1px solid #F3C1BB; }
.message.info   { background: #EAF2FB; color: #1B4F86; border: 1px solid #C2DAF3; }
.message:empty  { display: none; }

/* --- Connexion ------------------------------------------------------- */
.connexion { max-width: 400px; margin: 8vh auto; }
.connexion .logo { text-align: center; margin-bottom: 1.4rem; }
.connexion .logo .rond {
  width: 62px; height: 62px; border-radius: 50%; background: var(--vert); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; margin-bottom: .5rem;
}
.connexion .logo h1 { font-size: 1.15rem; margin: 0; }
.connexion .logo p { margin: .2rem 0 0; color: var(--gris); font-size: .87rem; }

/* --- Aperçu photo ---------------------------------------------------- */
.apercu {
  width: 108px; height: 135px; border: 1px dashed var(--bord); border-radius: 7px;
  background: var(--fond) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: .74rem; color: var(--gris); text-align: center; padding: .4rem;
}

.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.pousse-droite { margin-left: auto; }
.discret { color: var(--gris); font-size: .84rem; }

@media (max-width: 640px) {
  header.barre h1 { font-size: .95rem; }
  main { padding: .9rem .7rem 3rem; }
}
