/* Prospection MBW — identite Copilote : ivoire, vert foret, or. Vanilla, zero CDN. */

:root {
  --ivoire: #F5F1E8;
  --ivoire-clair: #FBF9F4;
  --foret: #14322A;
  --foret-clair: #1F4A3D;
  --foret-pale: #E4EBE7;
  --or: #DE9F26;
  --or-sombre: #B87F14;
  --encre: #17201C;
  --encre-douce: #5C6B64;
  --trait: #DFD8C8;
  --rouge: #A3341F;
  --vert-ok: #2F7A54;
  --rayon: 12px;
  --ombre: 0 1px 2px rgba(20, 50, 42, .05), 0 6px 18px rgba(20, 50, 42, .07);
  --ombre-forte: 0 10px 40px rgba(20, 50, 42, .18);
}

* { box-sizing: border-box; }

/* Les blocs masques par l'attribut hidden posent display:flex plus bas : sans ce
   rappel, la regle de classe gagne sur la feuille du navigateur et l'element
   masque reste affiche (et intercepte les clics). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ivoire);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .6rem; }
code, pre {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .85em;
}
pre {
  background: var(--foret);
  color: var(--ivoire-clair);
  padding: .8rem 1rem;
  border-radius: var(--rayon);
  overflow-x: auto;
  margin: 0 0 .8rem;
}
code { background: var(--foret-pale); padding: .1em .35em; border-radius: 4px; }
pre code { background: none; padding: 0; }
a { color: var(--foret-clair); }

.note { color: var(--encre-douce); font-size: .85rem; }

/* ------------------------------------------------------------ boutons */

.btn {
  display: inline-block;
  font: inherit;
  font-size: .87rem;
  font-weight: 500;
  padding: .45rem .85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--foret);
  color: var(--ivoire-clair);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:hover { background: var(--foret-clair); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-or { background: var(--or); color: #2A1D00; }
.btn-or:hover { background: var(--or-sombre); color: var(--ivoire-clair); }
.btn-fin {
  background: transparent;
  color: var(--foret);
  border-color: var(--trait);
}
.btn-fin:hover { background: #EDE7DA; }
.btn-rang { display: flex; flex-wrap: wrap; gap: .4rem; }

input, select, textarea {
  font: inherit;
  font-size: .9rem;
  color: var(--encre);
  background: #fff;
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: .42rem .6rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(222, 159, 38, .45);
  outline-offset: 1px;
  border-color: var(--or);
}
textarea { resize: vertical; line-height: 1.55; }
label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--encre-douce);
  margin: .55rem 0 .18rem;
}

/* ------------------------------------------------------------ ecran cle */

.ecran-cle {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.carte-cle { max-width: 27rem; width: 100%; }
.carte-cle button { margin-top: .8rem; width: 100%; }

/* ------------------------------------------------------------ barre haute */

.barre {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem 1rem;
  padding: .7rem 1.1rem;
  background: var(--foret);
  color: var(--ivoire-clair);
  box-shadow: var(--ombre);
}
.barre-gauche, .barre-droite {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.barre-droite { margin-left: auto; }
.marque {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding-right: .4rem;
  border-right: 1px solid rgba(245, 241, 232, .25);
}
.barre .btn-fin { color: var(--ivoire-clair); border-color: rgba(245, 241, 232, .32); }
.barre .btn-fin:hover { background: rgba(245, 241, 232, .12); }

.bascule {
  display: inline-flex;
  background: rgba(245, 241, 232, .12);
  border-radius: 8px;
  padding: 2px;
}
.bascule-item {
  font: inherit;
  font-size: .84rem;
  padding: .3rem .7rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(245, 241, 232, .78);
  cursor: pointer;
}
.bascule-item.actif { background: var(--or); color: #2A1D00; font-weight: 600; }

.recherche { width: 15rem; max-width: 42vw; }

.compteurs {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  font-size: .78rem;
}
.compteur {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: rgba(245, 241, 232, .1);
  color: rgba(245, 241, 232, .85);
}
.compteur b { color: var(--or); font-weight: 600; }
.compteur.total b { color: var(--ivoire-clair); }

/* ------------------------------------------------------------ bandeau erreur */

.bandeau {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1.1rem;
  background: #F6E3DE;
  color: var(--rouge);
  border-bottom: 1px solid #E4C6BE;
  font-size: .88rem;
}
.bandeau-fermer {
  margin-left: auto;
  font: inherit;
  font-size: .8rem;
  background: none;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: .1rem .5rem;
  color: inherit;
  cursor: pointer;
}
.bandeau.info { background: #E4EBE7; color: var(--foret); border-bottom-color: #CBD8D2; }

/* ------------------------------------------------------------ onglets */

.onglets {
  display: flex;
  gap: .2rem;
  padding: 0 1.1rem;
  background: var(--ivoire);
  border-bottom: 1px solid var(--trait);
  overflow-x: auto;
}
.onglet {
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  padding: .65rem .9rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--encre-douce);
  cursor: pointer;
  white-space: nowrap;
}
.onglet.actif { color: var(--foret); border-bottom-color: var(--or); }

.contenu { padding: 1.1rem; }

.carte {
  background: var(--ivoire-clair);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 1rem 1.1rem;
}
.accueil { max-width: 40rem; margin: 1.5rem auto; }
.accueil h2 { margin-bottom: .6rem; }

/* ------------------------------------------------------------ pipeline */

.colonnes {
  display: flex;
  gap: .8rem;
  overflow-x: auto;
  padding-bottom: .8rem;
  align-items: flex-start;
}
.colonne {
  flex: 0 0 16.5rem;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: .6rem;
  max-height: calc(100vh - 13rem);
  display: flex;
  flex-direction: column;
}
.colonne-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  padding: .1rem .25rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--foret);
  border-bottom: 1px solid var(--trait);
}
.colonne-tete .nb {
  font-size: .78rem;
  font-weight: 600;
  color: var(--encre-douce);
  background: var(--foret-pale);
  border-radius: 999px;
  padding: 0 .45rem;
  letter-spacing: 0;
}
.colonne-liste { overflow-y: auto; padding-top: .5rem; display: grid; gap: .5rem; }
.colonne-vide { font-size: .8rem; color: var(--encre-douce); padding: .3rem .25rem; }

.puce {
  background: #fff;
  border: 1px solid var(--trait);
  border-left: 3px solid var(--trait);
  border-radius: 10px;
  padding: .55rem .6rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 50, 42, .05);
}
.puce:hover { border-color: var(--or); }
.puce.chaud { border-left-color: var(--or); }
.puce.tiede { border-left-color: var(--foret-clair); }
.puce-tete { display: flex; align-items: baseline; gap: .4rem; }
.puce-nom { font-weight: 600; font-size: .88rem; flex: 1; overflow-wrap: anywhere; }
.puce-sous { font-size: .78rem; color: var(--encre-douce); margin: .1rem 0 .4rem; }
.puce select { font-size: .78rem; padding: .22rem .35rem; }

.score {
  flex: 0 0 auto;
  font-size: .74rem;
  font-weight: 700;
  padding: .05rem .4rem;
  border-radius: 999px;
  background: var(--foret-pale);
  color: var(--foret);
}
.score.chaud { background: rgba(222, 159, 38, .25); color: #7A5305; }
.score.vide { background: #EEE9DD; color: var(--encre-douce); font-weight: 500; }

/* ------------------------------------------------------------ tableau */

.enveloppe-table { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th, .table td {
  text-align: left;
  padding: .48rem .7rem;
  border-bottom: 1px solid var(--trait);
  white-space: nowrap;
}
.table th {
  position: sticky;
  top: 0;
  background: var(--foret-pale);
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--foret);
  cursor: pointer;
  user-select: none;
}
.table th.tri-asc::after { content: " \2191"; color: var(--or-sombre); }
.table th.tri-desc::after { content: " \2193"; color: var(--or-sombre); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #F1EDE2; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cel-nom { font-weight: 600; }
.table .cel-large { white-space: normal; min-width: 9rem; }

.etiquette {
  display: inline-block;
  font-size: .74rem;
  font-weight: 600;
  padding: .08rem .45rem;
  border-radius: 999px;
  background: var(--foret-pale);
  color: var(--foret);
}
.etiquette.or { background: rgba(222, 159, 38, .22); color: #7A5305; }
.etiquette.gagne { background: rgba(47, 122, 84, .18); color: var(--vert-ok); }
.etiquette.perdu { background: #EDE7DA; color: var(--encre-douce); }

/* ------------------------------------------------------------ tableau de bord */

.grille-bord {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: .9rem;
  align-items: start;
}
.tuile-nombre { display: flex; flex-direction: column; gap: .1rem; }
.tuile-nombre .valeur {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--foret);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tuile-nombre .libelle {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--encre-douce);
}
.rangee-tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: .8rem;
}

.mesure { margin-bottom: .75rem; }
.mesure-tete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem;
  font-size: .82rem;
  margin-bottom: .22rem;
}
.mesure-tete > span:first-child { flex: 1 1 auto; min-width: 0; }
.mesure-tete b { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.carte-large { grid-column: 1 / -1; }
.jauge { height: 8px; background: var(--foret-pale); border-radius: 999px; overflow: hidden; }
.jauge > span { display: block; height: 100%; background: var(--or); border-radius: 999px; }
.jauge.foret > span { background: var(--foret-clair); }

.barres {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 8rem;
  padding-top: .4rem;
}
.barre-jour { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.barre-jour > span {
  display: block;
  background: var(--foret-clair);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.barre-jour:hover > span { background: var(--or); }
.barres-legende {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--encre-douce);
  margin-top: .3rem;
}
.liste-nue { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.liste-nue li {
  padding: .4rem 0;
  border-bottom: 1px solid var(--trait);
  display: flex;
  gap: .5rem;
  align-items: baseline;
}
.liste-nue li:last-child { border-bottom: 0; }
.liste-nue .quand { margin-left: auto; font-size: .76rem; color: var(--encre-douce); white-space: nowrap; }
.vide-doux { color: var(--encre-douce); font-size: .85rem; }

/* ------------------------------------------------------------ fiche laterale */

.voile {
  position: fixed;
  inset: 0;
  background: rgba(20, 50, 42, .3);
  z-index: 30;
}
.fiche {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 33rem;
  max-width: 100vw;
  z-index: 31;
  background: var(--ivoire-clair);
  border-left: 1px solid var(--trait);
  box-shadow: var(--ombre-forte);
  display: flex;
  flex-direction: column;
}
.fiche-tete {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--trait);
  background: var(--ivoire-clair);
}
.fiche-tete h2 { overflow-wrap: anywhere; }
.fiche-sous { margin: 0; font-size: .84rem; color: var(--encre-douce); }
.fiche-corps { overflow-y: auto; padding: 1rem 1.1rem 3rem; }
.fiche-bloc { margin-bottom: 1.3rem; }
.fiche-bloc > h3 {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--encre-douce);
  padding-bottom: .3rem;
  margin-bottom: .55rem;
  border-bottom: 1px solid var(--trait);
}
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .7rem; }
.trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .7rem; }

.constats { list-style: none; margin: 0; padding: 0; font-size: .87rem; }
.constats li { padding: .26rem 0 .26rem .9rem; position: relative; }
.constats li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--or);
}
.faits { display: flex; flex-wrap: wrap; gap: .3rem .4rem; margin-bottom: .6rem; }
.fait {
  font-size: .76rem;
  background: var(--foret-pale);
  border-radius: 6px;
  padding: .1rem .45rem;
  color: var(--foret);
}
.fait.alerte { background: #F6E3DE; color: var(--rouge); }

.msg-zone textarea { min-height: 15rem; font-size: .88rem; }
.msg-etat { font-size: .78rem; color: var(--encre-douce); margin: .4rem 0 .2rem; }
.msg-etat.ok { color: var(--vert-ok); }
.msg-etat.souci { color: var(--rouge); }
.attente { opacity: .55; pointer-events: none; }

@media (max-width: 900px) {
  .fiche { width: 100%; border-left: 0; }
  .recherche { width: 100%; max-width: none; }
  .barre-droite { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 680px) {
  .contenu { padding: .7rem; }
  .colonnes { display: block; overflow-x: visible; }
  .colonne { flex: none; width: auto; max-height: none; margin-bottom: .8rem; }
  /* Sur mobile les colonnes vides n'apportent rien et allongent la page. */
  .colonne-sans { display: none; }
  .duo, .trio { grid-template-columns: 1fr; }
  .marque { border-right: 0; }
}
