:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #15181d;
  --ink-2: #4a5160;
  --muted: #7b8291;
  --line: #e2e5ea;
  --line-2: #eef0f3;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e9f1fb;
  --accent-contraste: #ffffff;
  --accent-2: #86b6ef;
  --accent-2-contraste: #0d2e57;
  --bar: #2a78d6;
  --bar-muted: #c9d3df;
  --critique: #d03b3b;
  --alerte: #e3a008;
  --info: #5b6b82;
  --ok: #0c8a0c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- en-tête */
.entete {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.entete .cadre { display: flex; align-items: center; gap: 28px; height: 56px; }
.marque { font-weight: 650; font-size: 16px; color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 12px; }
.marque img { height: 26px; width: auto; display: block; }
.marque .sep { width: 1px; height: 22px; background: var(--line); }
.marque:hover { text-decoration: none; }
.entete { border-top: 3px solid var(--accent); }
.marque .radar { color: var(--accent-ink); }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--ink-2); padding: 8px 12px; border-radius: 8px; font-weight: 500;
}
.nav a:hover { background: var(--line-2); text-decoration: none; }
.nav a.actif { color: var(--ink); background: var(--accent-soft); }
.espace { flex: 1; }
.badge-acces {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2);
  white-space: nowrap;
}
.badge-acces.demo { border-color: #cfe0f6; background: var(--accent-soft); color: var(--accent-ink); }
.lien-discret { color: var(--muted); font-size: 13px; white-space: nowrap; }

.cadre { max-width: 1320px; margin: 0 auto; padding: 0 28px; }
main.cadre { padding-top: 24px; padding-bottom: 48px; }

.titre-page { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.titre-page p { margin: 4px 0 0; color: var(--ink-2); }

/* ---------- cartes */
.carte-bloc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.carte-bloc > h2 { margin-bottom: 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.carte-bloc > h2 .muted { font-weight: 400; font-size: 12px; }
.grille { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
.g-fiche { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.pile { display: grid; gap: 16px; }

/* ---------- tuiles */
.tuile { padding: 16px 18px; }
.tuile .valeur { font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tuile .libelle { color: var(--ink-2); margin-top: 2px; }
.tuile .sous { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- barres horizontales */
.barres { display: grid; gap: 6px; }
.barre-ligne {
  display: grid; grid-template-columns: 210px 1fr 64px; gap: 12px; align-items: center;
  padding: 5px 6px; border-radius: 6px; color: var(--ink);
}
a.barre-ligne:hover { background: var(--line-2); text-decoration: none; }
.barre-ligne .nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-ligne .piste { height: 10px; position: relative; }
.barre-ligne .plein {
  position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar);
  border-radius: 0 4px 4px 0; min-width: 2px;
}
.barre-ligne .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.barre-ligne.bientot { color: var(--muted); }
.barre-ligne.bientot .val { font-weight: 400; }
.chip {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: var(--line-2); color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.chip.prio { background: var(--accent-soft); color: var(--accent-ink); }
.chip.nouveau { background: #e7f5e7; color: #0a6b0a; }
.chip.client { background: #f2eefc; color: #4b3aa6; }

/* ---------- pastilles de signaux */
.signaux { display: flex; flex-wrap: wrap; gap: 6px; }
.pastille {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.3;
  padding: 3px 9px 3px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); white-space: nowrap;
}
.pastille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--info); flex: none; }
.pastille.critique::before { background: var(--critique); }
.pastille.alerte::before { background: var(--alerte); }
.plus { font-size: 12px; color: var(--muted); align-self: center; }

/* ---------- onglets segments */
.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.onglet {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 500;
}
.onglet:hover { text-decoration: none; border-color: #c8ced8; }
.onglet .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.onglet.actif { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.onglet.actif .n { color: var(--accent-ink); }
.onglet.bientot { color: var(--muted); background: transparent; border-style: dashed; cursor: default; }

/* ---------- filtres */
.filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtres select, .filtres input[type=search] {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); min-width: 160px;
}
.filtres label.case { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); }
.filtres .compte { margin-left: auto; color: var(--ink-2); }

/* ---------- tableau */
table.liste { width: 100%; border-collapse: collapse; }
table.liste th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
}
table.liste td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.liste tr:last-child td { border-bottom: 0; }
table.liste tbody tr:hover td { background: #fafcff; }
.bloc-table { padding: 0; overflow: hidden; }
.org-nom { font-weight: 600; color: var(--ink); }
.org-profil { color: var(--muted); font-size: 12px; margin-top: 2px; }
.score {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 26px;
  border-radius: 6px; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.score.s3 { background: var(--accent); color: var(--accent-contraste); }
.score.s2 { background: var(--accent-2); color: var(--accent-2-contraste); }
.offre { font-size: 13px; color: var(--ink-2); }

tr.flou td { filter: blur(5px); user-select: none; pointer-events: none; color: var(--ink-2); }
.voile {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #f7f9fc, #eef3fa);
}
.voile .icone { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); flex: none; }
.voile strong { font-size: 15px; }
.pagination { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line-2); }
.bouton {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 500; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.bouton:hover { border-color: #c8ced8; text-decoration: none; }
.bouton.primaire { background: var(--accent); border-color: var(--accent); color: var(--accent-contraste); }

/* ---------- fiche */
.fiche-entete { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 18px; }
.fiche-entete .meta { color: var(--ink-2); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.jauge { text-align: center; min-width: 120px; }
.jauge .valeur { font-size: 34px; font-weight: 700; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.jauge .piste { height: 6px; background: var(--line-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.jauge .plein { height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; }
.signal-ligne { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.signal-ligne:last-child { border-bottom: 0; }
.signal-ligne .quand { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.offre-bloc { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.offre-bloc + .offre-bloc { margin-top: 10px; }
.offre-bloc .titre { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.offre-bloc .titre strong { font-size: 14px; }
.offre-bloc .raisons { color: var(--muted); font-size: 12px; margin-top: 2px; }
.produits { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.produits li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.produits .prix { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mention { font-size: 11px; font-weight: 600; color: #8a5a00; background: #fff4dc; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
dl.profil { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; }
dl.profil dt { color: var(--muted); }
dl.profil dd { margin: 0; }
#mini-carte { height: 220px; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- carte */
#carte { height: calc(100vh - 210px); min-height: 520px; border-radius: var(--radius); border: 1px solid var(--line); }
.legende { display: flex; gap: 16px; align-items: center; color: var(--ink-2); font-size: 12px; }
.legende .rond { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.leaflet-popup-content { font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* ---------- connexion / verrou */
.centre { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.boite { width: 380px; max-width: 100%; }
.boite input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; }
.erreur { color: var(--critique); }

.pied { color: var(--muted); font-size: 12px; padding: 18px 0 28px; display: flex; gap: 16px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g2, .g-fiche { grid-template-columns: 1fr; }
  .barre-ligne { grid-template-columns: 150px 1fr 56px; }
}
@media (max-width: 640px) {
  .cadre { padding: 0 16px; }
  .entete .cadre { gap: 12px; height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .g4 { grid-template-columns: 1fr; }
  table.liste .col-offre, table.liste .col-elements { display: none; }
}

/* ---------- suivi commercial */
.statuts { display: flex; flex-wrap: wrap; gap: 6px; }
.statut {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); cursor: pointer; background: var(--surface); white-space: nowrap;
}
.statut input { position: absolute; opacity: 0; width: 0; height: 0; }
.statut:hover { border-color: #c8ced8; }
.statut.actif { color: var(--ink); border-color: transparent; background: #eef0f3; }
.statut.actif.s-a_contacter { background: #eef0f3; }
.statut.actif.s-contacte { background: #e6f0fb; color: #1c4f8a; }
.statut.actif.s-rdv { background: #efe9fc; color: #4b3aa6; }
.statut.actif.s-devis { background: var(--accent-soft); color: var(--accent-ink); }
.statut.actif.s-gagne { background: #e3f4e3; color: #0a6b0a; }
.statut.actif.s-perdu { background: #f6e6e6; color: #9c2a2a; }
.statut.actif.s-ne_pas_contacter { background: #2f2a2b; color: #fff; }
.statut:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.champ { display: grid; gap: 4px; margin-top: 12px; color: var(--ink-2); font-size: 13px; }
.champ input, .note-form textarea {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.note-form { display: grid; gap: 8px; margin-top: 14px; }
.note-form .bouton { justify-self: start; }
.notes { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.notes li { border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; }
.entonnoir { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.entonnoir .etape { padding: 14px 16px; color: var(--ink); border-top: 3px solid var(--line); }
.entonnoir .etape:hover { text-decoration: none; border-color: #c8ced8; }
.entonnoir .valeur { font-size: 26px; font-weight: 650; }
.entonnoir .libelle { color: var(--ink-2); font-size: 13px; }
.entonnoir .s-gagne { border-top-color: #0c8a0c; }
.entonnoir .s-perdu { border-top-color: #b33a3a; }
.entonnoir .s-devis { border-top-color: var(--accent); }
.entonnoir .s-rdv { border-top-color: #6250d6; }
.entonnoir .s-contacte { border-top-color: #3987e5; }
.retard { color: var(--critique); font-weight: 600; }
@media (max-width: 1100px) { .entonnoir { grid-template-columns: repeat(4, 1fr); } }
