/* CRM Puramis — feuille de style
   Une couleur = une signification :
   rouge = retard / silencieux · ambre = à faire / à attribuer · vert = gagné / payé
   orange, jaune, bleu = uniquement Matteo, Morgane, Robin (comme dans le Tricount). */

:root {
  /* Surfaces */
  --fond: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --survol: #f2f1ec;
  --bord: #e2e0d9;
  --bord-doux: #edebe5;

  /* Texte */
  --texte: #1b1a17;
  --doux: #5c5a53;          /* 5.9:1 sur blanc, 5.1:1 sur --fond */
  --pale: #8a877e;          /* uniquement pour les filets et icônes, jamais pour du texte */

  /* Action */
  --accent: #1b1a17;
  --accent-survol: #36342f;
  --lien: #1f4fd1;
  --focus: #1f4fd1;

  /* Significations */
  --alerte: #b42318;  --alerte-fond: #fdeeec;  --alerte-bord: #f5cbc6;
  --attention: #8a4b08; --attention-fond: #fdf3dc; --attention-bord: #f3dca0;
  --succes: #157a3b;  --succes-fond: #e9f6ee;  --succes-bord: #c2e5cf;

  /* Personnes (Tricount) */
  --matteo: #e07b2c;
  --morgane: #c89a0b;
  --robin: #3b74e6;

  /* Étapes de vente (froid → chaud, sans rouge/ambre/vert) */
  --e-nouveau: #6b6a64;
  --e-echange: #0f7490;
  --e-brief: #6a35c9;
  --e-devis: #1f4fd1;
  --e-nego: #3f3ab8;
  --e-ao_repere: #0f766e;
  --e-offre_deposee: #7a3fd6;

  /* Étapes de projet */
  --p-kickoff: #6b6a64;
  --p-conception: #6a35c9;
  --p-validation: #b8327a;
  --p-production: #1f4fd1;
  --p-livraison: #0f7490;
  --p-facturation: #0f766e;
  --p-termine: #157a3b;

  --rayon: 10px;
  --rayon-s: 7px;
  --ombre: 0 1px 2px rgba(27, 26, 23, .05), 0 6px 16px -8px rgba(27, 26, 23, .10);
  --ombre-haute: 0 2px 4px rgba(27, 26, 23, .06), 0 18px 40px -12px rgba(27, 26, 23, .22);
  --cible: 36px;

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--texte);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scrollbar-color: #cfccc3 transparent; }
body { margin: 0; background: var(--fond); }
::selection { background: #d9e3ff; color: var(--texte); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
a { color: var(--lien); text-underline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num-tab { font-variant-numeric: tabular-nums; }

/* Icônes (SVG dessinés, trait 1.75) */
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.petit { width: 14px; height: 14px; }

/* ---------- Champs et boutons ---------- */
input, select, textarea {
  border: 1px solid var(--bord); border-radius: var(--rayon-s); padding: 7px 10px; background: var(--surface);
  min-height: var(--cible); transition: border-color .15s ease-out;
}
input:hover, select:hover, textarea:hover { border-color: #cfccc3; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(31, 79, 209, .14); }
input::placeholder, textarea::placeholder { color: #77746b; }
textarea { resize: vertical; min-height: 76px; width: 100%; }
input[type=checkbox] { min-height: auto; width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--cible); padding: 0 12px; border: 1px solid var(--bord); border-radius: var(--rayon-s);
  background: var(--surface); cursor: pointer; white-space: nowrap; transition: background .15s ease-out, border-color .15s ease-out;
}
.btn:hover { background: var(--survol); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primaire { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.btn.primaire:hover { background: var(--accent-survol); }
.btn.danger { color: var(--alerte); }
.btn.danger:hover { background: var(--alerte-fond); border-color: var(--alerte-bord); }
.btn.fantome { border-color: transparent; background: transparent; }
.btn.fantome:hover { background: var(--survol); }
.btn.mini { min-height: 28px; padding: 0 8px; font-size: 13px; }
.btn.icone { width: var(--cible); padding: 0; }
.btn.icone.mini { width: 28px; }
.btn.lien { border: none; background: none; min-height: auto; padding: 0; text-decoration: underline; text-underline-offset: 2px; color: inherit; }

/* ---------- Barre du haut ---------- */
.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 20;
}
.marque { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; }
.actions { display: flex; gap: 8px; align-items: center; }
.recherche { position: relative; }
.recherche .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--pale); pointer-events: none; }
.recherche input { padding-left: 32px; width: 260px; }

.segment { display: inline-flex; gap: 2px; background: var(--survol); padding: 3px; border-radius: 9px; }
.segment button {
  display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 0 12px; min-height: 30px;
  border-radius: 7px; cursor: pointer; color: var(--doux); font-weight: 500; transition: background .15s ease-out, color .15s ease-out;
}
.segment button:hover { color: var(--texte); }
.segment button.actif { background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgba(27, 26, 23, .1); }

.btn-mails { position: relative; }
.btn-mails .pastille { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--pale); box-shadow: 0 0 0 2px var(--surface); }
.btn-mails .pastille.ok { background: var(--succes); }
.btn-mails .pastille.ko { background: var(--alerte); }

main { padding: 16px 24px 48px; max-width: 1600px; margin: 0 auto; }

/* ---------- Barre d'outils : onglets + vues ---------- */
.outils { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.onglets { display: flex; gap: 2px; flex-wrap: wrap; }
.onglet {
  display: inline-flex; align-items: center; gap: 6px; border: none; background: none; min-height: 32px; padding: 0 10px;
  border-radius: var(--rayon-s); cursor: pointer; color: var(--doux); font-weight: 500;
}
.onglet:hover { background: var(--survol); color: var(--texte); }
.onglet .n { font-size: 12px; font-weight: 500; color: var(--doux); font-variant-numeric: tabular-nums; }
.onglet.actif { background: var(--surface); color: var(--texte); box-shadow: 0 0 0 1px var(--bord); }
.onglet .n.alerte { color: var(--attention); background: var(--attention-fond); padding: 0 6px; border-radius: 999px; }
.droite-outils { display: flex; gap: 8px; align-items: center; }
#zoom-gantt:empty { display: none; }

/* ---------- Bande de chiffres ---------- */
.chiffres {
  display: flex; flex-wrap: wrap; align-items: stretch; background: var(--surface); border: 1px solid var(--bord);
  border-radius: var(--rayon); margin-bottom: 12px;
}
.chiffre { padding: 10px 18px; border-right: 1px solid var(--bord-doux); min-width: 150px; }
.chiffre:last-of-type { border-right: none; }
.chiffre .titre { color: var(--doux); font-size: 12px; }
.chiffre .valeur { font-size: 19px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.chiffre .valeur.rouge { color: var(--alerte); }
.chiffre .detail { color: var(--doux); font-size: 12px; }
.chiffres .personnes { margin-left: auto; display: flex; gap: 6px; align-items: center; padding: 8px 12px; flex-wrap: wrap; }
.personne {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--bord); background: var(--surface);
  border-radius: 999px; min-height: 32px; padding: 0 10px 0 4px; cursor: pointer; font-size: 13px;
}
.personne:hover { background: var(--survol); }
.personne.actif { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.personne .montant { color: var(--doux); font-variant-numeric: tabular-nums; }
.personne .montant b { color: var(--texte); font-weight: 600; }

.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff; flex: none;
}
.avatar.Matteo { background: var(--matteo); }
.avatar.Morgane { background: var(--morgane); }
.avatar.Robin { background: var(--robin); }
.avatar.anonyme { background: #d6d3ca; color: var(--doux); }
.avatars { display: inline-flex; }
.avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }

.bandeau {
  display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--attention);
  background: var(--attention-fond); border: 1px solid var(--attention-bord); border-radius: var(--rayon-s); padding: 6px 12px; margin-bottom: 12px;
}

/* ---------- Tableau ---------- */
.tableau-cadre { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); overflow-x: auto; }
.tableau { border-collapse: collapse; width: 100%; }
.tableau th {
  text-align: left; font-weight: 500; color: var(--doux); font-size: 12px; padding: 9px 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--bord); white-space: nowrap; user-select: none; position: sticky; top: 0;
}
.tableau th[data-col] { cursor: pointer; }
.tableau th[data-col]:hover { color: var(--texte); }
.tableau th.tri::after { content: " ↓"; }
.tableau th.tri.asc::after { content: " ↑"; }
.tableau td { padding: 10px 12px; border-bottom: 1px solid var(--bord-doux); vertical-align: middle; }
.tableau tbody tr { cursor: pointer; transition: background .12s ease-out; }
.tableau tbody tr:hover, .tableau tbody tr:focus-visible { background: #f8f7f3; }
.tableau tbody tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tableau tbody tr:last-child td { border-bottom: none; }
.tableau .num { color: var(--pale); width: 28px; font-size: 12px; }
.org { font-weight: 550; }
.sous { color: var(--doux); font-size: 12px; margin-top: 1px; }
.tableau .montant { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau .action { max-width: 320px; }
.tronque { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-retard { color: var(--alerte) !important; }
.bientot { color: var(--attention) !important; }
.vide { text-align: center; color: var(--doux); padding: 40px 20px; margin: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 8px 2px 7px;
  border-radius: 999px; border: 1px solid var(--bord); background: var(--surface); white-space: nowrap; color: var(--c, var(--doux));
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.sans-point::before { display: none; }
.badge.e-nouveau { --c: var(--e-nouveau); } .badge.e-echange { --c: var(--e-echange); } .badge.e-brief { --c: var(--e-brief); }
.badge.e-devis { --c: var(--e-devis); } .badge.e-nego { --c: var(--e-nego); }
.badge.e-ao_repere { --c: var(--e-ao_repere); } .badge.e-offre_deposee { --c: var(--e-offre_deposee); }
.badge.e-gagne, .badge.e-attribue { color: var(--succes); background: var(--succes-fond); border-color: var(--succes-bord); }
.badge.e-perdu, .badge.e-non_retenu { color: var(--doux); background: var(--surface-2); }
.badge.p-kickoff { --c: var(--p-kickoff); } .badge.p-conception { --c: var(--p-conception); } .badge.p-validation { --c: var(--p-validation); }
.badge.p-production { --c: var(--p-production); } .badge.p-livraison { --c: var(--p-livraison); } .badge.p-facturation { --c: var(--p-facturation); }
.badge.p-termine { color: var(--succes); background: var(--succes-fond); border-color: var(--succes-bord); }
.badge.silence { color: var(--alerte); background: var(--alerte-fond); border-color: var(--alerte-bord); }
.badge.attribuer { color: var(--attention); background: var(--attention-fond); border-color: var(--attention-bord); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

.barre-p { width: 48px; height: 4px; background: #ebe9e3; border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; }
.barre-p span { display: block; height: 100%; background: var(--texte); border-radius: 4px; }
.progres { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x proximity; }
.colonne {
  flex: 0 0 272px; background: #efede7; border-radius: var(--rayon); display: flex; flex-direction: column;
  max-height: calc(100vh - 230px); scroll-snap-align: start; transition: background .15s ease-out, box-shadow .15s ease-out;
}
.colonne.etroite { flex-basis: 220px; }
.colonne.survol-depot { background: #e4e8f6; box-shadow: inset 0 0 0 2px var(--focus); }
.colonne-tete { padding: 10px 12px 8px; display: grid; gap: 2px; }
.colonne-tete .nom { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.colonne-tete .nom::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--pale)); }
.colonne-tete .nom .n { color: var(--doux); font-weight: 500; font-variant-numeric: tabular-nums; }
.colonne-tete .somme { color: var(--doux); font-size: 12px; font-variant-numeric: tabular-nums; }
.colonne-corps { padding: 2px 8px 10px; overflow-y: auto; display: grid; gap: 8px; align-content: start; min-height: 60px; }
.carte {
  background: var(--surface); border: 1px solid var(--bord); border-radius: 9px; padding: 10px 11px; cursor: grab;
  box-shadow: 0 1px 1px rgba(27, 26, 23, .04); display: grid; gap: 6px; transition: box-shadow .15s ease-out, transform .15s ease-out;
}
.carte:hover { box-shadow: var(--ombre); }
.carte:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.carte.glisse { opacity: .45; transform: rotate(1deg); }
.carte .ligne { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.carte .org { font-size: 13px; }
.carte .montant { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 550; }
.carte .petit { font-size: 12px; color: var(--doux); }
.carte.compacte { padding: 8px 10px; gap: 2px; cursor: pointer; }
.carte .deplacer { display: none; font-size: 12px; min-height: 30px; padding: 2px 6px; }
@media (pointer: coarse) { .carte .deplacer { display: block; } .carte { cursor: pointer; } }
.colonne .plus { font-size: 12px; color: var(--doux); text-align: center; padding: 4px; }

/* ---------- Chronologie (Gantt) ---------- */
.gantt-outils { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.gantt { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); overflow: auto; max-height: calc(100vh - 210px); position: relative; }
.gantt-grille { display: grid; grid-template-columns: 240px 1fr; min-width: max-content; }
.gantt-noms { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--bord); }
.gantt-entete { position: sticky; top: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--bord); height: 44px; }
.gantt-noms .gantt-entete { z-index: 5; display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: 12px; color: var(--doux); }
.gantt-echelle { position: relative; height: 44px; }
.gantt-echelle .mois { position: absolute; top: 6px; font-size: 12px; font-weight: 600; padding-left: 6px; white-space: nowrap; }
.gantt-echelle .graduation { position: absolute; bottom: 6px; font-size: 11px; color: var(--doux); padding-left: 4px; font-variant-numeric: tabular-nums; }
.gantt-nom {
  height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--bord-doux); cursor: pointer;
}
.gantt-nom:hover { background: var(--surface-2); }
.gantt-nom .deplier { width: 24px; height: 24px; min-height: 24px; padding: 0; border: none; background: none; cursor: pointer; color: var(--doux); border-radius: 5px; display: grid; place-items: center; }
.gantt-nom .deplier:hover { background: var(--survol); }
.gantt-nom .deplier .ico { transition: transform .15s ease-out; }
.gantt-nom .deplier.ouvert .ico { transform: rotate(90deg); }
.gantt-nom .texte { min-width: 0; flex: 1; }
.gantt-nom.tache { height: 32px; padding-left: 42px; font-size: 12px; color: var(--doux); cursor: default; }
.gantt-nom.tache.faite { text-decoration: line-through; }
.gantt-zone { position: relative; }
.gantt-ligne { height: 44px; border-bottom: 1px solid var(--bord-doux); position: relative; }
.gantt-ligne.tache { height: 32px; background: var(--surface-2); }
.gantt-fond { position: absolute; inset: 0; pointer-events: none; }
.gantt-fond .trait { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--bord-doux); }
.gantt-fond .weekend { position: absolute; top: 0; bottom: 0; background: rgba(27, 26, 23, .025); }
.gantt-aujourdhui { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--alerte); z-index: 2; pointer-events: none; }
.gantt-aujourdhui::before { content: "Aujourd'hui"; position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--alerte); font-weight: 600; white-space: nowrap; }
.barre-g {
  position: absolute; top: 10px; height: 24px; border-radius: 6px; background: color-mix(in srgb, var(--c) 16%, white);
  border: 1px solid color-mix(in srgb, var(--c) 45%, white); cursor: pointer; display: flex; align-items: center; overflow: visible;
}
.barre-g .avance { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--c) 34%, white); border-radius: 5px 0 0 5px; }
.barre-g .etiquette { position: relative; padding: 0 8px; font-size: 12px; font-weight: 500; color: color-mix(in srgb, var(--c) 80%, black); white-space: nowrap; }
.barre-g.sans-date { border-style: dashed; background: transparent; }
.barre-g.termine { opacity: .55; }
.barre-g .poignee { position: absolute; top: -1px; bottom: -1px; width: 10px; cursor: ew-resize; touch-action: none; }
.barre-g .poignee.debut { left: -4px; }
.barre-g .poignee.fin { right: -4px; }
.barre-g .poignee::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 4px; width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--c) 60%, white); opacity: 0; transition: opacity .15s; }
.barre-g:hover .poignee::after { opacity: 1; }
.jalon { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; transform: rotate(45deg); background: var(--surface); border: 2px solid var(--doux); z-index: 1; }
.jalon.faite { background: var(--doux); }
.jalon.retard { border-color: var(--alerte); background: var(--alerte-fond); }
.gantt-ligne.tache .jalon-texte { position: absolute; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--doux); white-space: nowrap; padding-left: 10px; }

/* ---------- Fiche (panneau) ---------- */
.voile { position: fixed; inset: 0; background: rgba(27, 26, 23, .22); z-index: 30; animation: apparait .18s ease-out; }
.fiche {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: var(--surface); z-index: 31;
  overflow-y: auto; overflow-x: hidden; padding: 0 24px 40px; box-shadow: var(--ombre-haute); animation: glisse .22s cubic-bezier(.16, 1, .3, 1);
}
@keyframes glisse { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fiche, .voile { animation-duration: .01s; } }
.fiche-tete {
  position: sticky; top: 0; z-index: 2; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 0 12px; border-bottom: 1px solid var(--bord-doux); margin-bottom: 6px;
}
.fiche h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.015em; line-height: 1.25; }
.fiche h3 { font-size: 12px; color: var(--doux); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin: 24px 0 8px; }
.etat-sauvegarde { font-size: 12px; color: var(--doux); display: inline-flex; align-items: center; gap: 4px; min-height: 18px; }
.etat-sauvegarde.ok { color: var(--succes); }
.etat-sauvegarde.ko { color: var(--alerte); }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.grille .plein { grid-column: 1 / -1; }
.champ { min-width: 0; }
.champ label { display: block; font-size: 12px; color: var(--doux); margin-bottom: 4px; font-weight: 500; }
.champ input, .champ select { width: 100%; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { border: 1px solid var(--bord); border-radius: 999px; min-height: 32px; padding: 0 12px; cursor: pointer; font-size: 13px; background: var(--surface); }
.puce:hover { background: var(--survol); }
.puce[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.repartition { display: grid; gap: 6px; }
.repartition .ligne { display: flex; align-items: center; gap: 10px; }
.repartition label { display: flex; gap: 8px; align-items: center; cursor: pointer; min-width: 130px; }
.repartition input[type=number] { width: 80px; }
.repartition .ht { color: var(--doux); font-variant-numeric: tabular-nums; margin-left: auto; }
.encadre { border: 1px solid var(--bord); border-radius: var(--rayon-s); padding: 12px; background: var(--surface-2); display: grid; gap: 8px; min-width: 0; }
.encadre.gagne { border-color: var(--succes-bord); background: var(--succes-fond); }
.tricount {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; background: var(--surface); border: 1px dashed var(--bord);
  padding: 8px; border-radius: 6px; white-space: pre; overflow-x: auto; max-width: 100%;
}
.pied-fiche { display: flex; gap: 8px; justify-content: space-between; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--bord-doux); }
.aide { font-size: 12px; color: var(--doux); }

.notes { display: grid; margin-top: 10px; }
.note { padding: 10px 0; border-bottom: 1px solid var(--bord-doux); min-width: 0; }
.note:last-child { border-bottom: none; }
.note .meta { font-size: 12px; color: var(--doux); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.note .txt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.note.mail .meta .sens { font-weight: 600; color: var(--lien); }
.note.mail.envoye .meta .sens { color: var(--succes); }
.note .sujet { font-weight: 550; margin-top: 2px; }
.note details summary { cursor: pointer; color: var(--doux); font-size: 13px; overflow-wrap: anywhere; }
.note details .txt { font-size: 13px; margin-top: 6px; }

/* Fiche projet */
.taches { display: grid; gap: 2px; min-width: 0; }
.tache { display: grid; grid-template-columns: 22px minmax(0, 1fr) 104px 138px 28px; gap: 6px; align-items: center; }
.tache input, .tache select { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.tache .titre-tache { border-color: transparent; background: transparent; }
.tache .titre-tache:hover { border-color: var(--bord); }
.tache.faite .titre-tache { text-decoration: line-through; color: var(--doux); }
.tache input.en-retard { border-color: var(--alerte-bord); background: var(--alerte-fond); }
.ajout-ligne { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ajout-ligne input:not([type]) { flex: 1; min-width: 140px; }
.liste-temps { display: grid; gap: 2px; margin-top: 8px; }
.ligne-temps { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 32px; }
.ligne-temps .quoi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jauge { height: 6px; background: #ebe9e3; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.jauge span { display: block; height: 100%; background: var(--texte); }
.jauge span.depasse { background: var(--alerte); }
.tranches { display: grid; gap: 8px; min-width: 0; }
.tranche { border: 1px solid var(--bord); border-radius: var(--rayon-s); padding: 10px; display: grid; gap: 6px; min-width: 0; }
.tranche.s-facture { background: #f4f7ff; border-color: #d6e0fb; }
.tranche.s-paye { background: var(--succes-fond); border-color: var(--succes-bord); }
.tranche-haut { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tranche-haut .titre-tache { flex: 1; min-width: 130px; }
.tranche-haut input[type=number] { width: 96px; }
.tranche-haut select { max-width: 140px; }

/* Boîte de dialogue (Gagné / Perdu) */
dialog.question { border: none; border-radius: 12px; padding: 20px; width: min(380px, calc(100% - 32px)); box-shadow: var(--ombre-haute); }
dialog.question::backdrop { background: rgba(27, 26, 23, .3); }
dialog.question h2 { margin: 0 0 6px; font-size: 17px; }
dialog.question p { margin: 0 0 14px; color: var(--doux); }
dialog.question select { width: 100%; }
dialog.question .boutons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: 9px; z-index: 40; font-size: 13px; box-shadow: var(--ombre-haute); max-width: calc(100% - 32px);
}

/* Cartes de liste (téléphone) */
.liste-cartes { display: none; gap: 8px; }
.liste-cartes .carte { cursor: pointer; }

/* ---------- Écrans moyens et téléphone ---------- */
@media (max-width: 1100px) {
  .chiffres .personnes { margin-left: 0; border-top: 1px solid var(--bord-doux); width: 100%; }
  .recherche input { width: 200px; }
}
@media (max-width: 760px) {
  :root { --cible: 40px; }
  .barre { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .marque { width: 100%; justify-content: space-between; }
  .actions { width: 100%; flex-wrap: wrap; }
  .recherche { flex: 1 1 100%; order: -1; }
  .recherche input { width: 100%; }
  .actions select { flex: 1; }
  .actions .btn.primaire { flex: 1; }
  .libelle-long { display: none; }
  main { padding: 12px 16px 40px; }
  .outils { flex-direction: column; align-items: stretch; }
  .outils > * { min-width: 0; max-width: 100%; }
  .onglets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .onglet { flex: none; }
  .droite-outils { justify-content: flex-end; flex-wrap: wrap; }
  #zoom-gantt { margin-right: auto; }
  .chiffres { display: grid; grid-template-columns: 1fr 1fr; }
  .chiffre { min-width: 0; padding: 8px 12px; border-right: none; border-bottom: 1px solid var(--bord-doux); }
  .chiffre:nth-of-type(odd) { border-right: 1px solid var(--bord-doux); }
  .chiffre .valeur { font-size: 17px; }
  .chiffres .personnes { grid-column: 1 / -1; overflow-x: auto; flex-wrap: nowrap; border-top: none; }
  .personne { flex: none; }
  .vue-liste .tableau-cadre { display: none; }
  .vue-liste .liste-cartes { display: grid; }
  .colonne { flex-basis: 84vw; max-height: none; }
  .gantt-grille { grid-template-columns: 140px 1fr; }
  .gantt-nom .avatars, .gantt-nom.tache .avatar { display: none; }
  .fiche { padding: 0 16px 32px; }
  .grille { grid-template-columns: 1fr; }
  .tache { grid-template-columns: 22px minmax(0, 1fr) 28px; }
  .tache select, .tache input[type=date] { grid-column: 2 / 3; }
}

/* ---------- Connexion et invitation ---------- */
.page-acces { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.acces { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.acces-marque { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.acces h1 { font-size: 22px; margin: 8px 0 0; letter-spacing: -0.01em; }
.acces-form { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 20px; }
.acces-form .btn { width: 100%; justify-content: center; }
.acces-erreur { margin: 0; color: var(--alerte); background: var(--alerte-fond); border: 1px solid var(--alerte-bord); border-radius: var(--rayon-s); padding: 8px 10px; font-size: 13px; }
.utilisateur { display: inline-flex; align-items: center; gap: 6px; }
body[data-role="membre"] .admin-seul { display: none !important; }
