/* Charte Espace Gestion (kit ACO EspaceGestion 2023) : marine #003366, framboise #cc3366,
   police Designosaur (titres). */
@font-face {
  font-family: "Designosaur";
  src: url("/static/fonts/Designosaur.ttf") format("truetype");
  font-display: swap;
}

:root {
  --marine: #003366;
  --marine-clair: #0d4a80;
  --framboise: #cc3366;
  --framboise-claire: #ec6f9c;
  --accent: #cc3366;
  --accent-fonce: #a82a55;
  --fond: #f4f6fa;
  --carte: #ffffff;
  --texte: #22304a;
  /* 5,08:1 sur le fond de page, 5,50:1 sur une carte. Le gris
     précédent (#64748b) tombait à 4,40 sur le fond : sous le seuil
     AA, et c'est la couleur de toutes les mentions secondaires. */
  --texte-doux: #5b6a80;
  --bordure: #e2e8f0;
  --succes: #15803d;
  --erreur: #b91c1c;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--fond);
  color: var(--texte);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.disposition { display: flex; min-height: 100vh; }

/* ---------- Menu latéral ---------- */
.menu {
  width: 230px; flex-shrink: 0;
  background: var(--marine); color: #cbd5e1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.logo {
  padding: 20px; color: #fff; font-size: 1.3rem;
  font-family: "Designosaur", -apple-system, sans-serif;
  display: flex; align-items: center; gap: 12px;
}
.logo img { width: 42px; height: 42px; background: #fff; border-radius: 10px; padding: 3px; flex-shrink: 0; }
.logo span { color: var(--framboise-claire); }
.logo small { display: block; font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.62rem; font-weight: 600; color: #94a3b8; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 4px; }
/* min-height: 0 — sans lui, un enfant flex qui défile s'étire quand même à la hauteur de son
   contenu : menu déplié plus haut que l'écran = entrées débordant de la colonne bleue,
   blanc sur blanc. */
.menu nav { flex: 1; min-height: 0; padding: 8px 0; overflow-y: auto; }
.menu { overflow: hidden; }
.menu nav a {
  display: block; padding: 9px 20px; color: #cbd5e1; font-size: 0.92rem;
  border-left: 3px solid transparent;
}
.menu nav a:hover { background: var(--marine-clair); color: #fff; text-decoration: none; }
.menu nav a.actif { background: var(--marine-clair); color: #fff; border-left-color: var(--framboise-claire); }
.menu nav .separateur { margin: 10px 20px 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: #7f95b3; }
.menu-pied { padding: 14px 20px; border-top: 1px solid #1a4d80; font-size: 0.85rem; }
.menu-pied small { color: #94a3b8; }
.menu-pied a { display: inline-block; margin-top: 6px; color: var(--framboise-claire); }

/* ---------- Contenu ---------- */
main { flex: 1; padding: 28px 34px 60px; max-width: 1200px; }

.entete-page { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.entete-page h1 { font-size: 1.45rem; font-family: "Designosaur", -apple-system, sans-serif; color: var(--marine); font-weight: 400; }
.entete-page .sous-titre { color: var(--texte-doux); font-size: 0.92rem; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

h2 { font-size: 1.05rem; margin: 26px 0 10px; }
.entete-groupe { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.entete-groupe h2 a { color: var(--marine); }

/* ---------- Cartes & statistiques ---------- */
.carte { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.grille-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 14px 18px; }
.stat .valeur { font-size: 1.7rem; font-weight: 700; color: var(--marine); }
.stat .intitule { font-size: 0.82rem; color: var(--texte-doux); }

/* ---------- Tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; overflow: hidden; }
.tableau th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--texte-doux); padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--bordure); }
.tableau td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.tableau tr:last-child td { border-bottom: none; }
.tableau .vide { color: var(--texte-doux); text-align: center; padding: 24px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.badge-ouverte, .badge-brouillon, .badge-non_cree { background: #fef3c7; color: #92400e; }
.badge-deposee, .badge-en_cours, .badge-envoye { background: #dbeafe; color: #1d4ed8; }
.badge-validee, .badge-repondue { background: #e0e7ff; color: #4338ca; }
.badge-traitee, .badge-signe, .badge-actif, .badge-envoyee { background: #dcfce7; color: #166534; }
.badge-cloturee, .badge-fermee, .badge-archive, .badge-sorti, .badge-inactif { background: #e2e8f0; color: #475569; }
.badge-suspendu, .badge-erreur { background: #fee2e2; color: #b91c1c; }
.badge-simulee { background: #f3e8ff; color: #7e22ce; }

/* ---------- Boutons ---------- */
/* Une seule classe, sans sélecteur d'élément : « button.bouton » était plus
   spécifique que « .bouton-secondaire » et lui imposait le fond framboise et le
   texte blanc. Les boutons secondaires écrits en <button> — « Actualiser »,
   « Tout replier » — s'affichaient donc comme des boutons principaux, et le
   survol rendait leur libellé blanc sur fond quasi blanc. */
.bouton {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; font-family: inherit; line-height: 1.4;
}
.bouton:hover { background: var(--accent-fonce); text-decoration: none; }
.bouton-secondaire { background: #fff; color: var(--texte); border: 1px solid var(--bordure); }
.bouton-secondaire:hover { background: #f8fafc; border-color: var(--framboise); color: var(--framboise); }
.bouton-danger { background: #fff; color: var(--erreur); border: 1px solid #fecaca; }
.bouton-danger:hover { background: #fef2f2; }
.bouton-petit { padding: 4px 10px; font-size: 0.8rem; }

/* ---------- Formulaires ---------- */
.formulaire { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.formulaire .pleine-largeur { grid-column: 1 / -1; }
.formulaire label, .champ label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--texte-doux); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="month"], input[type="file"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--bordure); border-radius: 8px;
  font-family: inherit; font-size: 0.92rem; background: #fff; color: var(--texte);
}
textarea { min-height: 90px; resize: vertical; }
/* Le liseré de focus était rose pâle : 1,68:1 sur blanc, invisible en
   pratique — or c'est le seul repère de qui navigue au clavier. Il est
   désormais posé sur *tout* ce qui prend le focus, boutons et liens compris,
   et en `:focus-visible` pour ne pas encadrer ce qu'on vient de cliquer. */
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent-fonce); outline-offset: 2px; border-radius: 4px;
}
.formulaire-ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.formulaire-ligne > div { flex: 1; min-width: 130px; }

/* ---------- Messages flash ---------- */
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.flash-succes { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-erreur { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ---------- Connexion ---------- */
.page-connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--marine); }
.boite-connexion { background: #fff; border-radius: 14px; padding: 38px 36px; width: 380px; max-width: 92vw; }
.logo-complet { text-align: center; padding-bottom: 18px; }
.logo-complet img { width: 190px; max-width: 100%; }
.logo-complet small { display: block; font-size: 0.68rem; font-weight: 600; color: var(--texte-doux); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 6px; }
.boite-connexion label { margin-top: 12px; }
.boite-connexion .bouton { width: 100%; margin-top: 18px; padding: 10px; }

/* ---------- Fils de discussion (questions) ---------- */
.message-fil { border: 1px solid var(--bordure); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.message-fil.equipe { border-left: 4px solid var(--accent); }
.message-fil .auteur { font-size: 0.82rem; color: var(--texte-doux); margin-bottom: 6px; }
.message-fil p { white-space: pre-wrap; }

.liste-simple { list-style: none; }
.liste-simple li { padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.liste-simple li:last-child { border-bottom: none; }
.texte-doux { color: var(--texte-doux); font-size: 0.88rem; }
.encadre-info { background: #e9f0f7; border: 1px solid #c6d8ea; border-radius: 8px; padding: 10px 14px; font-size: 0.88rem; margin-bottom: 14px; }

@media (max-width: 900px) {
  .disposition { flex-direction: column; }
  .menu { width: 100%; height: auto; position: static; }
  main { padding: 18px; }
  .formulaire { grid-template-columns: 1fr; }
}

/* ---------- Base documentaire & simulateur ---------- */
.cycle-procedure { background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 6px 18px; margin-bottom: 18px; }
.etape-procedure { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.etape-procedure:last-child { border-bottom: none; }
.etape-numero { width: 26px; height: 26px; border-radius: 50%; background: var(--marine); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.82rem; font-weight: 700; }
.etape-titre { font-weight: 700; margin-bottom: 3px; }
.grille-fiches { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.carte-vigilance { border-left: 4px solid var(--framboise); }

/* ---------------------------------------------------------------------------
   Tableau de bord interactif
   Les indicateurs, les alertes et les lignes de tableau mènent à la page qui
   permet d'agir : un chiffre affiché sans le moyen d'y donner suite n'a pas
   d'usage dans un outil de production.
   --------------------------------------------------------------------------- */

a.stat {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
a.stat:hover {
  border-color: var(--framboise);
  box-shadow: 0 2px 10px rgba(0, 51, 102, .09);
  transform: translateY(-1px);
}
a.stat:hover .valeur { color: var(--framboise); }

.grille-alertes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.alerte {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--marine-clair);
  border-radius: 10px;
  padding: 13px 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .12s, transform .12s;
}
.alerte:hover { box-shadow: 0 2px 10px rgba(0, 51, 102, .09); transform: translateY(-1px); }
/* Le rouge est réservé à ce qui empêche de produire un acte : une identité
   incomplète, un signataire manquant, un délai déjà dépassé. */
.alerte-bloquant { border-left-color: var(--framboise); }
.alerte-compte {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--marine);
  line-height: 1.1;
  min-width: 2ch;
  text-align: right;
}
.alerte-bloquant .alerte-compte { color: var(--framboise); }
.alerte-intitule { font-weight: 600; font-size: 0.93rem; }
.alerte-detail { font-size: 0.82rem; color: var(--texte-doux); margin-top: 2px; }

.ligne-cliquable { cursor: pointer; }
.ligne-cliquable:hover { background: #f8fafc; }

.grille-raccourcis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.raccourci {
  display: block;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: 9px;
  padding: 12px 15px;
  text-decoration: none;
  color: var(--marine);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color .12s, color .12s;
}
.raccourci:hover { border-color: var(--framboise); color: var(--framboise); }

/* Durée saisie en deux temps : un nombre et son unité, pour qu'une période
   d'essai s'exprime toujours dans une forme exploitable. */
.champ-duree { display: flex; gap: 8px; }
.champ-duree input { flex: 1 1 auto; min-width: 0; }
.champ-duree select { flex: 0 0 auto; width: auto; }

/* ---------------------------------------------------------------------------
   Convention collective : sommaire à gauche, contenu à droite.
   Le texte intégral n'est jamais rendu d'un bloc — la plus volumineuse des
   conventions suivies compte 363 articles pour 1,6 Mo.
   --------------------------------------------------------------------------- */

.grille-convention { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grille-convention { grid-template-columns: 1fr; } }

.sommaire { max-height: 70vh; overflow-y: auto; }
.sommaire .liste-simple li { padding: 6px 0; font-size: 0.88rem; }
.sommaire a { color: var(--marine); text-decoration: none; }
.sommaire a:hover { color: var(--framboise); }
.sommaire a.lien-actif { color: var(--framboise); font-weight: 700; }

.themes { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.theme {
  display: inline-block;
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--marine);
  background: var(--fond);
}
.theme:hover { border-color: var(--framboise); color: var(--framboise); }
.theme-actif { background: var(--framboise); border-color: var(--framboise); color: #fff; }

.article-convention { padding: 14px 20px 16px; }
.article-entete {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
}
.article-entete a { text-decoration: none; font-size: 0.82rem; }

/* Un article se replie : la liste d'un titre reste parcourable même quand ses
   articles font plusieurs milliers de caractères. Le résumé porte le numéro et
   les premières lignes, de quoi choisir sans déplier. */
details.article-convention > summary {
  cursor: pointer;
  list-style: none;
  display: block;
  position: relative;
  padding-right: 26px;
}
details.article-convention > summary::-webkit-details-marker { display: none; }
details.article-convention > summary::after {
  content: "▸";
  position: absolute;
  right: 2px;
  top: 0;
  color: var(--texte-doux);
  transition: transform .12s;
}
details.article-convention[open] > summary::after { content: "▾"; }
details.article-convention > summary:hover .article-entete strong { color: var(--framboise); }
details.article-convention > summary .extrait {
  display: block;
  margin-top: 6px;
  color: var(--texte-doux);
  font-size: 0.86rem;
  line-height: 1.6;
}
details.article-convention[open] > summary {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bordure);
}
details.article-convention[open] > summary .extrait { display: none; }

/* Le texte d'une convention se lit en continu : interligne généreux, largeur
   de ligne bornée — au-delà d'environ 80 caractères l'œil perd la ligne — et
   respiration entre les paragraphes, que la conversion du HTML préserve. */
.corps-article { font-size: 0.92rem; line-height: 1.75; max-width: 80ch; }
.corps-article p { margin: 0 0 0.85em; white-space: pre-line; }
.corps-article p:last-child { margin-bottom: 0; }
.extrait {
  white-space: pre-line; font-size: 0.9rem; line-height: 1.7;
  max-width: 80ch; margin: 0;
}
.extrait mark, .corps-article mark { background: #ffe8a3; padding: 0 2px; border-radius: 3px; }

/* Les deux sources d'import côte à côte : elles se choisissent, elles ne
   s'enchaînent pas. */
.grille-imports { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }

/* Jauge de répartition : une barre proportionnelle vaut mieux qu'un pourcentage
   seul pour comparer d'un coup d'œil les types d'absence entre eux. */
.jauge {
  display: inline-block; width: 90px; height: 8px; border-radius: 4px;
  background: var(--bordure); overflow: hidden; vertical-align: middle;
  margin-right: 6px;
}
.jauge > span { display: block; height: 100%; background: var(--framboise); }
.solde-negatif { color: var(--erreur); }

/* Authentification unique : les boutons des fournisseurs viennent après le
   formulaire, séparés d'un trait — le mot de passe reste la voie principale
   pour les comptes client et salarié. */
.separateur-connexion {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 14px; color: var(--texte-doux); font-size: 0.82rem;
}
.separateur-connexion::before, .separateur-connexion::after {
  content: ""; flex: 1; height: 1px; background: var(--bordure);
}
.bouton-sso { display: block; width: 100%; text-align: center; margin-bottom: 8px; }

.liste-numerotee { margin: 0 0 0 18px; font-size: 0.9rem; line-height: 1.7; }
.liste-numerotee li { margin-bottom: 8px; }
.liste-numerotee code { background: var(--fond); padding: 2px 5px; border-radius: 4px; }

/* Consultation d'un espace client : le bandeau doit être impossible à manquer,
   sous peine de croire que l'on agit sur son propre espace. */
.bandeau-vue-client {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--marine); color: #fff; border-radius: 10px;
  padding: 12px 18px; margin-bottom: 16px; font-size: 0.88rem;
}
.bandeau-vue-client .bouton { background: #fff; color: var(--marine); }
.bandeau-vue-client .bouton:hover { background: #e8eef5; }

/* Pendant la consultation d'un espace client, « Mon profil » n'aurait pas de
   sens : le compte affiché est une vue, pas une personne. */
.lien-pied {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--framboise-claire); font: inherit; text-decoration: underline;
}

/* Communication institutionnelle dans la reprise de veille : signalée sans être
   masquée — le tri appartient à celui qui publie. */
.ligne-institutionnelle { opacity: .62; }

/* Article de veille : la synthèse de l'équipe se distingue du texte repris —
   l'une engage le cabinet, l'autre non. */
.carte-synthese { border-left: 4px solid var(--framboise); background: #fff7fa; }
.puce-article { padding-left: 1.1em; text-indent: -1.1em; margin-bottom: .5em; }
.corps-article h3 {
  font-size: 1rem; color: var(--marine); margin: 1.4em 0 .5em;
}
.corps-article h3:first-child { margin-top: 0; }

/* ---------- Aperçu et partage des documents ---------- */
.actions-document { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions-document form { display: inline; }

.fenetre {
  border: none; border-radius: 12px; padding: 0; width: min(940px, 92vw);
  max-width: 92vw; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  /* La remise à zéro générale des marges (* { margin: 0 }) prive <dialog> du
     « margin: auto » qui le centre : il faut le reposer ici. */
  margin: auto;
}
.fenetre::backdrop { background: rgba(15, 23, 42, 0.55); }
.fenetre-entete {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--bordure);
}
.fenetre-entete > div { display: flex; gap: 6px; align-items: center; }
.fenetre iframe { display: block; width: 100%; height: 74vh; border: 0; background: #f1f5f9; }
.fenetre-etroite { width: min(460px, 92vw); }
.fenetre-etroite form { padding: 20px 22px 22px; }

.ligne-lien { display: flex; gap: 6px; align-items: center; }
.ligne-lien input { font-size: 0.82rem; min-width: 220px; }

/* ---------- Pastilles du menu ---------- */
/* Le décompte se lit sans ouvrir la page : c'est ce qui fait du menu une liste
   de tâches plutôt qu'un sommaire. */
.menu nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.menu nav a > span:first-child { min-width: 0; }
.pastille {
  flex-shrink: 0; background: var(--framboise); color: #fff;
  border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; font-weight: 700;
  line-height: 1.5;
}
.menu nav a.actif .pastille { background: #fff; color: var(--framboise); }

/* ---------- Onglets de second niveau ---------- */
/* Le second niveau se rend en tête de la page mère plutôt qu'en repli dans la
   barre latérale : l'utilisateur voit alors où il est, et non ce qu'il pourrait
   déplier. */
.onglets {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--bordure); margin: -6px 0 20px;
}
.onglets a {
  padding: 9px 16px; color: var(--texte-doux); font-size: 0.92rem;
  font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.onglets a:hover { color: var(--texte); text-decoration: none; background: #f8fafc; }
.onglets a.onglet-actif { color: var(--framboise); border-bottom-color: var(--framboise); }

/* ---------- Bandeau de dossier ---------- */
/* La société sur laquelle on travaille reste sous la main : on change d'onglet,
   pas de société. */
.bandeau-dossier {
  background: #fff; border: 1px solid var(--bordure); border-radius: 10px;
  padding: 12px 16px 0; margin-bottom: 18px;
}
.bandeau-dossier-titre { font-size: 1.02rem; font-weight: 700; margin-bottom: 8px; }
.bandeau-dossier-titre a { color: var(--marine); }
.bandeau-dossier-titre .texte-doux { font-weight: 400; font-size: 0.85rem; }
.onglets-dossier { margin: 0 -16px; padding: 0 8px; border-bottom: none; }
.onglets-dossier a { padding: 8px 12px; font-size: 0.88rem; font-weight: 600; }

/* ---------- Bandeau d'échéance du client ---------- */
/* « Qu'attend-on de moi, et pour quand ? » — la question que se pose un
   employeur en ouvrant le portail, répondue avant qu'il ait à chercher. */
.bandeau-echeance {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 18px;
  font-weight: 600; border: 1px solid transparent;
}
.bandeau-echeance:hover { text-decoration: none; filter: brightness(0.97); }
.bandeau-fleche { flex-shrink: 0; font-size: 1.1rem; }
.bandeau-retard { background: #fef2f2; border-color: #fecaca; color: var(--erreur); }
.bandeau-attention { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.bandeau-calme { background: #f0f9ff; border-color: #bae6fd; color: #075985; font-weight: 400; }

/* Bandeau de salarié : sous celui de la société, plus discret — la personne se
   lit dans le dossier, jamais l'inverse. */
.bandeau-salarie {
  background: var(--fond); border: 1px solid var(--bordure); border-radius: 10px;
  padding: 10px 16px 0; margin: -8px 0 18px;
}
.bandeau-salarie .bandeau-dossier-titre { font-size: 0.95rem; }

/* ---------- Menu dépliant ---------- */
/* Les groupes se replient : sept blocs ouverts en permanence donnaient une
   colonne à parcourir des yeux plutôt qu'un menu. Celui de la page courante
   s'ouvre côté serveur — sans JavaScript le menu reste entier, avec lui l'état
   choisi est retenu d'une page à l'autre. */
.menu nav { padding: 6px 0 14px; }
.groupe-libre { padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid #12406e; }

.groupe-titre {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; cursor: pointer; font-family: inherit;
  padding: 9px 18px 9px 20px; margin: 2px 0 0;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: #7f95b3; font-weight: 700; text-align: left;
  transition: color 0.15s ease;
}
.groupe-titre:hover { color: #cbd5e1; }
.groupe-titre > span:first-child { flex: 1; min-width: 0; }
.chevron { width: 15px; height: 15px; flex-shrink: 0; transition: transform 0.28s ease; }
.groupe.ouvert .chevron { transform: rotate(180deg); }

/* Repli animé sans mesurer la hauteur en JavaScript : la grille interpole
   elle-même de 0fr à 1fr. */
.groupe-liens {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.groupe-liens > div { overflow: hidden; }
.groupe.ouvert > .groupe-liens { grid-template-rows: 1fr; }

/* Un groupe replié annonce ce qu'il cache d'urgent. */
.pastille-groupe { background: var(--framboise); font-size: 0.68rem; padding: 0 7px; }
.groupe.ouvert .pastille-groupe { opacity: 0; transition: opacity 0.2s ease; }

/* ---------- Icônes ---------- */
.icone { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; transition: opacity 0.15s ease, transform 0.15s ease; }
.menu nav a { gap: 11px; transition: background 0.15s ease, border-color 0.15s ease, padding-left 0.15s ease; }
.menu nav a .intitule { flex: 1; min-width: 0; }
.menu nav a:hover .icone { opacity: 1; transform: translateX(1px); }
.menu nav a.actif .icone { opacity: 1; }

/* ---------- Mouvements ---------- */
/* Discrets et brefs : ils doivent confirmer une action, jamais la faire attendre. */
.carte, .tableau tr, .bouton, .stat, .alerte, .raccourci {
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease,
              border-color 0.15s ease;
}
.stat:hover, .alerte:hover, .raccourci:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08); }
.tableau tr.ligne-cliquable:hover { background: #f8fafc; }
.bouton:active { transform: translateY(1px); }

main > .flash, main > .bandeau-echeance { animation: apparait 0.3s ease both; }
main > .entete-page { animation: apparait 0.25s ease both; }
@keyframes apparait { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Le mouvement est un agrément, jamais une condition : qui le refuse garde une
   application entière. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; transition-duration: 0.001ms !important;
  }
}

/* ---------- Icônes dans les pages ---------- */
/* La même icône dans le menu et en tête de page : c'est la même chose, et l'œil
   les relie sans y penser. */
.entete-page h1 { display: flex; align-items: center; gap: 11px; }
.icone-titre { width: 22px; height: 22px; opacity: 0.55; flex-shrink: 0; }

.flash { display: flex; align-items: flex-start; gap: 10px; }
.flash .icone { flex-shrink: 0; margin-top: 2px; }
.bandeau-echeance .icone { opacity: 0.8; }
.bandeau-vue-client > div:first-child { display: flex; align-items: flex-start; gap: 10px; }
.bandeau-vue-client .icone { flex-shrink: 0; margin-top: 2px; }

.alerte { position: relative; }
.icone-alerte { position: absolute; top: 14px; right: 14px; width: 16px; height: 16px; opacity: 0.28; }

/* Une icône dans un bouton : l'action se reconnaît avant d'être lue. */
.bouton { display: inline-flex; align-items: center; gap: 7px; }
.bouton .icone { width: 15px; height: 15px; opacity: 0.9; }
.bouton-petit .icone { width: 13px; height: 13px; }

/* Une icône discrète en tête de tuile : elle nomme la mesure sans occuper la
   place du chiffre, qui reste ce qu'on vient lire. */
.stat { position: relative; }
.icone-stat { position: absolute; top: 14px; right: 14px; width: 18px; height: 18px; opacity: 0.22; }
.stat:hover .icone-stat { opacity: 0.45; }

/* Décompte des jours d'une absence, sous les yeux de qui saisit. */
.decompte {
  padding: 9px 10px; border: 1px dashed var(--bordure); border-radius: 8px;
  background: #f8fafc; font-size: 0.88rem; white-space: nowrap;
}

/* --- Contrôle URSSAF : voyants et taux d'accomplissement ------------------
   Un dossier de contrôle se lit de loin : on veut savoir en entrant s'il reste
   quelque chose à faire, pas lire trente lignes. D'où le point de couleur en
   tête de chaque ligne, et la jauge en haut de page. Le rouge pulse — c'est le
   seul endroit de l'application où une animation attire volontairement l'œil,
   parce qu'une pièce obligatoire introuvable ne doit pas se rater. */
.voyant {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  vertical-align: middle; flex: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9) inset;
}
.voyant-vert { background: var(--succes); }
.voyant-rouge { background: var(--erreur); animation: voyant-pulse 2.2s ease-in-out infinite; }
.voyant-attention { background: #d97706; }
.voyant-attente { background: #94a3b8; }
.voyant-neutre { background: var(--bordure); }

@keyframes voyant-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9) inset, 0 0 0 0 rgba(185, 28, 28, 0.45); }
  50% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9) inset, 0 0 0 5px rgba(185, 28, 28, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .voyant-rouge { animation: none; }
}

/* Le bandeau d'avancement : le taux, la barre, et le décompte des restes. */
.avancement {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.avancement-taux {
  font-size: 2.1rem; font-weight: 700; line-height: 1; color: var(--marine);
  font-variant-numeric: tabular-nums;
}
.avancement-barre {
  flex: 1; min-width: 180px; height: 10px; border-radius: 5px;
  background: var(--bordure); overflow: hidden;
}
.avancement-barre > span {
  display: block; height: 100%; border-radius: 5px; background: var(--framboise);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.avancement-barre.est-vert > span { background: var(--succes); }
.avancement-barre.est-rouge > span { background: var(--erreur); }
.avancement-detail { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.86rem; }
.avancement-detail b { font-variant-numeric: tabular-nums; }

/* Une ligne de la liste de contrôle. Le détail se déplie : la liste doit
   pouvoir se parcourir d'un trait, et s'ouvrir seulement quand on traite. */
.piece, .ligne { border-bottom: 1px solid var(--bordure); }
.piece:last-child, .ligne:last-child { border-bottom: 0; }
.piece > summary, .ligne > summary {
  display: flex; align-items: center; gap: 10px; padding: 11px 4px;
  cursor: pointer; list-style: none;
}
.piece > summary::-webkit-details-marker, .ligne > summary::-webkit-details-marker { display: none; }
.piece > summary:hover, .ligne > summary:hover { background: #f8fafc; }
.piece-libelle, .ligne-libelle { flex: 1; }
.piece-corps, .ligne-corps { padding: 4px 4px 16px 25px; }
.piece[open] > summary, .ligne[open] > summary { background: #f8fafc; }
.piece-sans-objet .piece-libelle { color: var(--texte-doux); text-decoration: line-through; }

/* Grille de risques : le poids se lit avant le libellé. */
.poids-eleve { background: #fee2e2; color: #b91c1c; }
.poids-moyen { background: #fef3c7; color: #92400e; }
.poids-faible { background: #e2e8f0; color: #475569; }

.orphelines { border-left: 3px solid #d97706; padding-left: 14px; }
.orphelines li { margin-bottom: 5px; }

/* --- Notes de frais --------------------------------------------------------
   La fiabilité de lecture se lit comme une note d'école : le chiffre compte
   moins que la couleur, qui dit s'il faut rouvrir la photo. */
.fiabilite { font-variant-numeric: tabular-nums; font-weight: 600; }
.badge-sur { background: #dcfce7; color: #166534; }
.badge-a_confirmer { background: #fef3c7; color: #92400e; }
.badge-douteux { background: #fee2e2; color: #b91c1c; }

/* Une lecture encore en file : rien n'est encore su de cette ligne. */
.en-lecture { color: var(--texte-doux); font-style: italic; }
.en-lecture::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px;
  border-radius: 50%; border: 2px solid var(--bordure); border-top-color: var(--framboise);
  animation: lecture-tourne 0.9s linear infinite; vertical-align: -1px;
}
@keyframes lecture-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .en-lecture::before { animation: none; } }

/* La vignette du justificatif, à côté de ce qu'on en a lu. */
.vignette {
  max-height: 260px; border: 1px solid var(--bordure); border-radius: 8px;
  background: #fff;
}
.alertes-lecture { margin: 8px 0 0; padding-left: 18px; color: #92400e; font-size: 0.86rem; }
.alertes-lecture li { margin-bottom: 3px; }

/* Marqueur discret en bout de libellé : le dossier porte un rapport. */
.icone-petite { width: 14px; height: 14px; opacity: 0.5; vertical-align: -2px; }

/* Le rapport d'audit affiché dans la fiche. Une présentation Gamma est en
   16/9 ; le rapport d'aspect fixe évite la bande blanche en bas sur grand
   écran et l'écrasement sur petit. */
.entete-carte { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.cadre-rapport {
  display: block; width: 100%; aspect-ratio: 16 / 9; min-height: 320px;
  border: 1px solid var(--bordure); border-radius: 10px; background: #fff;
}

/* La liste des pièces se coche. Une case à gauche, le libellé qui déplie les
   cas particuliers à droite : on coche sans déplier, on déplie sans cocher. */
.piece-ligne { display: flex; align-items: flex-start; gap: 12px; padding: 3px 4px; }
.piece-case { width: 17px; height: 17px; margin-top: 10px; flex: none; accent-color: var(--succes); cursor: pointer; }
.piece-case:disabled { cursor: not-allowed; opacity: 0.4; }
.piece-detail { flex: 1; min-width: 0; }
.piece-detail > summary {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  cursor: pointer; list-style: none; border-radius: 6px;
}
.piece-detail > summary::-webkit-details-marker { display: none; }
.piece-detail > summary::after {
  content: "⌄"; color: var(--texte-doux); font-size: 1rem; line-height: 1;
  transition: transform 0.15s ease; flex: none;
}
.piece-detail[open] > summary::after { transform: rotate(180deg); }
.piece-detail > summary:hover { background: #f8fafc; }
.piece-detail .piece-libelle { flex: 1; }

/* La barre d'enregistrement suit le défilement : la liste est longue, et le
   bouton ne doit pas se chercher en bas de page après vingt cases cochées. */
.barre-enregistrer {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--carte); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 18px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.07);
}

/* Le dépôt de l'avis de contrôle : le geste principal du volet, mis en avant
   par rapport à la saisie du texte qui n'est plus qu'un recours. */
.depot-courrier {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  background: #f8fafc; border: 1px dashed var(--bordure);
  border-radius: 10px; padding: 14px 16px;
}
.depot-courrier input[type="file"] { max-width: 100%; }

/* --- Menu repliable sur téléphone ------------------------------------------
   Déployé, le menu occupait 536 px avant le moindre contenu — un tiers de la
   hauteur de défilement, sur chaque page. Il se replie donc derrière un bouton
   sous 900 px.

   La bascule est une case à cocher masquée, et non un `<details>` : le
   navigateur masque le contenu d'un `<details>` fermé par `content-visibility`,
   qu'un `display: block` ne parvient pas à annuler. La barre latérale se
   serait affichée vide sur écran large — vérifié à l'œil, la mesure par script
   ne le voyait pas, les éléments ayant une géométrie sans être peints. Ici,
   c'est la feuille de style qui décide dans les deux sens. */
.bascule-menu { position: absolute; width: 1px; height: 1px; opacity: 0; }
.menu-bouton {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 13px 18px; color: #fff; font-weight: 600; font-size: 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  user-select: none;
}
.menu-bouton svg { width: 20px; height: 20px; flex: none; }
.menu-bouton .pastille { margin-left: auto; }
.bascule-menu:checked ~ .menu-repliable > .menu-bouton { background: rgba(255, 255, 255, 0.06); }
/* Le repère de focus se pose sur le bouton, la case étant invisible. */
.bascule-menu:focus-visible ~ .menu-repliable > .menu-bouton {
  outline: 2px solid var(--framboise-claire); outline-offset: -2px;
}

/* Les deux enveloppes du menu repliable s'intercalent entre la colonne et le
   nav : elles doivent transmettre la contrainte de hauteur (flex en colonne,
   min-height: 0), sinon le nav s'étire à la hauteur de son contenu, déborde
   de la colonne bleue et le pied de menu disparaît — vu en production avec
   plusieurs sections dépliées. */
.menu-repliable, .menu-panneau { display: flex; flex-direction: column; flex: 1; min-height: 0; }

@media (min-width: 901px) {
  /* Écran large : le menu est toujours là, le bouton n'a pas lieu d'être. */
  .menu-bouton { display: none; }
}

@media (max-width: 900px) {
  .menu-panneau { display: none; border-top: 1px solid rgba(255, 255, 255, 0.12); }
  .bascule-menu:checked ~ .menu-repliable > .menu-panneau { display: flex; }
  /* Le logo devient une barre de titre ; la page commence juste après. */
  .menu .logo { padding: 12px 18px; }
  main { padding: 16px 14px 48px; }
  /* Un tableau dense ne se comprime plus indéfiniment : il défile. */
  .tableau { display: block; overflow-x: auto; white-space: nowrap; }
  .tableau td, .tableau th { white-space: normal; }
}

/* Onglet de dossier sans contenu : pâli et suffixé d'une mention. Il reste
   cliquable — c'est souvent là qu'on va créer la première ligne — mais l'œil
   sait d'avance qu'il n'y trouvera rien. */
.onglets-dossier a.onglet-vide { opacity: .55; }
.onglets-dossier a.onglet-vide:hover { opacity: 1; }
.onglet-marque {
  margin-left: 6px;
  font-size: .74em;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .75;
}

/* Intitulé d'établissement au fil de la liste des salariés : une ligne de
   rupture, assez marquée pour se voir en balayant la colonne des noms, assez
   discrète pour ne pas passer pour un second en-tête de tableau. */
.tableau tr.ligne-groupe th {
  background: var(--fond-doux, #f3f4f6);
  border-top: 2px solid var(--bordure, #e5e7eb);
  font-weight: 600;
  padding-top: 12px;
}
.tableau tr.ligne-groupe:first-child th { border-top: 0; }

/* --- Espace Gestion : chiffres de tableau de bord --- */
.cartes-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0 20px; }
.carte-chiffre { background: #fff; border: 1px solid var(--bordure, #e2e8f0); border-radius: 12px; padding: 14px 16px; }
.carte-chiffre strong { display: block; font-size: 1.7rem; font-family: "Designosaur", -apple-system, sans-serif; font-weight: 400; color: var(--marine); }
.carte-chiffre span { color: var(--texte-doux); font-size: 0.85rem; }
.carte-chiffre.chiffre-alerte strong { color: #b91c1c; }
.montant { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.negatif { color: #b91c1c; }
.positif { color: #15803d; }
.tableau td.montant, .tableau th.montant { text-align: right; }
.grille-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grille-deux { grid-template-columns: 1fr; } }
.a-confirmer { background: #fff7ed; border-left: 3px solid #f59e0b; padding: 8px 12px; border-radius: 6px; }


/* ---------- Banque et rapprochement ---------- */
.rapprochement-grille { align-items: start; }
.rapprochement-choix { border-left: 4px solid var(--marine, #003366); }
.rapprochement-exact td { background: #f0fdf4; }
.ligne-choisie td { background: #fef9c3; }
.etat-rapprochement th { text-align: left; font-weight: 500; }
.etat-rapprochement td strong { font-size: 1.05rem; }
.onglets .onglet-actif { font-weight: 600; }
@media print {
  .menu, .bandeau-dossier, .sans-impression, .flash { display: none !important; }
  main { padding: 0; }
  .carte { break-inside: avoid; border: none; box-shadow: none; }
}

/* ---------- Pièces manquantes et relances ---------- */
.demande-ancienne td:first-child { border-left: 3px solid #f59e0b; }
.demande-tres-ancienne td:first-child { border-left: 3px solid #b91c1c; }
.apercu-message { white-space: pre-wrap; font-family: inherit; background: #f8fafc; border: 1px solid var(--bordure, #e2e8f0); border-radius: 8px; padding: 12px 14px; font-size: 0.9rem; }

/* ---------- Documents ---------- */
.documents-filtres { margin-bottom: 12px; }

/* ---------- Analyse et transmissions ---------- */
.source-indicateur { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: #e2e8f0; color: #475569; margin-left: 6px; vertical-align: middle; }
.source-indicateur.source-ebp { background: #dbeafe; color: #1d4ed8; }
.source-indicateur.source-portail { background: #e0e7ff; color: #4338ca; }
.source-indicateur.source-releves { background: #fef3c7; color: #92400e; }
.transmission-section { margin-top: 18px; }
.transmission-section h3 { font-size: 0.95rem; margin: 0 0 6px; color: var(--marine, #003366); }

/* --- Échéances : retard, proximité, formulaires repliés dans la ligne --- */
.tableau tr.echeance-retard td:first-child { border-left: 3px solid #b91c1c; }
.tableau tr.echeance-proche td:first-child { border-left: 3px solid #f59e0b; }
.tableau tr.echeance-close td { color: var(--texte-doux); }
.details-action { display: inline-block; vertical-align: top; margin-right: 4px; }
.details-action > summary { list-style: none; cursor: pointer; }
.details-action > summary::-webkit-details-marker { display: none; }
.details-formulaire { position: absolute; z-index: 5; background: #fff; border: 1px solid var(--bordure, #e2e8f0); border-radius: 8px; padding: 10px 12px; margin-top: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); min-width: 320px; }
.details-formulaire > div { min-width: 110px; }
.tableau tr.ligne-active { background: #e9f0f7; }
.agenda-jour { margin-bottom: 10px; }

/* --- TVA / IS / CVAE : tableaux de calcul et récapitulatif imprimable --- */
.tableau-calcul .formule { font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; }
.tableau tr.ligne-total th, .tableau tr.ligne-total td { font-weight: 700; border-top: 2px solid var(--bordure, #e2e8f0); }
.tableau tr.ligne-note td { font-style: italic; background: #fafafa; }
.page-imprimable { background: #fff; color: #111; font-family: -apple-system, "Segoe UI", sans-serif; }
.recapitulatif { max-width: 780px; margin: 30px auto; padding: 0 20px; }
.recapitulatif h1 { font-size: 1.4rem; margin-bottom: 6px; }
.recapitulatif h2 { font-size: 1.05rem; margin-top: 22px; }
@media print { .sans-impression { display: none; } .recapitulatif { margin: 0; } }

/* ---------- Écritures, inventaire, immobilisations, comptes courants ---------- */
.saisie-lignes input { padding: 5px 8px; font-size: 0.88rem; }
.saisie-lignes input.montant { text-align: right; }
.barre-actions-ecritures { margin-top: 12px; align-items: center; flex-wrap: wrap; }
.actions-inventaire { white-space: nowrap; }
.actions-inventaire form { display: inline-block; margin-right: 4px; }
.actions-inventaire .formulaire-ligne input[type="date"] { width: auto; padding: 4px 6px; font-size: 0.8rem; }
.marche-a-suivre { white-space: pre-wrap; font-family: inherit; font-size: 0.88rem; color: var(--texte); margin: 10px 0 0; }
details.carte > summary { cursor: pointer; }
.tableau tr.texte-doux td { color: var(--texte-doux); }

/* --- Espace Gestion : commande à copier (page d'installation de l'agent) --- */
.commande { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 10px;
            overflow-x: auto; font-size: 0.8rem; line-height: 1.6; margin: 0; }
.commande code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
