/* ============================================================================
   ÉCRAN — fiche d'affaire pilotée par jalons, et son PV (EasyProjects, 2026-10-04)
   Pages/Projet/JalonsAffaire.razor (/app/projets/fiche/{id}/jalons)
   Pages/Projet/PvAffaire.razor     (/app/projets/fiche/{id}/pv/{jalon})

   Famille .pjl-* (grep vide avant ouverture). Aucune couleur écrite : jetons --et-*.
   Le cadre (page, faits, cartes, tableaux, boutons) est celui du gabarit .mx-* ;
   cette feuille n'ajoute que la frise, le panneau du jalon, la piste du Gantt et la
   feuille A4 du PV.
   ============================================================================ */

.pjl-titre-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pjl-corps, .pjl-pv-corps { display: flex; flex-direction: column; gap: 16px; }

/* ---- Onglets de la fiche (EnTeteAffaire) ------------------------------------
   Des liens, pas un rail : chaque onglet est une page avec son adresse. Posés au pied
   de .mx-page-tete, sur toute sa largeur ; défilent en largeur plutôt que de passer à
   la ligne sur un téléphone. */
.pjl-onglets {
    display: flex; overflow-x: auto; padding: 0 12px;
    border-top: 1px solid var(--et-hairline);
}
.pjl-onglet {
    flex: none; display: inline-flex; align-items: center; min-height: var(--et-onglet-h); padding: 0 var(--et-onglet-px);
    color: var(--et-ink); font-size: var(--et-onglet-fs); text-decoration: none; white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.pjl-onglet:hover { color: var(--et-form-blue-d); }
.pjl-onglet:focus-visible { outline: 2px solid var(--et-form-blue); outline-offset: -2px; }
.pjl-onglet.est-actif { color: var(--et-form-blue-d); border-bottom-color: var(--et-form-blue); font-weight: 600; }

/* ---- Navigation entre affaires (EnTeteAffaire) -------------------------------
   Sur la ligne du fil, à droite ; passe sous le fil quand la place manque. */
.pjl-fil-rang { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.pjl-voisins { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pjl-voisins .mx-btn-ico { width: 32px; height: 32px; }
.pjl-voisins-choix { width: auto; max-width: 280px; }
.pjl-voisins-rang { font-size: 12px; color: var(--et-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pjl-voisins [aria-disabled="true"] { color: var(--et-inerte); cursor: default; pointer-events: none; }

/* ---- Cadre de l'affaire (synthèse) --------------------------------------------- */
.pjl-cadre { display: grid; grid-template-columns: 158px minmax(0, 1fr); gap: 8px 16px; margin: 0; padding: 12px 16px; font-size: 13px; }
.pjl-cadre dt { text-align: right; color: var(--et-muted); font-weight: 400; }
.pjl-cadre dd { margin: 0; }
.pjl-cadre dd.mono { font-family: var(--et-font-mono); }

/* ---- Import du classeur ---------------------------------------------------- */
.pjl-import { position: relative; overflow: hidden; cursor: pointer; }
.pjl-import-fichier { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pjl-import:focus-within { outline: 2px solid var(--et-form-blue); outline-offset: 1px; }
.pjl-import-corps { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.pjl-avert { margin: 0; color: var(--et-avertissement-ink); font-size: 13px; }
.pjl-actions { display: flex; flex-wrap: wrap; gap: var(--et-outils-gap); }
.pjl-champ { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--et-muted); max-width: 520px; }
.pjl-vide { padding: 24px; }

/* ---- Frise des jalons -------------------------------------------------------- */
.pjl-frise {
    position: relative; display: flex; overflow-x: auto;
    background: var(--et-surface); border: 1px solid var(--et-hairline); padding: 6px 4px;
}
.pjl-frise::before {
    content: ""; position: absolute; left: 54px; right: 54px; top: 25px;
    height: 2px; background: var(--et-filet-fort);
}
.pjl-jalon {
    position: relative; flex: 1 0 108px; min-width: 108px; min-height: 44px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 8px 4px; border: 0; background: transparent; cursor: pointer;
    color: var(--et-ink); font: inherit;
}
.pjl-jalon:hover .pjl-losange { outline: 3px solid var(--et-tint); }
.pjl-jalon:focus-visible { outline: 2px solid var(--et-form-blue); outline-offset: -2px; }
.pjl-losange {
    width: 14px; height: 14px; margin: 4px 0; transform: rotate(45deg);
    background: var(--et-surface); border: 2px solid var(--et-avertissement-mark);
}
.pjl-jalon.est-fait .pjl-losange { background: var(--et-succes); border-color: var(--et-succes); }
.pjl-jalon.est-retenu .pjl-losange { background: var(--et-form-blue); border-color: var(--et-form-blue); }
.pjl-jalon-code { font-family: var(--et-font-mono); font-size: 12px; font-weight: 600; }
.pjl-jalon-lbl { font-size: 12px; color: var(--et-muted); text-align: center; line-height: 1.3; }
.pjl-jalon.est-retenu .pjl-jalon-lbl { color: var(--et-form-blue-d); font-weight: 700; }

/* ---- Panneau du jalon retenu --------------------------------------------------- */
.pjl-panneau { border-top: 3px solid var(--et-form-blue); }
.pjl-tete-droite { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.pjl-panneau-grille { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.pjl-panneau-col { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.pjl-panneau-col + .pjl-panneau-col { border-left: 1px solid var(--et-hairline); }
.pjl-col-titre { font-size: 12px; font-weight: 600; color: var(--et-muted); letter-spacing: .04em; text-transform: uppercase; }
.pjl-tache { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--et-hairline); font-size: 13px; }
.pjl-tache-code { width: 34px; flex: none; color: var(--et-muted); }
.pjl-tache-lbl { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pjl-tache-statut { flex: 0 0 130px; }
.pjl-livrable { margin: 0; font-size: 13px; font-weight: 600; }

/* ---- Plan & Gantt ------------------------------------------------------------- */
.pjl-plan td, .pjl-plan th { white-space: nowrap; }
.pjl-lib.pjl-pile-titre { max-width: 300px; }
.pjl-plan .pjl-lib.mx-tbl-faible { max-width: 220px; }

/* La frise du plan : une IMAGE qui défile seule en largeur, le nom de ligne figé à gauche. */
.pjl-frise { overflow-x: auto; }
.pjl-frise-in { min-width: calc(220px + var(--pjl-sem) * 44px); }
.pjl-frise-rang { display: flex; align-items: center; border-bottom: 1px solid var(--et-hairline); }
.pjl-frise-nom {
    position: sticky; left: 0; z-index: 1; flex: 0 0 220px; width: 220px; padding: 4px 10px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
    background: var(--et-surface); border-right: 1px solid var(--et-hairline);
}
.pjl-frise-tete .pjl-frise-nom { background: var(--et-surface-2); }
.pjl-frise-tete .pjl-semaines { background: var(--et-surface-2); color: var(--et-muted); }
.pjl-frise-rang.pjl-phase .pjl-frise-nom { background: var(--et-tint); font-weight: 700; }
.pjl-frise-rang.pjl-ligne-jalon .pjl-frise-nom { font-weight: 600; }
.pjl-droite { text-align: right; }
.pjl-lib { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.pjl-plan tr.pjl-phase td { background: var(--et-tint); font-weight: 700; }
.pjl-plan tr.pjl-ligne-jalon td { background: var(--et-avertissement-bg); font-weight: 600; color: var(--et-ink); }
.pjl-semaines { display: flex; }
.pjl-semaines > span {
    flex: 0 0 44px; width: 44px; padding: 7px 0; text-align: center;
    font-family: var(--et-font-mono); font-weight: 400; font-size: 12px;
}
.pjl-gantt-piste {
    position: relative; display: block; height: 28px; width: calc(var(--pjl-sem) * 44px);
    background-image: repeating-linear-gradient(90deg, transparent 0 43px, var(--et-rang) 43px 44px);
}
.pjl-barre { position: absolute; top: 9px; height: 10px; background: var(--et-form-blue-l); }
.pjl-barre.est-phase { top: 8px; height: 12px; background: var(--et-form-blue); }
.pjl-barre.est-tache.est-fait { background: var(--et-succes); }
.pjl-barre.est-jalon {
    top: 8px; width: 11px !important; height: 11px; margin-left: -6px;
    transform: rotate(45deg); background: var(--et-avertissement-mark);
}
.pjl-barre.est-jalon.est-fait { background: var(--et-succes); }

.pjl-plan-statut { min-width: 120px; }
.pjl-atterrissage tr.pjl-total td { font-weight: 700; border-top: 1px solid var(--et-filet-fort); }

/* ---- Registre ------------------------------------------------------------------ */
.pjl-enonce { min-width: 220px; }
.pjl-enonce-txt { display: block; color: var(--et-muted); }
.pjl-type { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pjl-type-0 { background: var(--et-tint); color: var(--et-form-blue-d); }
.pjl-type-1 { background: var(--et-avertissement-bg); color: var(--et-avertissement-ink); }
.pjl-type-2 { background: var(--et-succes-bg); color: var(--et-succes-ink); }
.pjl-actions-ligne { white-space: nowrap; }
.pjl-actions-ligne .mx-btn + .mx-btn { margin-left: 4px; }

/* ---- Carte EasyCommission (Finance, Documents) ------------------------------ */
.pjl-commission-corps { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.pjl-com { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--et-hairline); }
.pjl-com-tete { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; }
.pjl-com-etapes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pjl-com-etapes li {
    padding: 2px 10px; border: 1px solid var(--et-filet-fort); border-radius: 999px;
    font-size: 12px; color: var(--et-muted);
}
.pjl-com-etapes li::before { content: "○ "; }
.pjl-com-etapes li.est-fait { border-color: var(--et-succes); color: var(--et-succes-ink); background: var(--et-succes-bg); }
.pjl-com-etapes li.est-fait::before { content: "✓ "; }
.pjl-com .pjl-actions { align-items: center; }
.pjl-com-choix { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Onglet « Commissions » : la ligne de tête de l'affaire commissionnée affichée, sous l'en-tête de
   l'affaire (FicheAffaireCommission intégrée) — titre de carte, objet en glose, boutons à droite. */
.pjl-vente-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; }
.pjl-vente-titre { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pjl-vente-objet { font-size: 13px; color: var(--et-muted); }
.pjl-vente-tete .mx-outils { margin-left: auto; }
.pjl-com-choix .mx-input { flex: 1 1 200px; }
.pjl-com-choix .mx-select { flex: 2 1 260px; }

/* ---- Carte EasyDesk (Exécution) : reprend le corps de la carte EasyCommission -- */
.pjl-sup-form { display: flex; flex-direction: column; gap: 8px; }

/* ---- PV : saisie + feuille A4 -------------------------------------------------- */
.pjl-pv-disposition { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.pjl-pv-form { flex: 1 1 260px; min-width: 0; }
fieldset.pjl-pv-champs { margin: 0; border: 0; min-width: 0; }
.pjl-pv-champs { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 18px; }
.pjl-groupe { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--et-ink); border-bottom: 1px solid var(--et-hairline); padding-bottom: 4px; }

.pjl-feuille {
    flex: 0 0 auto; width: 210mm; max-width: 100%; min-height: 297mm; box-sizing: border-box;
    padding: 10mm 11mm 8mm; background: var(--et-surface); color: var(--et-ink);
    border: 1px solid var(--et-hairline); box-shadow: var(--et-ombre-flottant);
    display: flex; flex-direction: column; gap: 6px; font-size: 13px;
}
.pjl-f-bandeau { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--et-blue); color: var(--et-sur-marine); }
.pjl-f-marque { display: flex; align-items: center; gap: 8px; line-height: 1.15; }
.pjl-f-marque small { display: block; font-size: 12px; color: var(--et-sur-marine-doux); }
.pjl-f-logo {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--et-action); color: var(--et-sur-aplat); font-weight: 700; font-size: 18px;
}
.pjl-f-bandeau h2 { flex: 1; margin: 0; text-align: center; font-size: 18px; font-weight: 700; }
.pjl-f-ref { font-size: 12px; text-align: right; line-height: 1.5; color: var(--et-sur-marine-doux); }
.pjl-feuille h3 {
    margin: 2px 0 0; padding: 4px 10px; font-size: 14px; font-weight: 700;
    background: var(--et-tint); color: var(--et-form-blue-d);
}
.pjl-f-grille { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px; align-items: center; }
.pjl-f-grille > span:not(.pjl-f-val) { font-size: 12px; color: var(--et-muted); }
.pjl-f-val { min-height: 20px; padding: 2px 7px; border: 1px solid var(--et-bord-champ); box-sizing: border-box; }
.pjl-f-2 { grid-column: span 2; }
.pjl-f-montant { font-family: var(--et-font-mono); text-align: right; }
.pjl-f-bloc { min-height: 40px; white-space: pre-line; line-height: 1.45; }
.pjl-f-sous { font-size: 12px; font-weight: 700; color: var(--et-form-blue-d); margin-top: 2px; }
.pjl-f-deux { display: flex; gap: 14px; }
.pjl-f-deux > :first-child { flex: 1 1 auto; min-width: 0; }
.pjl-f-deux > :first-child:not(.pjl-f-grille) { display: flex; flex-direction: column; gap: 4px; }
.pjl-f-deux > .pjl-f-grille { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); align-self: flex-start; }
.pjl-f-signature { flex: 0 0 220px; display: flex; flex-direction: column; gap: 4px; }
.pjl-f-cap { font-size: 12px; font-weight: 700; font-style: italic; color: var(--et-form-blue-d); text-align: center; }
.pjl-f-lieu { display: flex; justify-content: space-between; font-size: 12px; }
.pjl-f-cadre { height: 46px; border: 1px solid var(--et-bord-champ); }
.pjl-f-lu { font-size: 16px; font-weight: 700; text-align: center; }
.pjl-f-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pjl-f-table th { /* densité voulue : papier — la checklist du PV A4 tient sur une page */ text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--et-ink); }
.pjl-f-table td { /* densité voulue : papier — la checklist du PV A4 tient sur une page */ padding: 2px 4px; border-bottom: 1px solid var(--et-filet-fort); }
.pjl-f-table td:nth-child(2), .pjl-f-table td:nth-child(3) { white-space: nowrap; }
.pjl-f-decisions { margin: 0; padding-left: 18px; font-size: 12px; }
/* SITUATION DE TRAVAUX (FeuilleSituation, 2026-10-08) — même feuille que le PV. Un montant reste
   à droite même en cellule d'en-tête : « .pjl-f-table th » (alignement à gauche de la checklist)
   l'emportait sur .pjl-f-montant, et les totaux en gras du décompte partaient à gauche. Les deux
   visas se partagent la largeur, au lieu du 220 px de la signature unique du PV. */
.pjl-f-table th.pjl-f-montant, .pjl-f-table td.pjl-f-montant { text-align: right; white-space: nowrap; }
.pjl-f-visas > .pjl-f-signature { flex: 1 1 0; min-width: 0; }
.pjl-f-note { display: flex; align-items: center; gap: 3px; font-size: 12px; }
.pjl-f-note > span:first-child { width: 150px; color: var(--et-muted); }
.pjl-f-case { width: 22px; text-align: center; padding: 2px 0; border: 1px solid var(--et-bord-champ); }
.pjl-f-case.est-coche { background: var(--et-blue); color: var(--et-sur-marine); font-weight: 700; }
.pjl-f-pied {
    margin-top: auto; display: flex; justify-content: space-between; gap: 10px;
    padding-top: 6px; border-top: 1px solid var(--et-bord-champ); font-size: 12px; color: var(--et-muted);
}

/* ---- Largeurs ------------------------------------------------------------------ */
/* EMPILEMENT DES TABLES DE LA FICHE (.pjl-pile), sous 1024 px : la rangée devient un bloc, sa
   cellule .pjl-pile-titre en tête (précédée du code .pjl-pile-code), chaque autre cellule
   précédée de son libellé (data-lbl). Une colonne qui sortait de l'écran était une colonne
   omise — registre, plan, temps, dépenses, factures, PV (banc du 2026-10-05). */
@media (max-width: 1024px) {
    .pjl-pile thead { display: none; }
    .pjl-pile, .pjl-pile tbody, .pjl-pile tfoot { display: block; width: 100%; }
    .pjl-pile tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 8px 12px; border-bottom: 1px solid var(--et-hairline); }
    .pjl-pile td { display: block; border: 0 !important; padding: 0 !important; background: none !important; text-align: left !important; white-space: normal !important; max-width: none !important; }
    .pjl-pile td.pjl-pile-code { flex: none; }
    .pjl-pile td.pjl-pile-titre { flex: 1 1 60%; font-weight: 600; }
    .pjl-pile td[data-lbl] { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .pjl-pile td[data-lbl]::before { content: attr(data-lbl); flex: none; font-size: 12px; font-weight: 600; color: var(--et-muted); }
    .pjl-pile td[data-lbl]:empty { display: none; }
    .pjl-pile tr.pjl-phase { background: var(--et-tint); }
    .pjl-pile tr.pjl-ligne-jalon { background: var(--et-avertissement-bg); }
    .pjl-pile td .mx-select, .pjl-pile td .mx-input { max-width: 60%; }
    .mx-page-tete .mx-fil a { display: inline-flex; align-items: center; min-height: 44px; }
    .pjl-voisins .mx-btn, .pjl-voisins-choix { min-height: 44px; min-width: 44px; }
    .pjl-tache-statut { flex-basis: 120px; min-height: 44px; }
    .pjl-plan-statut { min-height: 44px; }
    .pjl-commission .mx-btn, .pjl-com-choix .mx-input, .pjl-com-choix .mx-select { min-height: 44px; }
    .pjl-support .mx-btn, .pjl-sup-form .mx-input, .pjl-support a { min-height: 44px; }
    .pjl-actions-ligne .mx-btn { min-height: 44px; }
}
@media (max-width: 720px) {
    .pjl-voisins { margin-left: 0; width: 100%; }
    .pjl-voisins-choix { flex: 1 1 auto; min-width: 0; max-width: none; }
    .pjl-cadre { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .pjl-cadre dt { text-align: left; margin-top: 6px; }
    .pjl-panneau-grille { grid-template-columns: minmax(0, 1fr); }
    .pjl-panneau-col + .pjl-panneau-col { border-left: 0; border-top: 1px solid var(--et-hairline); }
    .pjl-f-grille { grid-template-columns: minmax(0, 1fr); }
    .pjl-f-2 { grid-column: auto; }
    .pjl-f-deux { flex-direction: column; }
    .pjl-f-signature { flex-basis: auto; }
}
/* La feuille A4 sur un téléphone : elle reste la feuille, mais son bandeau passe à la ligne et
   la checklist laisse ses colonnes se replier — à 390 px elles sortaient de la feuille. */
@media (max-width: 640px) {
    .pjl-feuille { padding: 12px; min-height: 0; }
    .pjl-f-bandeau { flex-wrap: wrap; }
    .pjl-f-bandeau h2 { flex: 1 1 100%; order: 3; text-align: left; font-size: 16px; }
    .pjl-f-ref { text-align: left; }
    .pjl-f-table td:nth-child(2), .pjl-f-table td:nth-child(3) { white-space: normal; }
    .pjl-f-table { table-layout: fixed; }
    .pjl-f-table th, .pjl-f-table td { overflow-wrap: anywhere; }
}

/* ---- Impression : la feuille seule ------------------------------------------- */
@media print {
    body:where(:has(.pjl-imprimable)) * { visibility: hidden; }
    .pjl-imprimable, .pjl-imprimable * { visibility: visible; }
    .pjl-imprimable {
        position: absolute; left: 0; top: 0; width: 100%; min-height: 0;
        border: 0; box-shadow: none; padding: 0;
    }
    .pjl-hors-impression { display: none !important; }
    .pjl-f-bandeau, .pjl-feuille h3, .pjl-f-case.est-coche {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
}
