/* Terra Expertise v2 — thème clair premium (portail interne présentable en clientèle) */
:root {
  --brun: #7E6B59;
  --brun-fonce: #5C4E41;
  --brun-clair: #A08D79;
  --brun-voile: #F0EAE3;
  --ivoire: #F6F4F0;
  --blanc: #FFFFFF;
  --encre: #1A1714;
  --encre-2: #3E3731;
  --encre-3: #5E564E;
  --trait: #E4DED6;
  --vert: #35713D;
  --vert-voile: #E8F1E9;
  --ambre: #9A6B1F;
  --ambre-voile: #FBF1DE;
  --rouge: #A33A31;
  --rouge-voile: #FAEBE9;
  --bleu: #3C5A78;
  --bleu-voile: #EAF0F6;
  --r: 10px;
  --ombre: 0 1px 2px rgba(38, 34, 30, .05), 0 8px 24px -12px rgba(38, 34, 30, .14);
  --ombre-forte: 0 24px 60px -24px rgba(38, 34, 30, .34);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--ivoire);
  color: var(--encre);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--brun-fonce); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------- Connexion ------------------------------- */
.ecran-login {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1100px 520px at 18% -10%, #FFFDFA 0%, transparent 62%),
    linear-gradient(140deg, #EFE9E2 0%, var(--ivoire) 46%, #E9E2DA 100%);
  padding: 24px;
}
.carte-login {
  width: 100%; max-width: 396px; background: var(--blanc);
  border: 1px solid var(--trait); border-radius: 16px;
  box-shadow: var(--ombre-forte); padding: 34px 32px 28px;
}
.carte-login img { height: 46px; display: block; margin-bottom: 22px; }
.carte-login h1 { font-size: 19px; }
.carte-login p.sous { color: var(--encre-3); font-size: 13px; margin: 5px 0 22px; }

/* ------------------------------ Ossature ------------------------------ */
.app { display: grid; grid-template-columns: 246px 1fr; min-height: 100vh; }

.rail {
  background: var(--blanc); border-right: 1px solid var(--trait);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.rail-logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--trait); }
.rail-logo img { width: 100%; max-width: 176px; display: block; }
.rail-logo span {
  display: block; margin-top: 9px; font-size: 10.5px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--encre-3);
}
.rail nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.rail nav h5 {
  margin: 14px 10px 6px; font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--encre-3); font-weight: 600;
}
.rail nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border: 0; border-radius: 8px; background: transparent;
  color: var(--encre-2); cursor: pointer; font-size: 13.5px; transition: background .12s, color .12s;
}
.rail nav button:hover { background: var(--ivoire); color: var(--encre); }
.rail nav button.actif { background: var(--brun-voile); color: var(--brun-fonce); font-weight: 600; }
.rail nav button .pastille {
  margin-left: auto; background: var(--brun); color: #fff; border-radius: 999px;
  font-size: 10.5px; padding: 1px 7px; font-weight: 600;
}
.rail-pied { border-top: 1px solid var(--trait); padding: 13px 16px; font-size: 12px; color: var(--encre-3); }
.rail-pied strong { display: block; color: var(--encre); font-size: 13px; font-weight: 600; }
.rail-pied button {
  margin-top: 8px; background: none; border: 0; padding: 0; color: var(--brun-fonce);
  cursor: pointer; font-size: 12px; text-decoration: underline;
}

.principal { display: flex; flex-direction: column; min-width: 0; }
.barre {
  display: flex; align-items: center; gap: 14px; padding: 16px 26px;
  border-bottom: 1px solid var(--trait); background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.barre h2 { font-size: 17px; }
.barre .fil { color: var(--encre-3); font-size: 12.5px; }
.barre .droite { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.contenu { padding: 24px 26px 60px; }

/* ------------------------------ Composants ------------------------------ */
.carte {
  background: var(--blanc); border: 1px solid var(--trait);
  border-radius: var(--r); box-shadow: var(--ombre);
}
.carte + .carte { margin-top: 16px; }
.carte > header {
  padding: 14px 18px; border-bottom: 1px solid var(--trait);
  display: flex; align-items: center; gap: 12px;
}
.carte > header h3 { font-size: 16px; font-weight: 700; color: var(--encre); }
.carte > header .droite { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.carte > .corps { padding: 18px; }
.carte > .corps.serre { padding: 0; }

.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .app { grid-template-columns: 1fr; } .rail { position: static; height: auto; } .g2 { grid-template-columns: 1fr; } }

.kpi { background: var(--blanc); border: 1px solid var(--trait); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--ombre); }
.kpi .val { font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi .lib { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--encre-3); margin-top: 6px; }
.kpi.accent { border-left: 3px solid var(--brun); }
.kpi.alerte { border-left: 3px solid var(--rouge); }
.kpi.attention { border-left: 3px solid var(--ambre); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--trait); background: var(--blanc);
  color: var(--encre); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--ivoire); border-color: var(--brun-clair); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primaire { background: var(--brun); border-color: var(--brun); color: #fff; }
.btn.primaire:hover { background: var(--brun-fonce); border-color: var(--brun-fonce); }
.btn.danger { color: var(--rouge); border-color: #E8CFCB; }
.btn.danger:hover { background: var(--rouge-voile); }
.btn.mini { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.fantome { border-color: transparent; background: transparent; }
.btn.fantome:hover { background: var(--ivoire); border-color: var(--trait); }

/* Formulaires */
.champ { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.champ > label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-2); }
.champ .aide { font-size: 11.5px; color: var(--encre-3); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--trait); border-radius: 8px;
  background: var(--blanc); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brun-clair); box-shadow: 0 0 0 3px rgba(126, 107, 89, .13);
}
textarea { min-height: 84px; resize: vertical; }
.cases { display: flex; flex-wrap: wrap; gap: 7px; }
.cases label {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px;
  border: 1px solid var(--trait); border-radius: 999px; font-size: 12.5px;
  cursor: pointer; background: var(--blanc); transition: background .12s, border-color .12s;
}
.cases label:hover { border-color: var(--brun-clair); }
.cases label.coche { background: var(--brun-voile); border-color: var(--brun-clair); color: var(--brun-fonce); font-weight: 500; }
.cases input { accent-color: var(--brun); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--encre-3); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--trait);
  background: #FCFBF9; white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid #F1EDE8; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.cliquable { cursor: pointer; }
tbody tr.cliquable:hover { background: #FBFAF8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ref { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12.5px; color: var(--brun-fonce); font-weight: 600; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--brun-voile); color: var(--brun-fonce);
}
.badge.gris { background: #F0EEEB; color: var(--encre-2); }
.badge.vert { background: var(--vert-voile); color: var(--vert); }
.badge.ambre { background: var(--ambre-voile); color: var(--ambre); }
.badge.rouge { background: var(--rouge-voile); color: var(--rouge); }
.badge.bleu { background: var(--bleu-voile); color: var(--bleu); }
.badge.point::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.progression { height: 5px; border-radius: 999px; background: var(--brun-voile); overflow: hidden; min-width: 62px; }
.progression > i { display: block; height: 100%; background: var(--brun); }

/* Onglets */
.onglets { display: flex; gap: 3px; border-bottom: 1px solid var(--trait); padding: 0 18px; overflow-x: auto; }
.onglets button {
  border: 0; background: none; padding: 12px 13px; cursor: pointer; font-size: 13.5px;
  color: var(--encre-3); border-bottom: 2px solid transparent; white-space: nowrap;
}
.onglets button:hover { color: var(--encre); }
.onglets button.actif { color: var(--brun-fonce); border-bottom: 3px solid var(--brun); font-weight: 700; }

/* Frise d'état */
.frise { display: flex; flex-wrap: wrap; gap: 6px; }
.frise .etape {
  font-size: 11.5px; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--trait);
  color: var(--encre-3); background: var(--blanc); cursor: pointer;
}
.frise .etape:hover { border-color: var(--brun-clair); color: var(--encre); }
.frise .etape.passee { background: var(--brun-voile); color: var(--brun-fonce); border-color: var(--brun-voile); }
.frise .etape.courante { background: var(--brun); border-color: var(--brun); color: #fff; font-weight: 600; }

/* Liste journal */
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid #F3F0EC; font-size: 13px; }
.journal li:last-child { border-bottom: 0; }
.journal .quand { color: var(--encre-3); font-size: 11.5px; white-space: nowrap; min-width: 104px; }
.journal .quoi strong { font-weight: 600; }

/* Fiches de définition */
dl.fiche { display: grid; grid-template-columns: 168px 1fr; gap: 9px 16px; margin: 0; }
dl.fiche dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-3); font-weight: 600; padding-top: 2px; }
dl.fiche dd { margin: 0; }
@media (max-width: 620px) { dl.fiche { grid-template-columns: 1fr; gap: 2px 0; } dl.fiche dd { margin-bottom: 10px; } }

/* Modale */
.voile {
  position: fixed; inset: 0; background: rgba(38, 34, 30, .42); backdrop-filter: blur(3px);
  display: grid; place-items: start center; padding: 40px 18px; z-index: 60; overflow-y: auto;
}
.modale {
  width: 100%; max-width: 780px; background: var(--blanc); border-radius: 14px;
  box-shadow: var(--ombre-forte); border: 1px solid var(--trait);
}
.modale.large { max-width: 1020px; }
.modale > header { padding: 17px 22px; border-bottom: 1px solid var(--trait); display: flex; align-items: center; }
.modale > header h3 { font-size: 15.5px; }
.modale > header .fermer { margin-left: auto; background: none; border: 0; font-size: 21px; line-height: 1; cursor: pointer; color: var(--encre-3); }
.modale > .corps { padding: 22px; }
.modale > footer { padding: 15px 22px; border-top: 1px solid var(--trait); display: flex; gap: 9px; justify-content: flex-end; background: #FCFBF9; border-radius: 0 0 14px 14px; }

/* Notifications */
.notes { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 90; max-width: 400px; }
.note {
  background: var(--encre); color: #F7F4F0; padding: 12px 15px; border-radius: 10px;
  box-shadow: var(--ombre-forte); font-size: 13px; animation: entree .18s ease-out;
}
.note.ok { background: #2C5233; }
.note.err { background: #7C2E27; }
@keyframes entree { from { opacity: 0; transform: translateY(8px); } }

.vide { padding: 42px 18px; text-align: center; color: var(--encre-3); font-size: 13.5px; }
.vide strong { display: block; color: var(--encre); font-size: 14.5px; margin-bottom: 5px; font-weight: 600; }
.muet { color: var(--encre-3); }
.petit { font-size: 12px; }
.encart { background: var(--ivoire); border: 1px solid var(--trait); border-radius: 9px; padding: 13px 15px; font-size: 13px; }
.encart.info { background: var(--bleu-voile); border-color: #D3DEEA; color: #2F4A64; }
.encart.alerte { background: var(--ambre-voile); border-color: #EBDCBC; color: #7A5416; }
.encart.erreur { background: var(--rouge-voile); border-color: #EBCFCB; color: #8A2F27; }
.rangee { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pousse { margin-left: auto; }
.sep { height: 1px; background: var(--trait); margin: 18px 0; }
.total-ligne { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; }
.total-ligne.fort { border-top: 1px solid var(--trait); margin-top: 5px; padding-top: 11px; font-weight: 600; font-size: 15px; }
.chargement { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--brun-voile); border-top-color: var(--brun); border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* Totaux calculés en direct dans le formulaire de lettre */
.totaux { margin-left: auto; max-width: 340px; background: var(--ivoire); border: 1px solid var(--trait); border-radius: 8px; padding: 10px 14px; }
#table-honoraires tr.ligne-inactive { opacity: .45; }
#table-honoraires input[readonly] { background: var(--brun-voile); color: var(--encre); font-weight: 600; }
#table-honoraires input:disabled { background: transparent; border-color: transparent; }

/* --------------------------- Registre des parcelles --------------------------- */

/* Une double déclaration se repère sans lire : filet ambre en bord de ligne. */
tbody tr.divergente > td:first-child { box-shadow: inset 3px 0 0 var(--ambre, #B4841F); }
tbody tr.divergente > td { background: #FDFBF5; }
tbody tr.divergente.cliquable:hover > td { background: #FBF6EA; }

/* Origine d'une valeur : discrète, mais toujours là. */
sup.origine {
  font-size: 9.5px; font-weight: 600; margin-left: 3px;
  color: var(--encre-3); letter-spacing: .02em; cursor: help;
}
sup.origine.opposable { color: var(--vert, #3F7A52); }
sup.origine.divergent { color: var(--ambre, #B4841F); }

/* Tableau de correspondance des colonnes : lisible sans être bavard. */
.modale table select { width: 100%; }
.modale .encart table { margin-top: 8px; }

/* Mandant principal
   Le rang se lit d'un coup d'oeil dans la liste des parties : c'est la seule
   information qui commande la facturation et le classement. */
.badge.principal {
  background: var(--brun-voile);
  color: var(--brun-fonce);
  border: 1px solid var(--brun-clair);
  font-weight: 600;
  margin-top: 4px;
  display: inline-block;
}
.petit.ambre { color: var(--ambre); }

/* ------------------------------------------------------------------ *
 * Grammaire de ligne
 *
 * Une seule mise en forme pour toutes les listes du portail : pastille
 * d'état à gauche, libellé, métadonnées en gris, actions à droite. Elle
 * est définie ici, et non en style en ligne dans le JS, pour qu'une
 * seconde liste ne puisse pas diverger de la première.
 * ------------------------------------------------------------------ */

.liste-pieces { display: flex; flex-direction: column; }

.ligne-piece {
  border-bottom: 1px solid var(--trait);
  padding: 9px 2px;
}
.ligne-piece:last-child { border-bottom: 0; }

.ligne-tete { gap: 10px; flex-wrap: nowrap; }
.ligne-titre { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ligne-titre strong { font-weight: 550; font-size: 13px; line-height: 1.3; }
.ligne-actions { gap: 6px; flex-wrap: nowrap; }
.ligne-actions select.petit { max-width: 152px; min-width: 112px; }

.etoile { color: var(--rouge); margin-right: 3px; font-weight: 600; }

/* Une pièce écartée reste lisible, mais cesse d'attirer l'œil. */
.ligne-piece.ecarte .ligne-titre strong { color: var(--encre-3); font-weight: 450; }
.ligne-piece.ecarte .ligne-titre strong { text-decoration: line-through; text-decoration-color: var(--trait); }

/* ---- Pastille d'état ----
 * « Reçu » et « validé » partagent volontairement la même pastille pleine :
 * « je juge de la validité ». La distinction reste en base pour l'audit. */
.pastille-etat {
  flex: 0 0 auto;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--encre-3);
  position: relative;
  display: inline-block;
  /* La pastille d etat ne doit jamais etre etiree ni heriter d'un remplissage :
     un nom de classe partage avec un bloc du portail l'avait deja transformee
     en ellipse de 42 px de haut. */
  box-sizing: border-box;
  padding: 0;
  min-width: 15px; min-height: 15px;
  max-width: 15px; max-height: 15px;
  flex-shrink: 0;
}
.pastille-etat.etat-nul { background: transparent; }
.pastille-etat.etat-demi { border-color: var(--ambre); background: linear-gradient(90deg, var(--ambre) 50%, transparent 50%); }
.pastille-etat.etat-plein { border-color: var(--vert); background: var(--vert); }
.pastille-etat.etat-plein::after {
  content: ''; position: absolute;
  left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid var(--blanc); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.pastille-etat.etat-barre { border-color: var(--encre-3); background: transparent; }
.pastille-etat.etat-barre::after {
  content: ''; position: absolute;
  left: -1px; top: 5px; width: 15px; height: 1.5px;
  background: var(--encre-3);
}
.ligne-piece.alerte .pastille-etat.etat-barre,
.ligne-piece.alerte .pastille-etat.etat-demi { border-color: var(--rouge); }
.ligne-piece.alerte .pastille-etat.etat-barre::after { background: var(--rouge); }

/* ---- Barre d'avancement ---- */
.avancement {
  background: var(--brun-voile);
  border: 1px solid var(--trait);
  border-radius: var(--r);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.jauge {
  margin-top: 8px;
  height: 5px; border-radius: 3px;
  background: var(--blanc);
  overflow: hidden;
}
.jauge-remplie {
  height: 100%; border-radius: 3px;
  background: var(--brun);
  transition: width .25s ease;
}
.jauge-remplie.pleine { background: var(--vert); }
.compte-ok { color: var(--vert); }
.blocage { color: var(--rouge); }

/* ---- Fichiers rattachés à une pièce ---- */
.fichiers-piece {
  margin: 6px 0 2px 25px;
  padding-left: 12px;
  border-left: 2px solid var(--trait);
  display: flex; flex-direction: column; gap: 4px;
}
.fichier { gap: 8px; flex-wrap: nowrap; padding: 2px 0; }
.fichier .petit { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puce-fichier {
  flex: 0 0 auto;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--encre-3);
}
.compte-fichiers { color: var(--brun); }
.badge.mini { font-size: 10px; padding: 1px 5px; }

/* ---- Connecteur Teamleader (lot 4a) ---- */
.tl-etat { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.tl-voyant { width: 9px; height: 9px; border-radius: 999px; flex: 0 0 auto; }
.tl-voyant.tl-vert { background: var(--vert); }
.tl-voyant.tl-ambre { background: var(--ambre); }
.tl-voyant.tl-rouge { background: var(--rouge); }
.tl-voyant.tl-gris { background: var(--encre-3); }
.tl-faits { display: grid; grid-template-columns: 168px 1fr; gap: 7px 16px; font-size: 13px; margin-top: 14px; }
.tl-faits dt { color: var(--encre-3); }
.tl-faits dd { margin: 0; color: var(--encre); min-width: 0; overflow-wrap: anywhere; }
.tl-faits dd.tl-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.tl-portees { display: flex; flex-wrap: wrap; gap: 5px; }
.tl-portee { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--trait);
  background: var(--ivoire); color: var(--encre-2); }
.tl-portee.tl-active { border-color: var(--brun); background: var(--brun-voile);
  color: var(--brun-fonce); font-weight: 600; }
.tl-quota { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--encre-2); flex-wrap: wrap; }
.tl-quota-jauge { flex: 1; max-width: 170px; min-width: 90px; height: 5px; border-radius: 999px;
  background: var(--trait); overflow: hidden; }
.tl-quota-remplie { height: 100%; background: var(--vert); }
.tl-quota-remplie.tl-serre { background: var(--ambre); }
.tl-avis { padding: 11px 13px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  margin-top: 15px; border: 1px solid var(--trait); background: var(--ivoire); color: var(--encre-2); }
.tl-avis.tl-avis-alerte { border-color: var(--rouge); background: #fdf3f2; color: #8a3028; }
.tl-journal { margin-top: 14px; font-size: 12px; }
.tl-journal table { width: 100%; border-collapse: collapse; }
.tl-journal th { text-align: left; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--encre-3); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--trait); }
.tl-journal td { padding: 7px 10px; border-bottom: 1px solid var(--trait); color: var(--encre-2); }
.tl-journal tr:last-child td { border-bottom: 0; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--trait); }

/* ---- Rapprochement Teamleader (lot 4c) ---- */
.tlx-panneau { margin-top: 14px; border: 1px solid var(--trait); border-radius: 8px;
  padding: 12px 14px; background: var(--ivoire); }
.tlx-verdict { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }
.tlx-deja { margin-bottom: 8px; }
.tlx-candidat { border: 1px solid var(--trait); border-radius: 6px; padding: 9px 11px;
  margin-top: 8px; background: var(--blanc); }
.tlx-candidat.tlx-lie { border-color: var(--brun); box-shadow: inset 3px 0 0 var(--brun); }
.tlx-tete { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tlx-motifs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tlx-motif { font-size: 11px; padding: 2px 7px; border-radius: 10px;
  background: var(--ivoire); border: 1px solid var(--trait); color: var(--encre-3); }
.tlx-motif.tlx-contre { border-color: var(--rouge); color: var(--rouge); background: var(--rouge-voile); }
.tlx-pied { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--trait); }
/* L'etat vide heritait d'un alignement a droite depuis la cellule hote. */
.tlx-panneau .vide { text-align: center; }

/* ---- Répertoire des personnes (lot combiné 26/09) — préfixe rep- ---- */
.rep-recherche { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.rep-recherche input { flex: 1; max-width: 420px; }
.rep-suggestions { border: 1px solid var(--trait); border-radius: 6px; background: var(--blanc); margin-top: 4px; box-shadow: var(--ombre); }
.rep-suggestion { padding: 8px 11px; border-bottom: 1px solid var(--trait); cursor: pointer; }
.rep-suggestion:last-child { border-bottom: 0; }
.rep-suggestion.rep-active, .rep-suggestion:hover { background: var(--brun-voile); }
.rep-lien { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin-top: 8px; border-radius: 6px; background: var(--brun-voile); font-size: 12px; }
.rep-envoi { border: 1px dashed var(--trait); border-radius: 6px; padding: 9px 11px; margin-top: 8px; font-size: 12px; }
.rep-envoi dl { display: grid; grid-template-columns: 150px 1fr; gap: 3px 10px; margin: 6px 0 0; }
.rep-envoi dt { color: var(--encre-3); }
.rep-retenu { color: var(--encre-3); margin-top: 6px; }
.rep-alerte { border: 1px solid var(--ambre); background: var(--ambre-voile); border-radius: 6px; padding: 9px 11px; margin-bottom: 12px; font-size: 13px; }

/* ---- Facturation Teamleader et chaîne du dossier (lots 5 et 7) — préfixe fac- ---- */
.fac-carte { border: 1px solid var(--trait); border-radius: 8px; padding: 12px 14px; margin-top: 10px; background: var(--blanc); }
.fac-tete { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fac-envoi { border: 1px dashed var(--trait); border-radius: 6px; padding: 9px 11px; margin-top: 10px; font-size: 12px; }
.fac-envoi dl { display: grid; grid-template-columns: 170px 1fr; gap: 3px 10px; margin: 6px 0 0; }
.fac-envoi dt { color: var(--encre-3); }
.fac-lignes { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.fac-lignes th, .fac-lignes td { padding: 5px 6px; border-bottom: 1px solid var(--trait); text-align: left; }
.fac-lignes td.fac-n, .fac-lignes th.fac-n { text-align: right; white-space: nowrap; }
.fac-total td { font-weight: 600; border-bottom: 0; }
.fac-manque { border: 1px solid var(--ambre); background: var(--ambre-voile); border-radius: 6px; padding: 9px 11px; font-size: 13px; }
.fac-manque ul { margin: 6px 0 0 18px; padding: 0; }
.fac-chaine { display: grid; grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr; align-items: stretch; margin-top: 8px; }
.fac-maillon { border: 1px solid var(--trait); border-radius: 8px; padding: 10px 12px; background: var(--blanc); font-size: 12px; }
.fac-maillon h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-3); }
.fac-fleche { display: flex; align-items: center; justify-content: center; color: var(--encre-3); }
.fac-envoi dd select, .fac-envoi dd input { width: auto; display: inline-block; margin: 0 4px 0 0; }
.fac-ecart { border-left: 3px solid var(--ambre); background: var(--ambre-voile); padding: 7px 10px; margin-top: 10px; font-size: 12px; border-radius: 0 6px 6px 0; }
@media (max-width: 900px) {
  .fac-chaine { grid-template-columns: 1fr; gap: 6px; }
  .fac-fleche { transform: rotate(90deg); }
  .fac-envoi dl { grid-template-columns: 1fr; }
}

/* Lot KVX : exigences KAVEX / FEBEVEX / EVS, vétusté, agréments */
h4 { font-size: 14px; font-weight: 700; color: var(--encre); }
.kvx-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.kvx-bloc { border: 1px solid var(--trait); border-radius: var(--r); padding: 14px 16px; margin-top: 14px; background: var(--blanc); }
.kvx-bloc > h4 { margin-bottom: 10px; }
.kvx-table td, .kvx-table th { vertical-align: middle; }
.kvx-table select, .kvx-table input { min-width: 0; }
.kvx-bareme { font-size: 12px; color: var(--encre-2); white-space: nowrap; }
.kvx-total { font-weight: 700; color: var(--encre); }
.kvx-ecart { color: var(--ambre); font-weight: 600; }
.kvx-ok { color: var(--vert); font-weight: 600; }
.kvx-ko { color: var(--rouge); font-weight: 600; }
.kvx-formule { font-size: 12.5px; color: var(--encre-2); margin-top: 8px; }
@media (max-width: 900px) { .kvx-grille { grid-template-columns: 1fr; } }
