/* Église CJT Kalubwe – charte : violet royal, or. Mobile d abord. */
:root {
  --nuit: #34195e; --nuit-2: #482680; --bleu: #5b34a0; --or: #d5a72c; --or-pale: #fbf3dc;
  --fond: #f3f5f9; --carte: #fff; --texte: #18223a; --doux: #5c6880; --bord: #dde3ee;
  --ok: #1e8a4c; --ok-pale: #e5f4ec; --alerte: #c98a00; --alerte-pale: #fff4d9;
  --danger: #c0392b; --danger-pale: #fdecea; --info-pale: #e8eefb;
  --r: 10px; --ombre: 0 1px 2px rgba(52, 25, 94, .06), 0 2px 8px rgba(52, 25, 94, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--texte);
  background: var(--fond); }
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; color: var(--nuit); }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; color: var(--nuit); }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.doux { color: var(--doux); }
.petit { font-size: .85rem; }
.nombre { font-variant-numeric: tabular-nums; }

/* --- Barre supérieure ---------------------------------------------------- */
.barre { background: var(--nuit); color: #fff; position: sticky; top: 0; z-index: 20;
  border-bottom: 3px solid var(--or); }
.barre-in { display: flex; align-items: center; gap: 1rem; max-width: 1280px; margin: 0 auto; padding: .55rem 1rem; }
.marque { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; letter-spacing: .02em; }
.marque:hover { text-decoration: none; }
.marque img { width: 34px; height: 34px; border-radius: 7px; background: #fff; padding: 2px; }
.marque span { white-space: nowrap; }
.marque small { display: block; color: var(--or); font-size: .68rem; font-weight: 600; letter-spacing: .08em; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { color: #d8e1f3; padding: .45rem .6rem; border-radius: 7px; font-size: .9rem; white-space: nowrap; }
.nav a:hover, .nav a.actif { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav a.actif { box-shadow: inset 0 -2px 0 var(--or); }
.utilisateur { color: #b9c6e2; font-size: .82rem; padding-left: .5rem; border-left: 1px solid rgba(255,255,255,.15); white-space: nowrap; }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; }

/* --- Mise en page --------------------------------------------------------- */
.page { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.entete-page { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.grille { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-detail { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r); padding: 1rem 1.1rem;
  box-shadow: var(--ombre); }
.carte + .carte { margin-top: 1rem; }
.grille > .carte + .carte { margin-top: 0; }
.carte-titre { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .75rem; }
.carte-titre h2 { margin: 0; }

/* --- Indicateurs ---------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r); padding: .9rem 1rem;
  box-shadow: var(--ombre); border-top: 3px solid var(--bleu); }
.kpi .val { font-size: 1.9rem; font-weight: 700; color: var(--nuit); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .lib { color: var(--doux); font-size: .85rem; }
.kpi.danger { border-top-color: var(--danger); } .kpi.danger .val { color: var(--danger); }
.kpi.alerte { border-top-color: var(--or); }
.kpi.ok { border-top-color: var(--ok); }
a.kpi:hover { text-decoration: none; border-color: var(--bleu); }

/* Pipeline des phases */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; }
.etape-pipe { position: relative; background: var(--info-pale); border-radius: 8px; padding: .7rem .6rem; text-align: center;
  color: var(--nuit); }
.etape-pipe:hover { text-decoration: none; background: #dbe4f8; }
.etape-pipe .n { font-size: 1.6rem; font-weight: 700; display: block; font-variant-numeric: tabular-nums; }
.etape-pipe .l { font-size: .8rem; color: var(--doux); }
.etape-pipe:not(:last-child)::after { content: "›"; position: absolute; right: -.45rem; top: 50%; transform: translateY(-50%);
  color: var(--or); font-weight: 700; z-index: 1; }

/* Barres horizontales simples */
.barres { list-style: none; margin: 0; padding: 0; }
.barres li { display: grid; grid-template-columns: 9rem 1fr 3.5rem; gap: .6rem; align-items: center; padding: .25rem 0;
  font-size: .88rem; }
.barres .piste { display: block; background: var(--fond); border-radius: 4px; height: 10px; overflow: hidden; }
.barres .rempli { display: block; background: var(--bleu); height: 100%; border-radius: 4px; }
.barres .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--doux); }

/* --- Tableaux --------------------------------------------------------------- */
.tableau-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tab { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tab th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux);
  padding: .55rem .6rem; border-bottom: 2px solid var(--bord); white-space: nowrap; }
.tab td { padding: .6rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
.tab tr:hover td { background: #f8faff; }
.tab tr.retard td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.tab .r { text-align: right; }
.ref { font-weight: 600; white-space: nowrap; }
.plaque { font-family: ui-monospace, Consolas, monospace; background: var(--or-pale); border: 1px solid #ecd9a3;
  padding: .05rem .35rem; border-radius: 4px; font-size: .85rem; white-space: nowrap; }

/* --- Pastilles ------------------------------------------------------------ */
.pastille, .tag { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 600;
  white-space: nowrap; background: var(--info-pale); color: var(--nuit); }
.ph-annonce { background: #eef0f4; color: #4a5568; }
.ph-frontiere { background: #e3ecfb; color: #1d4690; }
.ph-douane { background: #efe6fb; color: #5b2d91; }
.ph-parking { background: var(--or-pale); color: #8a6200; }
.ph-flux { background: #e1f4f6; color: #0e6670; }
.ph-site { background: var(--ok-pale); color: #186b3c; }
.ph-cloture { background: #eceef2; color: #626b7c; }
.tag.danger { background: var(--danger-pale); color: var(--danger); }
.tag.alerte { background: var(--alerte-pale); color: #8a5d00; }
.tag.ok { background: var(--ok-pale); color: var(--ok); }
.niv { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  font-weight: 700; font-size: .8rem; background: var(--info-pale); color: var(--nuit); }
.niv-2 { background: var(--alerte-pale); color: #8a5d00; }
.niv-3 { background: #ffe1d6; color: #b34312; }
.niv-4 { background: var(--danger); color: #fff; }

/* --- Frise du dossier ------------------------------------------------------ */
.frise { display: flex; list-style: none; padding: 0; margin: .5rem 0 0; counter-reset: e; }
.frise li { flex: 1; text-align: center; position: relative; font-size: .78rem; color: var(--doux); padding-top: 2rem; }
.frise li::before { counter-increment: e; content: counter(e); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 1.6rem; height: 1.6rem; line-height: 1.6rem; border-radius: 50%; background: #e6eaf2; color: var(--doux);
  font-weight: 700; z-index: 1; }
.frise li::after { content: ""; position: absolute; top: .8rem; left: -50%; width: 100%; height: 3px; background: #e6eaf2; }
.frise li:first-child::after { display: none; }
.frise li.fait::before { content: "✓"; background: var(--ok); color: #fff; }
.frise li.fait::after, .frise li.en-cours::after { background: var(--ok); }
.frise li.en-cours::before { background: var(--or); color: var(--nuit); box-shadow: 0 0 0 4px var(--or-pale); }
.frise li.en-cours { color: var(--nuit); font-weight: 700; }

/* Historique */
.histo { list-style: none; margin: 0; padding: 0; }
.histo li { position: relative; padding: 0 0 .9rem 1.2rem; border-left: 2px solid var(--bord); margin-left: .35rem; }
.histo li::before { content: ""; position: absolute; left: -.42rem; top: .3rem; width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--bleu); border: 2px solid #fff; }
.histo li:last-child { border-left-color: transparent; }

dl.infos { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .35rem 1rem; margin: 0; font-size: .9rem; }
dl.infos dt { color: var(--doux); }
dl.infos dd { margin: 0; font-weight: 500; }

/* --- Formulaires ----------------------------------------------------------- */
.champ { margin-bottom: .8rem; }
.champ label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .25rem; color: #34405a; }
.champ .aide { font-size: .78rem; color: var(--doux); margin-top: .2rem; }
.champ .err { font-size: .8rem; color: var(--danger); margin-top: .2rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=datetime-local], input[type=month], input[type=tel], input:not([type]),
input[type=file], select, textarea { width: 100%; padding: .55rem .65rem; border: 1px solid #c9d2e3; border-radius: 8px;
  font: inherit; background: #fff; color: var(--texte); min-height: 2.6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 81, 163, .25); border-color: var(--bleu); }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; vertical-align: middle; }
.form-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.form-grille .large { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 700; color: var(--nuit); margin-bottom: .6rem; font-size: .95rem; padding: 0; }
.filtres { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto auto; gap: .6rem; align-items: end; }
.filtres .champ { margin: 0; }
.case { display: flex; align-items: center; gap: .4rem; font-size: .88rem; min-height: 2.6rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; min-height: 2.6rem;
  border-radius: 8px; border: 1px solid var(--bord); background: #fff; color: var(--nuit); font: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--bleu); }
.btn-p { background: var(--nuit); color: #fff; border-color: var(--nuit); }
.btn-p:hover { background: var(--nuit-2); }
.btn-or { background: var(--or); border-color: var(--or); color: var(--nuit); }
.btn-danger { color: var(--danger); border-color: #f0c4be; }
.btn-s { padding: .3rem .6rem; min-height: 2rem; font-size: .82rem; }
.btn-bloc { width: 100%; }

details.pli { border: 1px solid var(--bord); border-radius: 8px; padding: .6rem .8rem; background: #fbfcfe; }
details.pli + details.pli { margin-top: .6rem; }
details.pli summary { cursor: pointer; font-weight: 600; color: var(--nuit); }
details.pli[open] summary { margin-bottom: .7rem; }

/* --- Messages ----------------------------------------------------------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .5rem; background: var(--info-pale); border-left: 4px solid var(--bleu); }
.messages .success { background: var(--ok-pale); border-color: var(--ok); }
.messages .warning { background: var(--alerte-pale); border-color: var(--or); }
.messages .error { background: var(--danger-pale); border-color: var(--danger); }
.bandeau { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: var(--danger-pale); color: #7f2318;
  border-left: 4px solid var(--danger); }
.bandeau.alerte { background: var(--alerte-pale); color: #6b4800; border-color: var(--or); }
.vide { text-align: center; color: var(--doux); padding: 1.5rem; }

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; align-items: center; }

/* Signature ePOD */
.signature { border: 2px dashed #c9d2e3; border-radius: 8px; background: #fff; width: 100%; height: 170px; touch-action: none; display: block; }

/* --- Connexion ----------------------------------------------------------- */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: linear-gradient(160deg, var(--nuit) 0%, #0a1f45 60%, #102c63 100%); }
.connexion .carte { width: 100%; max-width: 400px; padding: 2rem; border-top: 4px solid var(--or); }
.connexion .logo { text-align: center; margin-bottom: 1.25rem; }
.connexion .logo img { width: 72px; }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .etape-pipe::after { display: none; }
  .g-detail, .g3 { grid-template-columns: 1fr; }
  .filtres { grid-template-columns: 1fr 1fr; }
  .filtres .champ:first-child { grid-column: 1 / -1; }
  .form-grille { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1340px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--nuit); padding: .5rem; border-bottom: 3px solid var(--or); }
  .nav.ouvert { display: flex; }
  .utilisateur { border: 0; padding: .5rem .7rem; }
  /* Menu replié : défile s'il est plus haut que l'écran ; le compte et la déconnexion restent en tête */
  .nav { max-height: calc(100vh - 70px); overflow-y: auto; }
  .nav .utilisateur, .nav .deconnexion { order: -1; }
  .nav .deconnexion { padding: 0 .7rem .5rem; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: .3rem !important; }
}
@media (max-width: 760px) {
  .g2 { grid-template-columns: 1fr; }
  .form-grille { grid-template-columns: 1fr; }
  .page { padding: 1rem .75rem 3rem; }
  .kpi .val { font-size: 1.6rem; }
  .frise li { font-size: .68rem; }
  .barres li { grid-template-columns: 6.5rem 1fr 3rem; }
  /* Tableaux en cartes sur téléphone */
  table.empile thead { display: none; }
  table.empile tr { display: block; border: 1px solid var(--bord); border-radius: 8px; margin-bottom: .6rem; background: #fff; }
  table.empile td { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #eef1f6; padding: .45rem .7rem; text-align: right; }
  table.empile td::before { content: attr(data-l); color: var(--doux); font-size: .78rem; text-align: left; }
  table.empile td:last-child { border-bottom: 0; }
}
/* v0.4 : boutons d'action sur une ligne dans les tableaux larges */
@media (min-width: 1180px) { .tab td .actions { flex-wrap: nowrap; } }

/* v0.8 : module Construction */
.onglets { display: flex; gap: .15rem; overflow-x: auto; border-bottom: 2px solid var(--bord); margin: 0 0 1rem;
  -webkit-overflow-scrolling: touch; }
.onglets a { padding: .55rem .8rem; white-space: nowrap; color: var(--doux); font-weight: 600; font-size: .88rem;
  border-bottom: 3px solid transparent; margin-bottom: -2px; }
.onglets a:hover { color: var(--nuit); text-decoration: none; }
.onglets a.actif { color: var(--nuit); border-bottom-color: var(--or); }
.projet-tete { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: baseline; justify-content: space-between;
  margin-bottom: .6rem; }
.projet-tete h1 { margin: 0; }
.tab.serre td, .tab.serre th { padding: .35rem .45rem; font-size: .84rem; }
.tab td.r, .tab th.r, .r { text-align: right; }
.nw { white-space: nowrap; }
.tab tfoot td { font-weight: 700; border-top: 2px solid var(--bord); color: var(--nuit); }
.boq tr.n0 td { background: var(--info-pale); font-weight: 700; color: var(--nuit); }
.boq tr.n1 td { background: #f6f8fc; font-weight: 600; }
.boq tr.n2 td { font-weight: 600; font-style: italic; }
.boq td.des { padding-left: calc(.45rem + var(--ind, 0) * 1.1rem); }
.boq input { min-height: 1.9rem; padding: .2rem .35rem; text-align: right; width: 7.5rem; }
.boq tr.ajoute td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.boq tr.modifie td:first-child { box-shadow: inset 3px 0 0 var(--or); }
.boq tr.supprime td { color: var(--doux); text-decoration: line-through; }
.positif { color: var(--ok); } .negatif { color: var(--danger); }
.jauge { height: 8px; background: #e8ecf3; border-radius: 4px; overflow: hidden; min-width: 70px; }
.jauge > span { display: block; height: 100%; background: var(--bleu); border-radius: 4px; }
.jauge.ok > span { background: var(--ok); } .jauge.alerte > span { background: var(--or); }
.jauge.danger > span { background: var(--danger); }
.gantt-wrap { overflow-x: auto; border: 1px solid var(--bord); border-radius: 8px; background: #fff; }
.gantt text { font: 11px "Segoe UI", Roboto, Arial, sans-serif; fill: #34405a; }
.gantt .lib { font-size: 11.5px; }
.gantt .recap-lib { font-weight: 700; fill: var(--nuit); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; display: block; }
.photos figcaption { font-size: .78rem; color: var(--doux); margin-top: .2rem; }
.mini-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.mini-form .champ { margin: 0; min-width: 9rem; flex: 1; }
.mini-form input, .mini-form select { min-height: 2.3rem; }
.inline { display: inline; }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi .sous { font-size: .78rem; color: var(--doux); margin-top: .15rem; }
.evm { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.evm div { background: var(--fond); border-radius: 8px; padding: .5rem .65rem; }
.evm b { display: block; font-size: 1.15rem; color: var(--nuit); font-variant-numeric: tabular-nums; }
.evm span { font-size: .75rem; color: var(--doux); }
.legende { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .8rem; color: var(--doux); margin-top: .4rem; }
.legende i { display: inline-block; width: 18px; height: 4px; vertical-align: middle; margin-right: .3rem; border-radius: 2px; }
@media (max-width: 1000px) { .kpis.k5, .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .onglets, .projet-tete .actions { display: none !important; } }
/* v0.8 : barre de menu plus compacte (module Construction ajouté) */
.nav a { padding: .45rem .48rem; font-size: .86rem; }
@media (min-width: 1341px) and (max-width: 1600px) { .nav .utilisateur { display: none; } .marque span { display: none; } .nav a { padding: .45rem .42rem; } }
/* HSE : matrice de risque G × P et compteur de jours sans accident */
.matrice-risque { border-collapse: collapse; font-size: .82rem; }
.matrice-risque td, .matrice-risque th { width: 2.6rem; height: 2.3rem; text-align: center; border: 2px solid #fff; }
.matrice-risque th { color: var(--doux, #5c6880); font-weight: 600; }
.rf { background: #d9f2e1; color: #17643a; } .rm { background: #fff0b8; color: #7a5a00; }
.re { background: #ffd2a8; color: #8a3b00; } .rc { background: #f6b4ae; color: #8a1810; font-weight: 700; }
.compteur-jsa { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-radius: 14px;
  background: linear-gradient(135deg, #34195e, #17457f); color: #fff; }
.compteur-jsa .n { font-size: 3rem; font-weight: 800; line-height: 1; color: #fff; }
.compteur-jsa .l { font-size: .9rem; opacity: .9; }
.pyramide { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pyramide div { text-align: center; color: #fff; font-size: .8rem; padding: .3rem .4rem; border-radius: 4px; }
.barres-mois { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: .5rem; }
.barres-mois .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; }
.barres-mois .b span { width: 100%; border-radius: 3px 3px 0 0; }
.barres-mois small { font-size: .68rem; color: var(--doux, #5c6880); }
.grille-c { display: flex; gap: .3rem; flex-wrap: wrap; } .grille-c label { border: 1px solid var(--bord, #d9e0ea); border-radius: 8px; padding: .3rem .6rem; cursor: pointer; }
.grille-c input:checked + span { font-weight: 700; }

/* --- Direction : tableaux de bord consolidés --------------------------------------- */
.selecteur { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 1rem; }
.selecteur .vues { display: inline-flex; border: 1px solid var(--bord); border-radius: 8px; overflow: hidden; background: #fff; }
.selecteur .vues a { padding: .35rem .7rem; font-size: .85rem; color: var(--nuit); border-right: 1px solid var(--bord); }
.selecteur .vues a:last-child { border-right: 0; }
.selecteur .vues a.actif { background: var(--nuit); color: #fff; }
.selecteur select { padding: .3rem .4rem; border: 1px solid var(--bord); border-radius: 8px; }
.kpis.dir { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi .sous { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-top: .35rem;
  font-size: .78rem; color: var(--doux); }
.kpi .spark { width: 100%; height: 26px; margin-top: .3rem; display: block; }
.evol { font-size: .78rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.evol.hausse { color: var(--ok); } .evol.baisse { color: var(--danger); } .evol.neutre { color: var(--doux); }
svg.graphe { width: 100%; height: auto; display: block; }
svg.graphe .ax { font-size: 10.5px; fill: #5c6880; font-family: inherit; }
.legende { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .78rem; color: var(--doux); margin-top: .4rem; }
.leg { display: inline-flex; align-items: center; gap: .3rem; } .leg i { width: .7rem; height: .7rem; border-radius: 2px; display: inline-block; }
.jauge { position: relative; display: block; height: 8px; background: var(--fond); border-radius: 4px; overflow: visible; min-width: 60px; }
.jauge > span:first-child { display: block; height: 100%; border-radius: 4px; }
.jauge .repere { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--nuit); }
.metier-barre { display: block; height: 6px; background: var(--fond); border-radius: 3px; margin-top: .25rem; }
.metier-barre span { display: block; height: 100%; border-radius: 3px; }
.pastille-m { display: inline-block; width: .65rem; height: .65rem; border-radius: 2px; margin-right: .35rem; vertical-align: baseline; }
.points { list-style: none; margin: 0; padding: 0; }
.points li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--bord); font-size: .9rem; }
.points li:last-child { border-bottom: 0; }
.points .dom { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--doux); padding-top: .15rem; }
.points li.danger { box-shadow: inset 3px 0 0 var(--danger); padding-left: .6rem; }
.points li.alerte { box-shadow: inset 3px 0 0 var(--or); padding-left: .6rem; }
.points li.info { box-shadow: inset 3px 0 0 var(--bleu); padding-left: .6rem; }
.mini-tab td, .mini-tab th { padding: .38rem .45rem !important; font-size: .86rem; }
.tab tr.total td { font-weight: 700; border-top: 2px solid var(--nuit); background: var(--or-pale); }
.tab tr.sous-total td { font-weight: 600; background: #f6f8fc; }
.chiffre-cle { font-size: 1.5rem; font-weight: 700; color: var(--nuit); font-variant-numeric: tabular-nums; line-height: 1.15; }
.ligne-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.ligne-chiffres > div { border-left: 3px solid var(--bord); padding-left: .6rem; }
.ligne-chiffres .lib { font-size: .78rem; color: var(--doux); }
.grille-saisie { overflow-x: auto; }
.grille-saisie table { border-collapse: collapse; font-size: .82rem; min-width: 1200px; }
.grille-saisie th, .grille-saisie td { border: 1px solid var(--bord); padding: .2rem .25rem; text-align: right; white-space: nowrap; }
.grille-saisie th { background: var(--fond); color: var(--nuit); font-weight: 600; text-align: center; }
.grille-saisie td.lib { text-align: left; font-weight: 600; background: #fafbfd; min-width: 10rem; }
.grille-saisie input { width: 5.6rem; border: 1px solid transparent; background: transparent; text-align: right; padding: .2rem; font: inherit; }
.grille-saisie input:focus { border-color: var(--bleu); background: #fff; outline: none; }
.grille-saisie td.erp { background: #eef6f0; } .grille-saisie td.double { background: var(--danger-pale); }
.grille-saisie tr.co td { color: var(--doux); }
.jeu-carte { display: block; padding: .8rem 1rem; border: 1px solid var(--bord); border-radius: var(--r); background: #fff; color: var(--texte); }
.jeu-carte:hover { border-color: var(--bleu); text-decoration: none; }
.jeu-carte b { color: var(--nuit); display: block; }
.editeur { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
.editeur .panneau { position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); overflow-y: auto; }
.editeur fieldset { border: 0; border-top: 1px solid var(--bord); padding: .6rem 0 .2rem; margin: 0; }
.editeur legend { font-weight: 700; color: var(--nuit); font-size: .85rem; padding: 0 .3rem 0 0; }
.editeur label.col { display: flex; gap: .4rem; align-items: center; font-size: .85rem; padding: .1rem 0; }
.editeur select, .editeur input[type=text], .editeur input[type=number] { width: 100%; padding: .3rem .4rem; border: 1px solid var(--bord); border-radius: 6px; font: inherit; font-size: .85rem; margin-bottom: .3rem; }
.editeur .filtre { display: grid; grid-template-columns: 1fr; gap: 0; padding: .3rem; background: var(--fond); border-radius: 6px; margin-bottom: .4rem; }
.resultat-rapport { overflow-x: auto; }
.resultat-rapport .tab td { white-space: nowrap; }
@media (max-width: 1100px) { .kpis.dir { grid-template-columns: repeat(3, minmax(0, 1fr)); } .editeur { grid-template-columns: 1fr; } .editeur .panneau { position: static; max-height: none; } }
@media (max-width: 760px) { .kpis.dir { grid-template-columns: repeat(2, minmax(0, 1fr)); } .points li { grid-template-columns: 1fr; gap: .1rem; } .kpi .val { font-size: 1.45rem; } }
@media print { .selecteur, .sous-menu-dir { display: none !important; } }
.mini-tab td.nombre, .mini-tab th.r { white-space: nowrap; }
@media (max-width: 1000px) { .grille[style*="grid-template-columns"] { grid-template-columns: 1fr !important; } }

/* --- GED et signature électronique ---------------------------------------------------- */
.arbre, .arbre ul { list-style: none; margin: 0; padding: 0; }
.arbre > li { padding: .35rem 0; border-bottom: 1px solid var(--bord); }
.arbre > li:last-child { border-bottom: 0; }
.arbre ul { padding-left: .9rem; margin-top: .2rem; font-size: .88rem; }
.arbre ul li { padding: .12rem 0; }
.arbre a.actif { color: var(--nuit); font-weight: 700; box-shadow: inset 0 -2px 0 var(--or); }
.extrait { color: var(--doux); margin-top: .2rem; }
.extrait mark, mark { background: var(--or-pale); color: var(--nuit); padding: 0 .1rem; border-radius: 2px; }
.apercu-doc { padding: 0; overflow: hidden; } .apercu-doc iframe { width: 100%; height: 620px; border: 0; display: block; }
.filtres-ged { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto auto; gap: .6rem; align-items: center; }
.filtres-ged select, .filtres-ged input[type=date] { padding: .35rem .4rem; border: 1px solid var(--bord); border-radius: 8px; }
.circuit { list-style: none; counter-reset: c; margin: 0; padding: 0; }
.circuit li { position: relative; padding: .55rem .6rem .55rem 2.6rem; border: 1px solid var(--bord); border-radius: 8px; margin-bottom: .5rem; }
.circuit li::before { counter-increment: c; content: counter(c); position: absolute; left: .6rem; top: .55rem; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: #e6eaf2; color: var(--doux); text-align: center; line-height: 1.5rem; font-weight: 700; font-size: .8rem; }
.circuit li.signe::before { content: "✔"; background: var(--ok); color: #fff; }
.circuit li.refuse::before { content: "✘"; background: var(--danger); color: #fff; }
.circuit li.courant { border-color: var(--or); background: var(--or-pale); }
.circuit li.courant::before { background: var(--or); color: var(--nuit); }
.sig-img { max-height: 54px; margin-top: .3rem; }
.pad-signature { width: 100%; max-width: 420px; height: 140px; border: 1px dashed var(--bord); border-radius: 8px; background: #fff; touch-action: none; display: block; }
@media (max-width: 1000px) { .filtres-ged { grid-template-columns: 1fr 1fr; } }

/* --- Portail client ---------------------------------------------------------------------- */
.bandeau-apercu { background: var(--or); color: var(--nuit); text-align: center; padding: .4rem 1rem; font-size: .9rem; }
.bandeau-apercu a { color: var(--nuit); font-weight: 700; text-decoration: underline; margin-left: .6rem; }
.pied-portail { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--bord); text-align: center; color: var(--doux); font-size: .8rem; }
.progression { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin-top: .35rem; min-width: 160px; }
.progression span { height: 6px; border-radius: 3px; background: #e3e8f1; }
.progression span.fait { background: var(--bleu); } .progression span.courant { background: var(--or); }
.progression.retard span.courant { background: var(--danger); }
.etapes-phases { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; margin: .4rem 0 1rem; }
.etapes-phases div { text-align: center; font-size: .78rem; color: var(--doux); padding-top: .5rem; border-top: 4px solid #e3e8f1; }
.etapes-phases div.fait { border-color: var(--bleu); color: var(--nuit); } .etapes-phases div.courant { border-color: var(--or); color: var(--nuit); font-weight: 700; }
.chrono { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--bord); }
.chrono li { position: relative; padding: 0 0 .9rem .6rem; }
.chrono li::before { content: ""; position: absolute; left: -1.43rem; top: .3rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--bleu); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--bord); }
.chrono li:last-child::before { background: var(--or); }
.chrono .quand { font-size: .78rem; color: var(--doux); }
.epod { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.epod img { max-width: 100%; max-height: 180px; border: 1px solid var(--bord); border-radius: 8px; background: #fff; }
@media (max-width: 760px) { .epod { grid-template-columns: 1fr; } .etapes-phases div { font-size: .62rem; } }
@media print { .bandeau-apercu, .pied-portail { display: none !important; } }

/* --- Douane (LOG.08) ----------------------------------------------------------------------- */
.tag.info { background: var(--info-pale); color: var(--bleu); }
.chaine { list-style: none; margin: 0; padding: 0; counter-reset: e; }
.chaine li { position: relative; padding: .45rem .6rem .45rem 2.4rem; border-left: 2px solid var(--bord); margin-left: .75rem; }
.chaine li::before { counter-increment: e; content: counter(e); position: absolute; left: -.8rem; top: .4rem; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: #e6eaf2; color: var(--doux); text-align: center; line-height: 1.5rem; font-weight: 700; font-size: .78rem; }
.chaine li.fait::before { content: "✔"; background: var(--ok); color: #fff; }
.chaine li.courant::before { background: var(--or); color: var(--nuit); }
.chaine li.courant { font-weight: 600; }
.chaine li:last-child { border-left-color: transparent; }
.chaine .det { display: block; font-size: .8rem; color: var(--doux); font-weight: 400; }
.controles { list-style: none; margin: 0; padding: 0; }
.controles li { padding: .45rem .6rem; border-radius: 6px; margin-bottom: .35rem; font-size: .9rem; background: var(--info-pale); }
.controles li.danger { background: var(--danger-pale); color: #7f2318; }
.controles li.alerte { background: var(--alerte-pale); color: #6b4800; }
.total-estime { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  border: 2px solid var(--nuit); border-radius: 10px; padding: .8rem 1rem; background: var(--fond); }
.total-estime .m { font-size: 1.6rem; font-weight: 800; color: var(--nuit); font-variant-numeric: tabular-nums; }
.tab tr.suspendu td { color: var(--doux); font-style: italic; }
@media (min-width: 1001px) and (max-width: 1600px) {
  body.portail .nav a { padding: .45rem .36rem; font-size: .84rem; }
  body.portail .marque small { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Compléments église */
.graphe-barres { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: .5rem 0 0; }
.graphe-barres .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
.graphe-barres .paire { display: flex; align-items: flex-end; gap: 2px; height: 100%; width: 100%; justify-content: center; }
.graphe-barres .b { width: 42%; border-radius: 3px 3px 0 0; min-height: 1px; }
.graphe-barres .r { background: var(--bleu); } .graphe-barres .d { background: var(--or); }
.graphe-barres small { font-size: 10.5px; color: var(--doux); }
.legende { display: flex; gap: 1rem; font-size: 12.5px; color: var(--doux); }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.barre-prog { height: 8px; background: var(--bord); border-radius: 4px; overflow: hidden; }
.barre-prog > span { display: block; height: 100%; background: var(--ok); }
.verset { font-style: italic; color: var(--doux); }
.graphe-barres .col { min-width: 0; }
.graphe-barres small { white-space: nowrap; }
@media (max-width: 600px) { .graphe-barres { gap: 2px; } .graphe-barres .col:nth-child(even) small { visibility: hidden; } }
.carte { min-width: 0; }
.grille > div { min-width: 0; }
@media (max-width: 1000px) { .g-detail, .g2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .filtres { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }
  .form-grille { grid-template-columns: minmax(0, 1fr) !important; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* v1.1 : application mobile (installation, barre du bas, partage) */
.barre-bas { display: none; }
.installer { background: var(--or); color: var(--nuit); border-color: var(--or); font-weight: 600; }
.connexion .installer { background: var(--or-pale); color: var(--nuit); border-color: var(--or); }
@media (max-width: 760px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .barre-bas { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 30; background: #fff; border-top: 1px solid var(--bord); box-shadow: 0 -2px 10px rgba(52, 25, 94, .08);
    padding-bottom: env(safe-area-inset-bottom); }
  .barre-bas a, .barre-bas button { display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; min-height: 58px; padding: .3rem .1rem; color: var(--doux); font-family: inherit; font-weight: 600; font-size: .7rem; line-height: 1.1; background: none;
    border: 0; position: relative; cursor: pointer; }
  .barre-bas span { font-size: 1.3rem; line-height: 1.2; }
  .barre-bas a:hover { text-decoration: none; }
  .barre-bas .actif { color: var(--nuit); }
  .barre-bas .actif span { color: var(--or); }
  .barre-bas .actif::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px;
    border-radius: 0 0 3px 3px; background: var(--or); }
  .pastille { position: absolute; top: 5px; left: 55%; background: var(--danger); color: #fff; border-radius: 9px;
    font-size: .62rem; padding: 0 .35rem; line-height: 1.35rem; min-width: 1.35rem; }
  .nav { max-height: calc(100vh - 70px - 64px); }
  .page { padding-bottom: 1.5rem; }
}
@media print { .barre-bas { display: none !important; } body { padding-bottom: 0; } }
.autonome .barre { padding-top: env(safe-area-inset-top); }
.partage .qr svg { width: min(240px, 70vw); height: auto; border: 1px solid var(--bord); border-radius: 8px; }
.lien-public { word-break: break-all; font-weight: 600; margin: .6rem 0 1rem; }
.actions-partage { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.etapes-install { margin: .25rem 0 .75rem; padding-left: 1.2rem; }
.etapes-install li { margin: .2rem 0; }
.approbations { display: grid; grid-template-columns: 1fr; gap: .8rem; }
.approbations .btn { white-space: normal; width: 100%; line-height: 1.3; min-width: 0; }
.approbations > * { min-width: 0; }
.appro { border: 1px dashed var(--bord); border-radius: var(--r); padding: .7rem; display: grid; gap: .35rem; align-content: start; }
.appro.faite { border-style: solid; border-color: var(--ok); }
.appro.faite strong { color: var(--ok); }
.btn[disabled] { opacity: .45; cursor: not-allowed; background: var(--fond); }
.raison { margin-top: .25rem; }
