:root {
  --fond: #f6f4f1;
  --carte: #ffffff;
  --texte: #1f1d1a;
  --doux: #6b655d;
  --bord: #e6e1da;
  --accent: #b8572f;
  --accent-clair: #f6e7df;
  --formation: #6b4fa3;
  --formation-clair: #eee8f8;
  --automatisation: #1f7a6b;
  --automatisation-clair: #e2f3ef;
  --community: #c2477a;
  --community-clair: #fbe6ef;
  --danger: #b3261e;
  --ombre: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --rayon: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte); font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }

.barre { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--carte); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.marque { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.logo { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; margin: 0 auto 12px; }
.logo.petit { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; margin: 0; }
.onglets { display: flex; gap: 4px; background: var(--fond); padding: 4px; border-radius: 10px; }
.onglets button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--doux); }
.onglets button.actif { background: var(--carte); color: var(--texte); box-shadow: var(--ombre); font-weight: 600; }
.actions-barre { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.actions-barre form { margin: 0; }

.btn { border: 1px solid var(--bord); background: var(--carte); padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.btn:hover { border-color: #cfc7bc; }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.principal:hover { filter: brightness(.95); }
.btn.lien { border: 0; background: none; color: var(--doux); }
.btn.danger { color: var(--danger); border-color: #efc9c6; }

.filtres { display: flex; gap: 12px; padding: 16px 24px 0; flex-wrap: wrap; align-items: center; }
.puces { display: flex; gap: 6px; flex-wrap: wrap; }
.puce { border: 1px solid var(--bord); background: var(--carte); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.puce.actif { background: var(--texte); color: #fff; border-color: var(--texte); }
#recherche { margin-left: auto; min-width: 260px; padding: 8px 12px; border: 1px solid var(--bord); border-radius: 9px; background: var(--carte); }

main { padding: 16px 24px 48px; }
.vue h2 { font-size: 17px; margin: 24px 0 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: var(--carte); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); }
.kpi .val { font-size: 28px; font-weight: 700; margin-top: 4px; }
.kpi .lib { color: var(--doux); font-size: 13px; }

.offres-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.carte-offre { background: var(--carte); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); border-top: 4px solid var(--c); }
.carte-offre h3 { margin: 0 0 10px; font-size: 15px; }
.barre-etape { display: grid; grid-template-columns: 130px 1fr 28px; align-items: center; gap: 8px; font-size: 13px; margin: 5px 0; }
.barre-etape .piste { height: 8px; background: var(--fond); border-radius: 4px; overflow: hidden; }
.barre-etape .rempli { height: 100%; background: var(--c); border-radius: 4px; }
.barre-etape .n { text-align: right; font-variant-numeric: tabular-nums; }
.carte-offre .pied { margin-top: 10px; color: var(--doux); font-size: 13px; }

.deux-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .deux-col { grid-template-columns: 1fr; } }
.panneau { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 8px 16px; }
.panneau ul { list-style: none; margin: 0; padding: 0; }
.panneau li { padding: 10px 0; border-bottom: 1px solid var(--bord); display: flex; gap: 10px; align-items: baseline; }
.panneau li:last-child { border-bottom: 0; }
.panneau .vide { color: var(--doux); padding: 14px 0; }
.lien-lead { cursor: pointer; font-weight: 600; }
.lien-lead:hover { color: var(--accent); }
.date { color: var(--doux); font-size: 13px; margin-left: auto; white-space: nowrap; }
.retard { color: var(--danger); font-weight: 600; }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--cc); color: var(--c); font-weight: 600; white-space: nowrap; }
[data-offre="formation"] { --c: var(--formation); --cc: var(--formation-clair); }
[data-offre="automatisation"] { --c: var(--automatisation); --cc: var(--automatisation-clair); }
[data-offre="community"] { --c: var(--community); --cc: var(--community-clair); }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.colonne { background: #ece8e2; border-radius: var(--rayon); padding: 10px; min-height: 300px; }
.colonne.survol { outline: 2px dashed var(--accent); }
.colonne h3 { font-size: 13px; margin: 2px 4px 10px; display: flex; justify-content: space-between; color: var(--doux); text-transform: uppercase; letter-spacing: .03em; }
.carte-lead { background: var(--carte); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--ombre); cursor: grab; border-left: 4px solid var(--c); }
.carte-lead .nom { font-weight: 600; margin-bottom: 4px; }
.carte-lead .meta { font-size: 12px; color: var(--doux); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

table { width: 100%; border-collapse: collapse; background: var(--carte); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bord); font-size: 14px; }
th { background: #faf8f5; color: var(--doux); font-weight: 600; font-size: 13px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fbf9f6; }
.outils-liste { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(760px, 96vw); max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(31,29,26,.35); }
dialog form#form-lead, #bloc-activites { padding: 20px 24px; }
.fiche-entete { display: flex; justify-content: space-between; align-items: center; }
.fiche-entete h2 { margin: 0; }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 16px; }
.grille .large { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--doux); }
input, select, textarea { padding: 8px 10px; border: 1px solid var(--bord); border-radius: 8px; background: #fff; color: var(--texte); font-size: 15px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-clair); border-color: var(--accent); }
.fiche-pied { display: flex; margin-top: 16px; }
.espace { flex: 1; }
#bloc-activites { border-top: 1px solid var(--bord); background: #fbf9f6; }
#bloc-activites h3 { margin: 0 0 10px; font-size: 15px; }
.ligne-activite { display: flex; gap: 8px; }
.ligne-activite input { flex: 1; }
.activites { list-style: none; padding: 0; margin: 12px 0 0; }
.activites li { padding: 8px 0; border-bottom: 1px solid var(--bord); font-size: 14px; }
.activites .quand { color: var(--doux); font-size: 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--texte); color: #fff; padding: 10px 18px; border-radius: 10px; }

body.login { min-height: 100vh; display: grid; place-items: center; }
.carte-login { background: var(--carte); padding: 36px; border-radius: 18px; box-shadow: var(--ombre); width: min(380px, 92vw); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.carte-login h1 { margin: 0; }
.carte-login .sous { margin: 0; color: var(--doux); font-size: 14px; }
.carte-login label { text-align: left; }
.erreur { color: var(--danger); margin: 0; }

@media (max-width: 640px) {
  .barre, .filtres, main { padding-left: 14px; padding-right: 14px; }
  #recherche { min-width: 0; width: 100%; margin-left: 0; }
  .grille { grid-template-columns: 1fr; }
  .actions-barre { margin-left: 0; }
}
