/* Processus observé par commodité (15/10/2026, js/58-processus-observe.js) : bandes, serpentin de cartes, voies
   parallèles, pastilles, infobulle. Thème clair : bleu AGL ; thème sombre : tout en or (aucun bleu ni turquoise) ;
   impression : bleu sur fond blanc, une commodité par page paysage. Sous 900 px : liste verticale. */
:root, :root[data-theme="light"] {
  --po-acc: var(--agl-bleu);
  --po-fort: var(--agl-marine);
  --po-vif: var(--agl-bleu-vif);
  --po-ink-acteur: #ffffff;
  --po-fond-acteur: var(--agl-bleu);
  --po-bord: #c6d3e2;
  --po-ligne: #8196ad;
  --po-ajust: #c2551b;
  --po-ajust-ink: #ffffff;
  --po-ajust-fond: #fbe9df;
  --po-j-fond: #f7ebc4;
  --po-j-ink: var(--agl-marine);
  --po-piste: #e3e9f1;
  --po-fond-pre: #eef3f9;
  --po-fond-post: #eef5f2;
  --po-fond-fac: #f8f0f2;
  --po-bande-tete: var(--agl-marine);
  --po-bande-ink: #ffffff;
  --po-bulle: var(--agl-marine);
  --po-bulle-ink: #ffffff;
  --po-bulle-mut: #c9d6e6;
  --po-carte: var(--panel);
  --po-mut: var(--mut);
}
:root[data-theme="dark"] {
  --po-acc: var(--agl-or);
  --po-fort: var(--agl-or);
  --po-vif: var(--agl-or-fonce);
  --po-ink-acteur: #091521;
  --po-fond-acteur: var(--agl-or);
  --po-bord: #4a4126;
  --po-ligne: #9c8434;
  --po-ajust: #fab219;
  --po-ajust-ink: #091521;
  --po-ajust-fond: #33280c;
  --po-j-fond: #2e2610;
  --po-j-ink: var(--agl-or);
  --po-piste: #2a2a22;
  --po-fond-pre: #16140d;
  --po-fond-post: #14130e;
  --po-fond-fac: #19150f;
  --po-bande-tete: #2e2610;
  --po-bande-ink: var(--agl-or);
  --po-bulle: #1b1a12;
  --po-bulle-ink: #f1e6c2;
  --po-bulle-mut: #c9b77a;
  --po-carte: #1a1810;
  --po-mut: #bcae86;
}

/* ------------------------------------------------------------ filtres et en-tête */
.po-filtres { display: grid; gap: 10px; margin-bottom: 14px; }
.po-onglets { display: flex; flex-wrap: wrap; gap: 6px; }
.po-onglet { border: 1.5px solid var(--po-acc); background: transparent; color: var(--po-acc); border-radius: 999px;
  padding: 5px 12px; font-weight: 700; font-size: 13px; cursor: pointer; min-height: 34px; }
.po-onglet-lib { font-weight: 400; }
.po-onglet.actif { background: var(--po-acc); color: var(--acc-ink); }
.po-onglet:focus-visible { outline: 2px solid var(--po-acc); outline-offset: 2px; }
.po-filtres .rang { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.po-filtres label[hidden] { display: none; }
:root[data-theme="dark"] .po-filtres select, :root[data-theme="dark"] .po-filtres input {
  background: var(--po-carte); border-color: var(--po-bord); color: var(--ink); }
.po-entete h2 { margin: 0 0 4px; color: var(--po-fort); font-size: 22px; }
.po-entete .po-sous { font-weight: 400; color: var(--ink); }
.po-chiffres, .po-reperes { margin: 2px 0; font-size: 13px; }
.po-reperes .po-cle { font-weight: 700; color: var(--po-acc); }
/* 15/10/2026 : échéances hors séquence (péremption du BV). */
.po-echeances { margin: 12px 0 0; border: 1.5px dashed var(--po-ajust); border-radius: 10px; padding: 8px 12px;
  background: var(--po-ajust-fond); }
.po-echeances h3 { margin: 0 0 4px; font-size: 14px; color: var(--po-fort); }
.po-echeances h3 small { font-weight: 400; color: var(--po-mut); font-size: 12px; }
.po-echeances ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.po-echeances li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--ink); }
.po-echeances .po-j { margin-left: 0; }
.po-ech-lib { font-weight: 700; }
.po-ech-avant { color: var(--po-mut); }

/* ------------------------------------------------------------ bandes et serpentin */
.po-schema { position: relative; display: grid; gap: 16px; margin: 14px 0 18px; }
svg.po-liens { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 2; }
svg.po-liens .seq { fill: none; stroke: var(--po-ligne); stroke-width: 1.6; }
svg.po-liens .para { fill: none; stroke: var(--po-ajust); stroke-width: 1.4; }
svg.po-liens .cadre { fill: color-mix(in srgb, var(--po-ajust) 6%, transparent); stroke: var(--po-ajust); stroke-width: 1.6;
  stroke-dasharray: 6 4; }
svg.po-liens .tete { fill: var(--po-ligne); }
svg.po-liens .tete-para { fill: var(--po-ajust); }

.po-bande { display: grid; grid-template-columns: 46px 1fr; border: 1px dashed var(--po-bord); border-radius: 12px;
  overflow: visible; }
.po-bande.pre { background: var(--po-fond-pre); }
.po-bande.post { background: var(--po-fond-post); }
.po-bande.fac { background: var(--po-fond-fac); }
.po-bande-tete { margin: 0; background: var(--po-bande-tete); color: var(--po-bande-ink); border-radius: 12px 0 0 12px;
  writing-mode: vertical-rl; transform: rotate(180deg); display: flex; flex-direction: column; justify-content: center;
  align-items: center; gap: 2px; padding: 8px 0; font-size: 14px; text-align: center; }
.po-bande-tete small { font-weight: 400; font-size: 10.5px; opacity: .85; }
.po-corps { display: grid; gap: 34px; padding: 30px 14px 16px; min-width: 0; }
.po-rang { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0 18px; }
.po-note-fac { margin: 0; font-size: 12px; font-style: italic; color: var(--po-mut); max-width: 70ch; }

/* ------------------------------------------------------------ cartes */
.po-carte { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 92px;
  background: var(--po-carte); border: 1.5px solid var(--po-fort); border-radius: 8px; padding: 14px 8px 7px;
  color: var(--ink); cursor: help; z-index: 3; }
.po-carte:hover, .po-carte.ouverte { box-shadow: 0 0 0 3px color-mix(in srgb, var(--po-acc) 35%, transparent); }
.po-carte:focus-visible { outline: 3px solid var(--po-acc); outline-offset: 2px; }
.po-acteur { position: absolute; top: -11px; left: 8px; max-width: calc(100% - 26px); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; background: var(--po-fond-acteur); color: var(--po-ink-acteur); border-radius: 5px;
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; }
.po-acteur[data-acteur="TER"] { background: var(--po-vif); }
.po-acteur[data-acteur="PAS"], .po-acteur[data-acteur="CHF"], .po-acteur[data-acteur="SAR"] { background: var(--po-fort); }
.po-acteur[data-acteur="BUR"], .po-acteur[data-acteur="COU"], .po-acteur[data-acteur="FAC"] {
  background: var(--po-carte); color: var(--po-fort); box-shadow: inset 0 0 0 1.5px var(--po-fort); }
.po-num { position: absolute; top: -13px; right: -9px; width: 26px; height: 26px; border-radius: 50%; display: grid;
  place-items: center; background: var(--po-fort); color: var(--acc-ink); font-size: 11px; font-weight: 700;
  border: 2px solid var(--po-carte); }
.po-source { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--po-mut); }
.po-ico { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--po-acc); stroke-linecap: round; stroke-linejoin: round; }
.po-ico .trait { stroke-width: 1.9; }
.po-ico .fin { stroke-width: 1.4; }
.po-lib { font-weight: 700; font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; flex: 1; }
.po-pied { display: flex; align-items: center; gap: 6px; font-size: 10.5px; margin-top: 2px; flex-wrap: wrap; }
.po-barre { position: relative; display: inline-block; width: 36px; height: 6px; border-radius: 3px; background: var(--po-piste);
  overflow: hidden; flex: none; }
.po-barre i { position: absolute; inset: 0 auto 0 0; background: var(--po-acc); }
.po-pct { color: var(--po-mut); font-variant-numeric: tabular-nums; }
.po-j { margin-left: auto; background: var(--po-j-fond); color: var(--po-j-ink); border: 1px solid var(--po-acc);
  border-radius: 5px; padding: 0 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.po-ajust { position: absolute; bottom: -11px; left: -9px; width: 22px; height: 22px; border-radius: 50%; display: grid;
  place-items: center; background: var(--po-ajust); color: var(--po-ajust-ink); font-size: 11px; font-weight: 700; }
.po-ajust.en-ligne { position: static; display: inline-grid; margin-right: 8px; vertical-align: middle; flex: none; }
.po-carte.fac { border-color: var(--po-ligne); }
.po-carte.a-dater .po-terrain { font-style: italic; color: var(--po-mut); }
/* 15/10/2026 : étape peu renseignée (moins de 10 % des dossiers datés) : grisée, J indicatif. */
.po-carte.rare { border-style: dashed; border-color: var(--po-ligne); background: color-mix(in srgb, var(--po-carte) 72%, var(--po-piste)); }
.po-carte.rare .po-lib { color: var(--po-mut); font-weight: 600; }
.po-carte.rare .po-barre i { background: var(--po-ligne); }
.po-j.indicatif { background: transparent; color: var(--po-mut); border-style: dashed; border-color: var(--po-ligne); font-weight: 600; }

/* ------------------------------------------------------------ infobulle */
.po-bulle { position: fixed; z-index: 60; max-width: min(380px, calc(100vw - 16px)); background: var(--po-bulle);
  color: var(--po-bulle-ink); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; line-height: 1.4;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 25%, transparent); pointer-events: none; }
.po-bulle[hidden] { display: none; }
.po-bl-titre { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.po-bl { display: grid; grid-template-columns: minmax(0, 11em) 1fr; gap: 0 10px; padding: 2px 0; }
.po-bl-cle { color: var(--po-bulle-mut); }
.po-bl-note { margin-top: 6px; font-style: italic; color: var(--po-bulle-mut); }
.po-bl-ajust { margin-top: 8px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--po-bulle-ink) 25%, transparent); }
.po-bl-ajust strong { color: var(--po-ajust); }

/* ------------------------------------------------------------ sous les bandes */
.po-annexes { display: grid; gap: 14px; }
.po-annexe h3 { margin: 0 0 6px; font-size: 15px; color: var(--po-fort); }
.po-ajustements { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.po-ajustements li { display: flex; align-items: center; font-size: 13px; }
.po-ajustements li.st-non_observe, .po-ajustements li.st-non_mesurable { color: var(--po-mut); font-style: italic; }
.po-ajustements li.st-non_observe .po-ajust { background: var(--po-piste); color: var(--po-mut); }
.po-puces { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.po-puces li { border: 1px solid var(--po-bord); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--po-mut);
  text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--po-mut) 50%, transparent); }
.po-hors { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.po-hors li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; }
.po-hors-lib { font-weight: 700; min-width: 16em; }
.po-hors .po-barre { width: 80px; }
.po-aide { font-size: 12px; margin: 4px 0; }
.po-mut { color: var(--po-mut); }

/* ------------------------------------------------------------ liste verticale sous 900 px */
@media (max-width: 900px) {
  svg.po-liens { display: none; }
  .po-bande { grid-template-columns: 1fr; }
  .po-bande-tete { writing-mode: horizontal-tb; transform: none; border-radius: 12px 12px 0 0; flex-direction: row;
    flex-wrap: wrap; justify-content: flex-start; gap: 4px 10px; padding: 8px 12px; }
  .po-corps { gap: 0; padding: 18px 10px 12px; }
  .po-rang { display: flex; flex-direction: column; gap: 22px; margin-bottom: 22px; }
  .po-carte { grid-column: auto !important; grid-row: auto !important; min-height: 0; }
  .po-carte + .po-carte::before { content: ""; position: absolute; left: 50%; top: -22px; height: 12px; border-left: 2px solid var(--po-ligne); }
  .po-carte.para { border-left: 5px solid var(--po-ajust); }
  .po-barre { width: 64px; }
  .po-onglet-lib { display: none; }
  .po-hors-lib { min-width: 0; flex-basis: 100%; }
}
@media (max-width: 480px) {
  .po-entete h2 { font-size: 18px; }
  .po-bl { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .po-carte { transition: none; } }

/* ------------------------------------------------------------ impression : bleu sur blanc, une page paysage */
@media print {
  :root, :root[data-theme="light"], :root[data-theme="dark"] {
    --po-acc: #14467c; --po-fort: #0a2240; --po-vif: #1f5fa8; --po-ink-acteur: #ffffff; --po-fond-acteur: #14467c;
    --po-bord: #c6d3e2; --po-ligne: #6f86a0; --po-ajust: #c2551b; --po-ajust-ink: #ffffff; --po-ajust-fond: #fbe9df;
    --po-j-fond: #e2ecf7; --po-j-ink: #0a2240; --po-piste: #e3e9f1; --po-fond-pre: #ffffff; --po-fond-post: #ffffff;
    --po-fond-fac: #ffffff; --po-bande-tete: #0a2240; --po-bande-ink: #ffffff; --po-carte: #ffffff; --po-mut: #1a1a1a;
  }
  .po { page: paysage; }
  .po-filtres, .po-bulle { display: none !important; }
  .po-schema { width: 267mm; break-inside: avoid; }
  .po-annexes { break-before: auto; }
  .po-carte { box-shadow: none !important; }
}
