/* Interface du cabinet — même monde que la page publique de signature : fond gris clair,
   surfaces blanches à filet fin, encre ardoise, accent bleu réservé aux actions, à la sélection et à
   l'étape active. Organisation : barre, chemin de campagne en quatre étapes, listes, fiche en page. */
:root {
  --fond: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #eceff4;
  --surface-3: #e3e7ee;
  --trait: #e2e8f0;
  --trait-fort: #c9d1dc;
  --encre: #0f172a;
  --encre-2: #334155;
  --gris: #56637a;
  --accent: #3d5afe;
  --accent-fonce: #2a44e0;
  --accent-doux: #eaeeff;
  --ambre: #8a3b0c;
  --ambre-fond: #fdf1d3;
  --bleu: #1e46c7;
  --bleu-fond: #dde7ff;
  --vert: #05603f;
  --vert-fond: #d6f5e6;
  --rouge: #a61b1b;
  --rouge-fond: #fde3e3;
  --rayon: 8px;
  --rayon-petit: 6px;
  --ombre: 0 1px 2px rgb(15 23 42 / 0.05), 0 1px 3px rgb(15 23 42 / 0.07);
  --ombre-haute: 0 12px 32px rgb(15 23 42 / 0.16), 0 2px 8px rgb(15 23 42 / 0.08);
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t-1: 0.75rem;
  --t-2: 0.8125rem;
  --t-3: 0.875rem;
  --t-4: 1rem;
  --t-5: 1.125rem;
  --t-6: 1.3125rem;
  --duree: 180ms;
  --courbe: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-color: var(--trait-fort) transparent; scrollbar-width: thin; }
body { margin: 0; background: var(--fond); color: var(--encre); font: var(--t-3)/1.5 var(--police); -webkit-font-smoothing: antialiased; caret-color: var(--accent); }
::selection { background: var(--accent-doux); color: var(--encre); }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chargement { padding: 48px; text-align: center; color: var(--gris); }
.icone { width: 18px; height: 18px; flex: none; }
.chiffres { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- structure */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.evitement { position: absolute; left: 12px; top: -60px; z-index: 60; padding: 10px 14px; border-radius: var(--rayon-petit); background: var(--encre); color: #fff; font-weight: 600; text-decoration: none; }
.evitement:focus { top: 10px; }
.barre { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px 20px; min-height: 60px; padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--trait); }
.marque { display: inline-flex; align-items: baseline; gap: 10px; color: var(--encre); text-decoration: none; white-space: nowrap; border-radius: var(--rayon-petit); }
.marque strong { font-size: var(--t-5); font-weight: 650; letter-spacing: -0.01em; }
.recherche { position: relative; flex: 0 1 320px; min-width: 180px; }
.recherche .icone { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--gris); pointer-events: none; }
.recherche input { padding-left: 34px; min-height: 40px; }
.nav-principale { margin-left: auto; }
.nav-principale ul { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-principale a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border-radius: var(--rayon-petit); color: var(--encre-2); font-weight: 550; text-decoration: none; white-space: nowrap; transition: background-color var(--duree) var(--courbe), color var(--duree) var(--courbe); }
.nav-principale a:hover { background: var(--surface-2); color: var(--encre); }
.nav-principale a[aria-current="page"] { color: var(--encre); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.contenu { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 24px 72px; }
.contenu:focus { outline: none; }
[id="titre-vue"]:focus { outline: none; }
[id="titre-vue"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--rayon-petit); }

/* ---------------------------------------------------------------- chemin de campagne */
.chemin ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.etape + .etape { border-left: 1px solid var(--trait); }
.etape a { display: flex; align-items: center; gap: 12px; height: 100%; min-height: 76px; padding: 14px 18px; color: inherit; text-decoration: none; transition: background-color var(--duree) var(--courbe); }
.etape a:hover { background: var(--fond); }
.etape a:focus-visible { outline-offset: -3px; }
.etape.active a { box-shadow: inset 0 -3px 0 var(--accent); }
.etape-numero { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--trait-fort); background: var(--surface); color: var(--encre-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.etape-numero .icone { width: 17px; height: 17px; }
.etape.faite .etape-numero { border-color: transparent; background: var(--vert-fond); color: var(--vert); }
.etape.active .etape-numero { border-color: var(--accent); background: var(--accent); color: #fff; }
.etape-texte { display: flex; flex-direction: column; min-width: 0; }
.etape-titre { font-size: var(--t-4); font-weight: 650; }
.etape-compte { font-size: var(--t-2); color: var(--gris); }
.etape.active .etape-compte { color: var(--encre-2); }
.etape-compte { transition: color var(--duree) var(--courbe); }
.etape.vient-de-changer .etape-compte { color: var(--encre); font-weight: 650; }

.page-entete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin: 28px 0 16px; }
.vue-tous .page-entete, .vue-historique .page-entete, .vue-parametres .page-entete { margin-top: 4px; }
.page-entete h1 { font-size: var(--t-6); font-weight: 650; letter-spacing: -0.015em; }
.page-entete p { margin-top: 3px; color: var(--encre-2); }
.page-entete p.aide { color: var(--gris); font-size: var(--t-2); }
.page-entete .outils { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
select.filtre { width: auto; min-width: 190px; min-height: 40px; }
.page-entete .outils .bouton { min-height: 40px; }
.outils-classeur { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.outils-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.outils > * + .outils-classeur, .outils > * + .outils-actions { margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--trait-fort); }
.outils-libelle { font-size: var(--t-2); font-weight: 550; color: var(--encre-2); }
select.choix-classeur { width: auto; min-width: 92px; min-height: 40px; }

/* ---------------------------------------------------------------- listes */
.liste-cadre { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow-x: auto; }
.liste-cadre.squelette { min-height: 240px; background: var(--surface-2); border-color: transparent; }
.liste { width: 100%; border-collapse: collapse; font-size: var(--t-3); }
.liste th, .liste td { padding: 11px 14px; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: middle; font-weight: 400; }
.liste thead th { position: sticky; top: 0; font-size: var(--t-2); font-weight: 600; color: var(--gris); background: var(--fond); white-space: nowrap; }
.liste tbody tr:last-child > * { border-bottom: 0; }
.liste tbody tr { transition: background-color var(--duree) var(--courbe); }
.liste tbody tr:hover { background: var(--fond); }
.liste tbody tr.choisie { background: var(--accent-doux); }
.liste tbody tr.choisie .pastille:not(.p-ambre):not(.p-bleu):not(.p-vert):not(.p-rouge) { background: var(--surface); box-shadow: inset 0 0 0 1px var(--trait-fort); }
.liste tr.groupe th { padding: 8px 14px; font-size: var(--t-2); font-weight: 650; color: var(--encre-2); background: var(--fond); }
.liste tr.groupe:hover { background: none; }
.liste tbody + tbody tr.groupe th { border-top: 1px solid var(--trait-fort); }
.liste .col-choix { width: 48px; padding: 0 0 0 6px; }
.case { display: grid; place-items: center; width: 40px; height: 40px; cursor: pointer; border-radius: var(--rayon-petit); }
.case:hover { background: var(--surface-2); }
.case input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.societe-nom { font-weight: 650; color: var(--encre); text-decoration: none; }
.societe-nom:hover { text-decoration: underline; }
.societe-sous { display: block; margin-top: 1px; font-size: var(--t-1); font-weight: 400; color: var(--gris); }
.situation { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.situation-detail { font-size: var(--t-2); color: var(--encre-2); }
.evenement { font-size: var(--t-2); color: var(--gris); white-space: nowrap; }
.liste .col-action { text-align: right; white-space: nowrap; }
.liste .col-date { width: 1%; white-space: nowrap; color: var(--encre-2); }
.liste .col-etape { white-space: nowrap; color: var(--encre-2); }
.faits { margin-top: 18px; }
.faits summary { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; font-weight: 600; color: var(--encre-2); cursor: pointer; border-radius: var(--rayon-petit); }
.faits[open] summary { margin-bottom: 8px; }
.suite-liste { display: flex; justify-content: center; margin-top: 14px; }

.vide { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); }
.vide > .icone { width: 26px; height: 26px; margin-bottom: 4px; color: var(--vert); }
.vide h2 { font-size: var(--t-5); font-weight: 650; }
.vide p { max-width: 56ch; color: var(--encre-2); }
.vide .bouton { margin-top: 8px; }

.barre-actions { position: sticky; bottom: 16px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; padding: 10px 12px 10px 18px; background: var(--encre); color: #fff; border-radius: var(--rayon); box-shadow: var(--ombre-haute); animation: entre var(--duree) var(--courbe); }
.barre-actions-compte { font-size: var(--t-3); }
.barre-actions-compte strong { font-size: var(--t-4); }
.barre-actions .espaceur { flex: 1; }
.barre-actions .bouton { background: transparent; border-color: rgb(255 255 255 / 0.4); color: #fff; }
.barre-actions .bouton:hover { background: rgb(255 255 255 / 0.12); }
.barre-actions .bouton.discret { border-color: transparent; color: rgb(255 255 255 / 0.85); }
.barre-actions .bouton.principal { background: var(--accent); border-color: var(--accent); }
.barre-actions .bouton.principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.barre-actions :focus-visible { outline-color: #fff; }

.progression { margin-bottom: 16px; padding: 14px 18px 16px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); }
.progression-tete { display: flex; align-items: baseline; gap: 12px; }
.progression-tete h2 { font-size: var(--t-4); font-weight: 650; }
.progression-tete span { margin-left: auto; color: var(--encre-2); }
.progression progress { display: block; width: 100%; height: 6px; margin-top: 10px; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; appearance: none; }
.progression progress::-webkit-progress-bar { background: var(--surface-2); }
.progression progress::-webkit-progress-value { background: var(--accent); }
.progression progress::-moz-progress-bar { background: var(--accent); }
.progression-etat { margin-top: 8px; font-size: var(--t-2); color: var(--encre-2); }
.echecs { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.echecs li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: var(--rayon-petit); background: var(--rouge-fond); color: var(--rouge); font-size: var(--t-2); }
.echecs .icone { width: 16px; height: 16px; margin-top: 1px; }
.progression-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.blocs { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.bloc { padding: 18px 20px 20px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); }
.bloc.squelette { min-height: 160px; background: var(--surface-2); border-color: transparent; }
.bloc h2 { font-size: var(--t-4); font-weight: 650; }
.bloc .aide { margin-top: 3px; font-size: var(--t-2); color: var(--gris); }
.bloc .encart, .bloc .valeur { margin-top: 12px; }
.bloc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bloc-contenu { margin-top: 12px; }
.bloc-contenu .message-erreur:empty { display: none; }
.valeur { display: flex; align-items: center; gap: 8px; color: var(--encre-2); overflow-wrap: anywhere; }

.pastille { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: var(--t-1); font-weight: 600; line-height: 1.15; padding: 4px 7px; border-radius: 999px; background: var(--surface-2); color: var(--encre-2); }
.pastille .icone { width: 13px; height: 13px; }
.p-ambre { background: var(--ambre-fond); color: var(--ambre); }
.p-bleu { background: var(--bleu-fond); color: var(--bleu); }
.p-vert { background: var(--vert-fond); color: var(--vert); }
.p-rouge { background: var(--rouge-fond); color: var(--rouge); }

/* ---------------------------------------------------------------- données : tableur et classeur Excel */
.tableur-aide { max-width: 96ch; margin: 0 0 10px; font-size: var(--t-2); color: var(--gris); }
.tableur-cadre { max-height: max(420px, calc(100dvh - 330px)); overflow: auto; overscroll-behavior: contain; scroll-padding: 40px 0 0 236px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); }
/* barre des cases refusées ouverte : le cadre raccourcit pour ne pas cacher ses dernières lignes ni sa barre de défilement */
.zone-tableur:has(> .tableur-erreurs:not([hidden])) .tableur-cadre { max-height: max(320px, calc(100dvh - 450px)); }
.tableur-cadre.squelette { min-height: 320px; background: var(--surface-2); border-color: transparent; }
.tableur-vide { padding: 36px 20px; text-align: center; color: var(--encre-2); }
.tableur { min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-3); }
.tableur th, .tableur td { height: 40px; padding: 0 12px; border-bottom: 1px solid var(--trait); border-right: 1px solid var(--trait); text-align: left; vertical-align: middle; font-weight: 400; white-space: nowrap; background-clip: padding-box; }
.tableur tr > :last-child { border-right: 0; }
.tableur tbody:last-child tr:last-child > * { border-bottom: 0; }
.tableur thead th { position: sticky; top: 0; z-index: 2; height: 38px; font-size: var(--t-2); font-weight: 600; color: var(--gris); background: var(--fond); border-bottom-color: var(--trait-fort); }
.tableur .col-societe { position: sticky; left: 0; z-index: 1; min-width: 224px; max-width: 280px; padding-block: 5px; white-space: normal; background: var(--surface); box-shadow: inset -1px 0 0 var(--trait-fort); border-right-color: transparent; }
.tableur thead .col-societe { z-index: 3; background: var(--fond); }
.tableur .col-societe .societe-nom { display: inline-block; line-height: 1.3; border-radius: var(--rayon-petit); }
.tableur .col-situation { min-width: 124px; white-space: normal; }
.tableur .nombre { text-align: right; font-variant-numeric: tabular-nums; }
.tableur td.cellule { min-width: 112px; color: var(--encre); cursor: cell; }
.tableur td.large { min-width: 200px; }
.cellule-texte { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.tableur tbody tr:hover > :not(.manque):not([aria-invalid="true"]) { background-color: var(--fond); }
.tableur td:focus, .tableur .col-societe a:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.tableur .col-societe a:focus { outline-offset: 1px; }
.tableur td.manque { position: relative; background: var(--ambre-fond); }
.tableur td.manque::before { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 8px 8px 0; border-color: transparent var(--ambre) transparent transparent; }
.tableur td.manque .cellule-texte:empty::after { content: "À compléter" / ""; font-size: var(--t-2); color: var(--ambre); }
.tableur td[aria-invalid="true"] { color: var(--rouge); background: var(--rouge-fond); box-shadow: inset 0 0 0 1px var(--rouge); }
.tableur td[aria-busy="true"] .cellule-texte { opacity: 0.55; }
.tableur td.en-edition { padding: 0; }
.cellule-saisie { display: block; width: 100%; min-width: 100%; height: 39px; min-height: 0; padding: 0 11px; border: 0; border-radius: 0; background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.cellule-saisie:focus-visible { outline: none; border-radius: 0; }
.cellule-saisie[aria-invalid="true"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--rouge); }
.tableur td.nombre .cellule-saisie { text-align: right; font-variant-numeric: tabular-nums; }
.tableur tr.groupe th { height: 32px; font-size: var(--t-2); font-weight: 650; color: var(--encre-2); background: var(--fond); border-right: 0; }
.tableur tr.groupe th span { position: sticky; left: 12px; }
.tableur tbody + tbody tr.groupe th { border-top: 1px solid var(--trait-fort); }
.tableur-erreurs { position: sticky; bottom: 16px; z-index: 20; display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 14px; background: var(--rouge-fond); color: var(--rouge); border-radius: var(--rayon); box-shadow: var(--ombre-haute); font-size: var(--t-2); animation: entre var(--duree) var(--courbe); }
.tableur-erreurs > .icone { margin-top: 2px; }
.tableur-erreurs-texte { min-width: 0; }
.tableur-erreurs-titre { font-weight: 650; }
.tableur-erreurs ul { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0; padding: 0; list-style: none; }
.lien-erreur { min-height: 28px; padding: 2px 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; border-radius: var(--rayon-petit); }
.lien-erreur:hover { text-decoration-thickness: 2px; }
.lien-erreur:focus-visible { outline-color: var(--rouge); }
.tableur-erreurs-aide { margin-top: 2px; color: var(--encre-2); }

.import { margin-bottom: 16px; padding: 16px 18px 18px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); animation: entre var(--duree) var(--courbe); }
.import-tete { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.import-tete > div { flex: 1; min-width: 0; }
.import-tete h2 { font-size: var(--t-5); font-weight: 650; }
.import-fichier { margin-top: 2px; font-size: var(--t-2); color: var(--gris); overflow-wrap: anywhere; }
.import-nombres { margin-top: 6px; color: var(--encre-2); font-variant-numeric: tabular-nums; }
.import > .encart { margin-bottom: 12px; }
.import-messages { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 0; padding-left: 18px; }
.import-messages strong { font-weight: 650; }
.import-operations { min-width: 0; margin: 0; padding: 0; border: 0; }
.import-operations legend { padding: 0 0 4px; font-weight: 650; color: var(--encre-2); }
.import-toutes, .import-choix { display: inline-flex; align-items: center; min-height: 40px; padding-right: 10px; border-radius: var(--rayon-petit); cursor: pointer; }
.import-toutes { margin-bottom: 4px; font-weight: 550; color: var(--encre-2); }
.import-toutes input, .import-choix input { width: 18px; height: 18px; min-height: 0; margin: 11px; padding: 0; accent-color: var(--accent); cursor: pointer; }
.import-toutes:hover, .import-choix:hover { background: var(--surface-2); }
.import-operations ul { margin: 0; padding: 0; list-style: none; border: 1px solid var(--trait); border-radius: var(--rayon); }
.import-operation + .import-operation { border-top: 1px solid var(--trait); }
.import-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 12px 0 2px; }
.import-details { padding: 0 12px 10px 42px; }
.import-details summary { display: inline-flex; align-items: center; min-height: 32px; font-size: var(--t-2); font-weight: 550; color: var(--accent); cursor: pointer; border-radius: var(--rayon-petit); }
.import-table { margin-top: 4px; overflow-x: auto; }
.import-table table { min-width: min(100%, 560px); border-collapse: collapse; font-size: var(--t-2); }
.import-table th, .import-table td { padding: 5px 18px 5px 0; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: top; font-weight: 400; }
.import-table thead th { font-weight: 600; color: var(--gris); }
.import-table tbody th { color: var(--encre-2); white-space: nowrap; }
.import-table td.avant { color: var(--gris); }
.import-table td.apres { color: var(--encre); font-weight: 600; }
.import-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------------------------------------------------------------- fiche d'une société (page) */
.page-fiche { max-width: 1040px; margin: 0 auto; }
.fil ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 10px; padding: 0; list-style: none; font-size: var(--t-2); color: var(--gris); }
.fil li + li::before { content: "/"; margin-right: 8px; color: var(--trait-fort); }
.fil a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--encre-2); font-weight: 550; text-decoration: none; border-radius: var(--rayon-petit); }
.fil a:hover { color: var(--encre); text-decoration: underline; }
.fil .icone { width: 16px; height: 16px; }
.fiche-entete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; padding-bottom: 14px; }
.fiche-identite { flex: 1 1 420px; min-width: 0; }
.fiche-outils { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fiche-outils:empty, .fiche-exercice:empty { display: none; }
.fiche-outils .bouton { min-height: 40px; }
.exercices { display: flex; align-items: center; gap: 8px; }
.exercices ul { display: flex; gap: 2px; margin: 0; padding: 2px; list-style: none; background: var(--surface-2); border-radius: var(--rayon); }
.exercices a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: var(--rayon-petit); color: var(--encre-2); font-weight: 550; font-variant-numeric: tabular-nums; text-decoration: none; }
.exercices a:hover { color: var(--encre); background: var(--surface-3); }
.exercices a[aria-current="page"] { color: var(--encre); background: var(--surface); box-shadow: inset 0 0 0 1px var(--trait-fort); }
.exercice-clos { align-items: center; margin-bottom: 14px; }
.exercice-clos > div:first-of-type { flex: 1 1 320px; }
.exercice-clos-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fiche-titre { font-size: var(--t-6); font-weight: 650; letter-spacing: -0.015em; }
.fiche-sous { margin-top: 5px; font-size: var(--t-3); color: var(--encre-2); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--trait); overflow-x: auto; }
.onglet { appearance: none; border: 0; background: none; font: inherit; font-size: var(--t-3); color: var(--encre-2); min-height: 44px; padding: 0 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.onglet:hover { color: var(--encre); }
.onglet[aria-selected="true"] { color: var(--encre); font-weight: 600; border-bottom-color: var(--accent); }
.onglet:focus-visible { outline-offset: -2px; }
.fiche-corps { padding: 22px 0 36px; }
.fiche-corps:focus-visible { outline-offset: 6px; }
.fiche-pied { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 0; background: var(--fond); border-top: 1px solid var(--trait); box-shadow: 0 0 0 100vmax var(--fond); clip-path: inset(0 -100vmax); }
.fiche-pied:empty { display: none; }
.fiche-pied .etat-sauvegarde { font-size: var(--t-2); color: var(--gris); margin-right: auto; }
.fiche-pied .etat-sauvegarde.modifie { color: var(--ambre); font-weight: 600; }

.section + .section { margin-top: 26px; }
.section-tete { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 2px; margin-bottom: 10px; }
.section-tete h3 { font-size: var(--t-4); font-weight: 650; }
.section-tete p { font-size: var(--t-2); color: var(--gris); }
.section-tete .bouton { margin-left: auto; }
.aide-section { margin: -2px 0 12px; max-width: 72ch; font-size: var(--t-2); color: var(--gris); }
/* sections repliables de la fiche : titre + bouton (aria-expanded), chevron du jeu d'icônes */
.section-bascule { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-left: -4px; padding: 0 8px 0 4px; border: 0; border-radius: var(--rayon-petit); background: none; font: inherit; font-size: var(--t-4); font-weight: 650; color: var(--encre); cursor: pointer; }
.section-bascule .icone { color: var(--gris); transition: transform var(--duree) var(--courbe); }
.section-bascule[aria-expanded="true"] .icone { transform: rotate(90deg); }
.section-bascule:hover { color: var(--accent); }
.section-bascule:hover .icone { color: var(--accent); }
.champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.champs.trois { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.champ.large { grid-column: 1 / -1; }
.champ > label, .champ > .libelle { font-size: var(--t-2); font-weight: 550; color: var(--encre-2); }
.champ .aide { font-size: var(--t-1); color: var(--gris); }
input, select, textarea { font: inherit; font-size: var(--t-3); color: var(--encre); background: var(--surface); border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit); padding: 6px 10px; min-height: 36px; width: 100%; transition: border-color var(--duree) var(--courbe); }
textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: #aeb8c6; }
/* exercice clos : champs lisibles, visiblement non modifiables */
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); border-color: var(--trait); color: var(--encre-2); -webkit-text-fill-color: var(--encre-2); opacity: 1; cursor: default; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); border-radius: var(--rayon-petit); }
input::placeholder, textarea::placeholder { color: var(--gris); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--rouge); background: #fffafa; }
input.montant { text-align: right; font-variant-numeric: tabular-nums; }

.lignes { display: flex; flex-direction: column; gap: 8px; }
.ligne-associe { display: grid; grid-template-columns: 118px minmax(0, 1.4fr) 92px minmax(0, 1.3fr) 36px; gap: 8px; align-items: end; }
.ligne-associe .champ > label { font-size: var(--t-1); }
.ligne-dividende { display: grid; grid-template-columns: 80px repeat(2, minmax(0, 1fr)); gap: 8px; align-items: center; }
.ligne-dividende .annee { font-weight: 600; font-variant-numeric: tabular-nums; }

.calcul { margin-top: 14px; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--fond); padding: 12px 14px; }
.calcul-tete { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--t-2); color: var(--gris); }
.calcul-tete strong { color: var(--encre); font-size: var(--t-3); }
.affectation { width: 100%; border-collapse: collapse; font-size: var(--t-3); font-variant-numeric: tabular-nums; }
.affectation th, .affectation td { padding: 5px 0; border-bottom: 1px solid var(--trait); text-align: left; font-weight: 400; }
.affectation td { text-align: right; white-space: nowrap; }
.affectation .groupe th { padding-top: 10px; font-weight: 650; color: var(--encre-2); border-bottom-color: var(--trait-fort); }
.affectation .total th, .affectation .total td { font-weight: 650; }
.affectation .negatif { color: var(--rouge); }
.vigilance { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vigilance li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-2); color: var(--ambre); background: var(--ambre-fond); border-radius: var(--rayon-petit); padding: 7px 10px; }
.vigilance li .icone { width: 16px; height: 16px; margin-top: 1px; }
.erreurs li { color: var(--rouge); background: var(--rouge-fond); }
.colonne-vide { padding: 14px 12px; border: 1px dashed var(--trait-fort); border-radius: var(--rayon); font-size: var(--t-2); color: var(--gris); text-align: center; }
.signataires { list-style: none; margin: 8px 0 0; padding: 0; font-size: var(--t-2); color: var(--encre-2); }
.signataires li { padding: 3px 0; }

/* ---------------------------------------------------------------- documents et signature */
.liste-docs { display: flex; flex-direction: column; border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.doc { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; }
.doc + .doc { border-top: 1px solid var(--trait); }
.doc .icone { color: var(--gris); }
.doc-nom { font-weight: 600; font-size: var(--t-3); overflow-wrap: anywhere; }
.doc-fichier { font-size: var(--t-1); color: var(--gris); overflow-wrap: anywhere; }
.doc-actions { display: flex; gap: 6px; align-items: center; }
.apercu { margin-top: 14px; border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; background: var(--surface-2); }
.apercu-tete { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--trait); background: var(--surface); font-size: var(--t-2); font-weight: 600; }
.apercu-tete .pousse { margin-left: auto; }
.apercu iframe { display: block; width: 100%; height: min(72vh, 900px); border: 0; background: var(--surface-2); }

.encart { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--rayon); font-size: var(--t-2); background: var(--surface-2); color: var(--encre-2); }
.encart + .encart, .encart + .section, .section + .encart { margin-top: 12px; }
.encart .icone { margin-top: 1px; }
.encart.alerte { background: var(--ambre-fond); color: var(--ambre); }
.encart.danger { background: var(--rouge-fond); color: var(--rouge); }
.encart.succes { background: var(--vert-fond); color: var(--vert); }
.encart p + p { margin-top: 4px; }

.personnes { display: flex; flex-direction: column; gap: 10px; }
.personne { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 12px; }
.personne-tete { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.personne-nom { font-weight: 650; }
.personne-qualite { font-size: var(--t-2); color: var(--gris); }
.personne-tete .pastille { margin-left: auto; }
.personne-docs { margin-top: 4px; font-size: var(--t-2); color: var(--encre-2); }
.personne-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: end; }
.personne-actions .champ { flex: 1 1 220px; }
.personne-meta { margin-top: 6px; font-size: var(--t-1); color: var(--gris); }

/* ---------------------------------------------------------------- boutons */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: var(--t-3); font-weight: 550; line-height: 1.2; padding: 7px 12px; min-height: 34px; border-radius: var(--rayon-petit); border: 1px solid var(--trait-fort); background: var(--surface); color: var(--encre); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color var(--duree) var(--courbe), border-color var(--duree) var(--courbe), color var(--duree) var(--courbe); }
.bouton:hover { background: var(--surface-2); border-color: #aeb8c6; }
.bouton:active { background: var(--surface-3); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.bouton.danger { color: var(--rouge); border-color: #efbcbc; }
.bouton.danger:hover { background: var(--rouge-fond); }
.bouton.discret { background: transparent; border-color: transparent; color: var(--encre-2); }
.bouton.discret:hover { background: var(--surface-2); }
.bouton.icone-seule { padding: 6px; min-width: 34px; }
.bouton.large { width: 100%; min-height: 40px; }
.bouton:disabled, .bouton[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.bouton[aria-busy="true"] { cursor: progress; }
.bouton[aria-busy="true"]::after { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tourne 0.7s linear infinite; }
@keyframes tourne { to { rotate: 360deg; } }

/* ---------------------------------------------------------------- accès, dialogues, notifications */
.acces { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.acces-carte { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--trait); border-radius: 12px; padding: 28px 26px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 14px; }
.acces-carte h1 { font-size: var(--t-6); font-weight: 650; letter-spacing: -0.015em; }
.acces-carte .aide { font-size: var(--t-2); color: var(--gris); }
.message-erreur { font-size: var(--t-2); color: var(--rouge); min-height: 1.2em; }

.dialogue { border: 1px solid var(--trait); border-radius: 12px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--ombre-haute); color: var(--encre); }
.dialogue::backdrop { background: rgb(15 23 42 / 0.35); }
.dialogue form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.dialogue h2 { font-size: var(--t-5); font-weight: 650; }
.dialogue .aide { font-size: var(--t-3); color: var(--encre-2); }
.dialogue-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialogue-points { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 0; padding-left: 18px; font-size: var(--t-2); color: var(--encre-2); }

.notifications { position: fixed; left: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.notification { display: flex; gap: 10px; align-items: flex-start; background: var(--encre); color: #fff; border-radius: var(--rayon); padding: 10px 14px; box-shadow: var(--ombre-haute); font-size: var(--t-3); animation: entre var(--duree) var(--courbe); }
.notification.n-erreur { background: #7f1d1d; }
.notification.n-succes { background: #064e3b; }
.notification.sortante { opacity: 0; translate: 0 6px; transition: opacity 200ms, translate 200ms; }
@keyframes entre { from { opacity: 0; translate: 0 8px; } }

::view-transition-group(*) { animation-duration: var(--duree); animation-timing-function: var(--courbe); }

/* ---------------------------------------------------------------- e-mails : aperçu, suivi, réglages */
.dialogue.large { width: min(640px, calc(100vw - 32px)); }
.apercu-courriel { border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; background: var(--surface); }
.apercu-courriel-tete { margin: 0; padding: 8px 14px; background: var(--fond); border-bottom: 1px solid var(--trait); font-size: var(--t-2); }
.apercu-courriel-tete div { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 2px 0; }
.apercu-courriel-tete dt { color: var(--gris); }
.apercu-courriel-tete dd { margin: 0; color: var(--encre); font-weight: 550; overflow-wrap: anywhere; }
.apercu-courriel-texte { max-height: min(38vh, 320px); overflow: auto; padding: 12px 14px; color: var(--encre-2); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.apercu-courriel-texte:focus-visible { outline-offset: -2px; border-radius: 0 0 var(--rayon) var(--rayon); }
.personne-courriel { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: var(--t-2); color: var(--encre-2); }
.personne-courriel .icone { width: 16px; height: 16px; margin-top: 2px; color: var(--gris); }
.personne-courriel.echec, .personne-courriel.echec .icone { color: var(--rouge); }
.envois { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--t-2); color: var(--encre-2); }
.envois li { display: flex; gap: 8px; align-items: flex-start; }
.envois .icone { width: 16px; height: 16px; margin-top: 2px; color: var(--gris); }
.envois li.echec { padding: 7px 10px; border-radius: var(--rayon-petit); background: var(--rouge-fond); color: var(--rouge); }
.envois li.echec .icone { color: var(--rouge); }
.etat-messagerie { flex-wrap: wrap; margin-bottom: 14px; }
.etat-messagerie .modifie { font-size: var(--t-2); font-weight: 600; color: var(--ambre); }
.options { min-width: 0; margin: 0; padding: 0; border: 0; }
.options legend, .sous-reglages legend { padding: 0 0 6px; font-size: var(--t-2); font-weight: 650; color: var(--encre-2); }
/* légende posée sous le filet du groupe, pas dessus */
.sous-reglages > legend { float: left; width: 100%; padding: 0 0 10px; font-size: var(--t-4); color: var(--encre); }
.sous-reglages > legend + * { clear: both; }
.options-liste { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--trait-fort); border-radius: var(--rayon); cursor: pointer; transition: background-color var(--duree) var(--courbe), border-color var(--duree) var(--courbe); }
.option:hover { background: var(--fond); border-color: #aeb8c6; }
.option:has(input:checked) { background: var(--accent-doux); border-color: var(--accent); }
.option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.option input, .case-option input { flex: none; width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.option input:focus-visible { outline: none; }
.option-titre { display: block; font-weight: 600; color: var(--encre); }
.option-aide { display: block; margin-top: 2px; font-size: var(--t-1); color: var(--gris); }
.options + .aide { margin-top: 12px; }
.sous-reglages { min-width: 0; margin: 16px 0 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--trait); }
.sous-reglages-champs { margin-top: 16px; }
.aide-etapes { display: flex; flex-direction: column; gap: 3px; max-width: 72ch; margin: 0 0 12px; padding-left: 20px; font-size: var(--t-2); color: var(--encre-2); }
.case-option { display: flex; gap: 8px; align-items: center; min-height: 40px; font-weight: 550; color: var(--encre); cursor: pointer; }
.case-option input { margin: 0; }
.sous-reglages .champs + .aide { margin-top: 8px; }

/* ---------------------------------------------------------------- petits écrans */
@media (max-width: 1100px) {
  .barre { flex-wrap: wrap; padding: 8px 16px; }
  .recherche { order: 3; flex: 1 1 100%; }
  .nav-principale a { padding: 0 10px; }
  .contenu { padding: 20px 16px 72px; }
}
@media (max-width: 900px) {
  .chemin ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .etape:nth-child(3) { border-left: 0; }
  .etape:nth-child(n + 3) { border-top: 1px solid var(--trait); }
  .liste .col-secondaire { display: none; }
  .nav-principale { order: 4; flex: 1 1 100%; margin-left: 0; }
  .nav-principale ul { flex-wrap: wrap; }
  .barre > .bouton { margin-left: auto; }
}
@media (max-width: 640px) {
  .nav-principale a { padding: 0 10px; }
  .onglet { padding: 0 9px; }
  .onglet .icone { display: none; }
  .etape a { min-height: 64px; padding: 10px 12px; gap: 10px; }
  .etape-numero { width: 30px; height: 30px; }
  .page-entete .outils { margin-left: 0; width: 100%; }
  select.filtre { flex: 1 1 auto; min-width: 0; }
  .liste, .liste thead, .liste tbody { display: block; }
  .liste tr { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; column-gap: 6px; row-gap: 4px; padding: 10px 12px 12px; border-bottom: 1px solid var(--trait); }
  .liste.avec-choix tr { grid-template-columns: 40px minmax(0, 1fr); padding-left: 6px; }
  .liste tr.groupe { display: block; padding: 0; }
  .liste tr.groupe th { display: block; padding: 8px 12px; }
  .liste tbody tr:last-child { border-bottom: 0; }
  .liste th, .liste td { padding: 0; border-bottom: 0; }
  .liste.avec-choix tr > :not(.col-choix) { grid-column: 2; }
  .liste tr > .col-choix { grid-column: 1; grid-row: 1 / span 3; align-self: start; width: auto; padding: 0; }
  .liste thead tr { background: var(--fond); }
  .liste thead th:not(.col-choix):not(.col-societe) { display: none; }
  .liste thead th { background: none; }
  .liste .col-action { text-align: left; padding-top: 4px; }
  .liste .col-date { width: auto; }
  .barre-actions { bottom: 8px; padding: 10px; }
  .barre-actions .espaceur { display: none; }
  .barre-actions .bouton { flex: 1 1 auto; }
  .champs, .champs.trois { grid-template-columns: minmax(0, 1fr); }
  .ligne-associe { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ligne-associe .supprimer { justify-self: end; }
  .fiche-pied .etat-sauvegarde { flex-basis: 100%; }
  .outils > * + .outils-actions { margin-left: 0; padding-left: 0; border-left: 0; }
  .exercice-clos { flex-wrap: wrap; align-items: flex-start; }
  .exercice-clos > div:first-of-type { flex: 1 1 0; min-width: 0; }
  .exercice-clos-actions { flex-basis: 100%; padding-left: 28px; }
  .outils > * + .outils-classeur { margin-left: 0; padding-left: 0; border-left: 0; }
  .tableur-cadre { max-height: 72dvh; scroll-padding-left: 156px; }
  .tableur-erreurs { bottom: 8px; }
  .tableur .col-societe { min-width: 148px; }
  .import { padding: 14px; }
  .import-details { padding-left: 12px; }
  .options-liste { grid-template-columns: minmax(0, 1fr); }
  .apercu-courriel-texte { max-height: 34vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
