/* Système de design du registre. Aucune ressource extérieure : ni police, ni image, ni script tiers.
   Trois largeurs : téléphone (< 640 px), tablette (640 à 1023 px, menu en tiroir), bureau (≥ 1024 px, menu fixe).
   Deux thèmes : clair et sombre ; « auto » suit le système, le bouton de la barre mémorise un choix. */

/* ---------- Jetons ---------- */
:root {
  --fond: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --trait: #e1e5ec;
  --trait-fort: #c5ccd8;
  --encre: #111a2b;
  --encre-2: #465269;
  --encre-3: #6a7589;
  --primaire: #1f3f8f;
  --primaire-survol: #18327a;
  --primaire-doux: #e8eefb;
  --sur-primaire: #ffffff;
  --or: #b88a2a;
  --bon: #13703f;
  --bon-doux: #e4f4ea;
  --alerte: #b3261e;
  --alerte-doux: #fdecea;
  --attention: #8a5a00;
  --attention-doux: #fff3d9;
  --nav-fond: #0d1830;
  --nav-fond-2: #142243;
  --nav-encre: #c3cde0;
  --nav-encre-fort: #ffffff;
  --nav-trait: rgba(255, 255, 255, .09);
  --ombre-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --ombre-2: 0 8px 24px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .06);
  --anneau: 0 0 0 3px rgba(31, 63, 143, .28);
  --rayon: 10px;
  --rayon-petit: 7px;
  --largeur-nav: 264px;
  --hauteur-barre: 56px;
  --police: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --police-chiffres: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  /* Anciens noms, gardés pour les gabarits qui les citent. */
  --accent: var(--primaire);
}

html[data-theme="sombre"] {
  --fond: #0a1120;
  --surface: #121b2d;
  --surface-2: #172238;
  --surface-3: #1d2a44;
  --trait: #24314b;
  --trait-fort: #364565;
  --encre: #e9eef7;
  --encre-2: #b1bccf;
  --encre-3: #8693ab;
  --primaire: #8fb0ff;
  --primaire-survol: #adc5ff;
  --primaire-doux: #1a2850;
  --sur-primaire: #0a1120;
  --or: #d9b25c;
  --bon: #63d69c;
  --bon-doux: #11301f;
  --alerte: #ff8f85;
  --alerte-doux: #3a1715;
  --attention: #f0c06a;
  --attention-doux: #33270e;
  --nav-fond: #070d19;
  --nav-fond-2: #101a2e;
  --ombre-1: 0 1px 2px rgba(0, 0, 0, .4);
  --ombre-2: 0 10px 30px rgba(0, 0, 0, .5);
  --anneau: 0 0 0 3px rgba(143, 176, 255, .35);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --fond: #0a1120;
    --surface: #121b2d;
    --surface-2: #172238;
    --surface-3: #1d2a44;
    --trait: #24314b;
    --trait-fort: #364565;
    --encre: #e9eef7;
    --encre-2: #b1bccf;
    --encre-3: #8693ab;
    --primaire: #8fb0ff;
    --primaire-survol: #adc5ff;
    --primaire-doux: #1a2850;
    --sur-primaire: #0a1120;
    --or: #d9b25c;
    --bon: #63d69c;
    --bon-doux: #11301f;
    --alerte: #ff8f85;
    --alerte-doux: #3a1715;
    --attention: #f0c06a;
    --attention-doux: #33270e;
    --nav-fond: #070d19;
    --nav-fond-2: #101a2e;
    --ombre-1: 0 1px 2px rgba(0, 0, 0, .4);
    --ombre-2: 0 10px 30px rgba(0, 0, 0, .5);
    --anneau: 0 0 0 3px rgba(143, 176, 255, .35);
  }
}
html[data-theme="sombre"] { color-scheme: dark; }
html[data-theme="clair"] { color-scheme: light; }

/* ---------- Socle ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hauteur-barre) + 12px); }
body { margin: 0; font: 15px/1.55 var(--police); color: var(--encre); background: var(--fond); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[hidden] { display: none !important; }
a { color: var(--primaire); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primaire-survol); }
:focus-visible { outline: none; box-shadow: var(--anneau); border-radius: 4px; }
main:focus { outline: none; box-shadow: none; }
h1 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.75rem); line-height: 1.2; font-weight: 680; letter-spacing: -.015em; margin: .2rem 0 .9rem; overflow-wrap: anywhere; }
h2 { font-size: 1.12rem; line-height: 1.3; font-weight: 650; letter-spacing: -.005em; margin: 2rem 0 .7rem; }
h3 { font-size: .98rem; font-weight: 650; margin: 1.4rem 0 .5rem; }
h2 small { font-weight: 400; color: var(--encre-3); font-size: .88em; }
p { margin: .6rem 0; }
small { color: var(--encre-3); font-size: .86em; }
code { font-family: var(--police-chiffres); font-size: .88em; background: var(--surface-3); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
.icone { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.evitement { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--primaire); padding: .6rem 1rem; border-radius: var(--rayon-petit); box-shadow: var(--ombre-2); transition: top .15s; }
.evitement:focus { top: 12px; }

/* ---------- Coquille : menu latéral, barre, contenu ---------- */
.nav { position: fixed; inset: 0 auto 0 0; width: var(--largeur-nav); z-index: 40; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--nav-fond-2), var(--nav-fond) 38%); color: var(--nav-encre); border-right: 1px solid var(--nav-trait); padding: 0 12px env(safe-area-inset-bottom); }
.marque { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 14px 8px; color: var(--nav-encre-fort); text-decoration: none; border-bottom: 1px solid var(--nav-trait); }
.marque:hover { color: var(--nav-encre-fort); }
.marque-sigle { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: linear-gradient(145deg, #2a4fae, #16306f); color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .02em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 -3px 0 rgba(217, 178, 92, .9); }
.marque-logo { width: 38px; height: 38px; flex: none; object-fit: contain; border-radius: 8px; }
.marque-texte { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.marque-nom { font-weight: 650; font-size: .98rem; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marque-devise { font-size: .76rem; color: var(--nav-encre); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-menu { flex: 1; overflow-y: auto; padding: 6px 0 12px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-menu ul { list-style: none; margin: 0; padding: 0; }
.nav-titre { margin: 18px 10px 6px; font-size: .7rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--nav-encre); opacity: .62; }
.nav .menu { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 10px; margin: 2px 0; border-radius: 8px; color: var(--nav-encre); text-decoration: none; font-weight: 500; font-size: .93rem; transition: background .12s, color .12s; }
.nav .menu:hover { background: rgba(255, 255, 255, .06); color: var(--nav-encre-fort); }
.nav .menu.actif { background: rgba(255, 255, 255, .10); color: var(--nav-encre-fort); font-weight: 600; }
.nav .menu.actif::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--or); }
.nav .menu:focus-visible, .marque:focus-visible, .nav .bouton-icone:focus-visible { box-shadow: 0 0 0 3px rgba(143, 176, 255, .55); }
.nav-pied { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px; border-top: 1px solid var(--nav-trait); }
.nav-pied form { margin: 0; }
.compte { display: flex; align-items: center; gap: 10px; min-width: 0; }
.compte-pastille { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .12); color: var(--nav-encre-fort); font-weight: 650; font-size: .85rem; }
.compte-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; color: var(--nav-encre-fort); }
.nav .bouton-icone { color: var(--nav-encre); }
.nav .bouton-icone:hover { background: rgba(255, 255, 255, .08); color: var(--nav-encre-fort); }

.coquille .page { margin-left: var(--largeur-nav); min-height: 100vh; display: flex; flex-direction: column; }
.barre { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: var(--hauteur-barre); padding: 8px clamp(14px, 3vw, 32px); background: color-mix(in srgb, var(--fond) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--trait); }
.barre-espace { flex: 1; }
.barre-marque { display: none; align-items: center; gap: 10px; color: var(--encre); font-weight: 650; text-decoration: none; min-width: 0; }
.barre-marque span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-marque .marque-sigle, .barre-marque .marque-logo { width: 30px; height: 30px; font-size: .8rem; border-radius: 8px; }
.bouton-icone.ouvrir-nav { display: none; }
.bouton-icone { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--encre-2); cursor: pointer; }
.bouton-icone:hover { background: var(--surface-3); color: var(--encre); }
.icone-lune { display: none; }
html[data-theme="sombre"] .icone-soleil { display: none; }
html[data-theme="sombre"] .icone-lune { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .icone-soleil { display: none; }
  html[data-theme="auto"] .icone-lune { display: block; }
}
main { width: 100%; max-width: 1240px; margin: 0 auto; padding: clamp(16px, 2.6vw, 30px) clamp(14px, 3vw, 32px) 72px; flex: 1; }
.voile { position: fixed; inset: 0; z-index: 35; background: rgba(6, 10, 20, .55); backdrop-filter: blur(2px); }

/* Écran sans session : la connexion, centrée. */
.porte { min-height: 100vh; background: radial-gradient(1200px 600px at 15% -10%, var(--primaire-doux), transparent 60%), var(--fond); }
.porte .barre { background: transparent; border: 0; backdrop-filter: none; }
.porte .barre-marque { display: flex; }
.porte main { max-width: 460px; padding-top: clamp(24px, 8vh, 90px); }
.porte main > form, .porte main > .carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; box-shadow: var(--ombre-2); padding: 22px; margin-top: 18px; }
.porte .ligne-formulaire { flex-direction: column; align-items: stretch; gap: 6px; }
.porte .ligne-formulaire input { width: 100%; }
.porte button[type="submit"] { width: 100%; }

/* ---------- Fil d'Ariane, pastilles, messages ---------- */
.fil { margin: 0 0 .2rem; color: var(--encre-3); font-size: .86rem; overflow-wrap: anywhere; }
.fil a { color: var(--encre-2); text-decoration: none; }
.fil a:hover { color: var(--primaire); text-decoration: underline; }
.pastille { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; border: 1px solid transparent; background: var(--surface-3); color: var(--encre-2); }
.pastille .icone { width: 15px; height: 15px; }
.pastille.bon { background: var(--bon-doux); color: var(--bon); }
.pastille.attention { background: var(--attention-doux); color: var(--attention); }
.pastille.alerte { background: var(--alerte-doux); color: var(--alerte); }
.pastille.neutre { background: var(--surface-3); color: var(--encre-2); }
a.pastille:hover { border-color: currentColor; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { position: relative; padding: .7rem .95rem .7rem 2.7rem; margin: .6rem 0; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--primaire-doux); color: var(--encre); border-color: color-mix(in srgb, var(--primaire) 22%, transparent); overflow-wrap: anywhere; }
.message::before { content: "i"; position: absolute; left: .85rem; top: .72rem; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--primaire); color: var(--sur-primaire); font-size: .78rem; font-weight: 700; line-height: 1; }
.message.success { background: var(--bon-doux); border-color: color-mix(in srgb, var(--bon) 28%, transparent); }
.message.success::before { content: "✓"; background: var(--bon); }
.message.warning { background: var(--attention-doux); border-color: color-mix(in srgb, var(--attention) 30%, transparent); }
.message.warning::before { content: "!"; background: var(--attention); }
.message.error { background: var(--alerte-doux); border-color: color-mix(in srgb, var(--alerte) 30%, transparent); color: var(--encre); }
.message.error::before { content: "!"; background: var(--alerte); }
.message.error strong { color: var(--alerte); }
.message > :first-child { margin-top: 0; }
.message > :last-child { margin-bottom: 0; }
.message ul { margin: .3rem 0; padding-left: 1.1rem; }
.message .tableau { margin: .7rem 0 .2rem; }
.anomalies { color: var(--alerte); }

/* ---------- Boutons ---------- */
button, .bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: .5rem 1rem; font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.2; border: 1px solid var(--primaire); border-radius: var(--rayon-petit); background: var(--primaire); color: var(--sur-primaire); cursor: pointer; text-decoration: none; box-shadow: var(--ombre-1); transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; }
button:hover, .bouton:hover { background: var(--primaire-survol); border-color: var(--primaire-survol); color: var(--sur-primaire); }
button:active, .bouton:active { transform: translateY(1px); }
button.secondaire, .bouton.secondaire { background: var(--surface); color: var(--primaire); border-color: var(--trait-fort); }
button.secondaire:hover, .bouton.secondaire:hover { background: var(--primaire-doux); color: var(--primaire); border-color: var(--primaire); }
strong.bouton { cursor: default; }
.bouton-icone, .bouton-icone:hover { box-shadow: none; border: 0; min-height: 0; }
.actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; margin: 1.8rem 0 0; padding: .8rem 1rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-2); }

/* ---------- Formulaires ---------- */
label { font-weight: 550; font-size: .9rem; color: var(--encre-2); }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], input[type="email"], input[type="tel"], input[type="url"], input:not([type]), select, textarea { font: inherit; color: var(--encre); background: var(--surface); border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit); padding: .5rem .7rem; min-height: 40px; max-width: 100%; transition: border-color .12s, box-shadow .12s; }
input[type="text"], input[type="date"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"], input:not([type]), select { width: 100%; }
input[size], select { width: auto; }
input:hover, select:hover, textarea:hover { border-color: var(--encre-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaire); box-shadow: var(--anneau); }
input::placeholder, textarea::placeholder { color: var(--encre-3); opacity: .8; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primaire); vertical-align: -3px; margin-right: 6px; }
input[type="file"] { font: inherit; font-size: .9rem; max-width: 100%; color: var(--encre-2); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: .45rem .8rem; border: 1px solid var(--trait-fort); border-radius: var(--rayon-petit); background: var(--surface-2); color: var(--encre); cursor: pointer; }
textarea { width: 100%; font: 13px/1.5 var(--police-chiffres); resize: vertical; }
textarea.prose { font: inherit; }
.ligne-formulaire { display: flex; gap: .6rem .8rem; align-items: center; flex-wrap: wrap; margin: .8rem 0; }
.ligne-formulaire input, .ligne-formulaire select { width: auto; }
form[role="search"].ligne-formulaire, form[method="get"].ligne-formulaire { padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); }
fieldset { margin: 1.2rem 0; padding: .6rem 1.2rem 1rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); min-width: 0; }
legend { padding: 0 .5rem; font-weight: 650; font-size: .95rem; color: var(--encre); }
fieldset p { margin: .75rem 0; }
fieldset label + br { display: block; }

/* ---------- Tableaux ---------- */
.tableau { margin: .8rem 0 1.2rem; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--surface); box-shadow: var(--ombre-1); overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.tableau:focus-visible { box-shadow: var(--anneau); border-radius: var(--rayon); }
.tableau.deborde-droite { box-shadow: var(--ombre-1), inset -14px 0 12px -12px rgba(16, 24, 40, .28); }
.tableau.deborde-gauche { box-shadow: var(--ombre-1), inset 14px 0 12px -12px rgba(16, 24, 40, .28); }
.tableau.deborde-droite.deborde-gauche { box-shadow: var(--ombre-1), inset -14px 0 12px -12px rgba(16, 24, 40, .28), inset 14px 0 12px -12px rgba(16, 24, 40, .28); }
table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: .92rem; }
.tableau > table { background: transparent; }
th, td { padding: .6rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--encre-2); font-size: .76rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--trait-fort); }
tbody th { font-weight: 600; color: var(--encre-2); background: var(--surface-2); width: 1%; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > td { background: color-mix(in srgb, var(--primaire-doux) 45%, transparent); }
.nombre { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td form { margin: 0; }
td button { min-height: 32px; padding: .3rem .7rem; font-size: .85rem; }
.grille input[type="text"] { text-align: right; min-width: 7.5rem; min-height: 36px; padding: .35rem .55rem; }
.grille td:first-child input[type="text"] { text-align: left; }
.grille td:first-child { white-space: nowrap; }
tr.en-erreur > td { background: var(--alerte-doux); }
tr.erreur > td { color: var(--alerte); background: var(--alerte-doux); font-size: .88rem; padding-top: .2rem; }
tr.echec > td { background: color-mix(in srgb, var(--alerte-doux) 70%, transparent); }
tr.ok strong, tr.echec strong, tr.non-evalue strong { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
tr.ok strong { background: var(--bon-doux); color: var(--bon); }
tr.echec strong { background: var(--alerte-doux); color: var(--alerte); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--alerte) 35%, transparent); }
tr.non-evalue strong { background: var(--attention-doux); color: var(--attention); }

/* ---------- Cartes et blocs ---------- */
.verdict, .source, .contrat, .carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); padding: 1rem 1.2rem 1.1rem; margin: 1.1rem 0; }
.verdict > h2:first-child, .source > h2:first-child, .contrat > h2:first-child, .carte > h2:first-child { margin-top: .1rem; }
.verdict { border-left: 4px solid var(--alerte); }
.verdict.ok { border-left-color: var(--bon); }
.source { border-left: 4px solid var(--bon); }
.source.périmée, .source.absente { border-left-color: var(--attention); }
.contrat { padding-bottom: .6rem; }
.contrat .tableau, .verdict .tableau, .source .tableau { box-shadow: none; }
.etat { font-weight: 650; }
.liste { list-style: none; margin: 1rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.liste li { display: flex; flex-direction: column; gap: 2px; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); color: var(--encre-2); font-size: .9rem; transition: border-color .12s, box-shadow .12s, transform .12s; position: relative; }
.liste li:hover { border-color: var(--primaire); box-shadow: var(--ombre-2); transform: translateY(-1px); }
.liste li a { font-weight: 650; font-size: 1rem; color: var(--encre); text-decoration: none; font-variant-numeric: tabular-nums; }
.liste li a::after { content: ""; position: absolute; inset: 0; border-radius: var(--rayon); }
.liste li:hover a { color: var(--primaire); }
details { margin: 1rem 0 .4rem; border-top: 1px solid var(--trait); padding-top: .6rem; }
summary { cursor: pointer; font-weight: 600; color: var(--encre-2); padding: .3rem 0; border-radius: 6px; }
summary:hover { color: var(--primaire); }
.texte-anonymise { white-space: pre-wrap; overflow-wrap: anywhere; margin: .8rem 0; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); font: 13px/1.6 var(--police-chiffres); color: var(--encre); max-height: 70vh; overflow-y: auto; }

/* ---------- En-tête de page, indicateurs, tuiles, statuts, états vides ---------- */
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .6rem 1.5rem; margin: 0 0 1.1rem; }
.entete-titre { min-width: 0; flex: 1 1 22rem; }
.entete h1 { margin-bottom: .25rem; }
.sous-titre { margin: 0; color: var(--encre-2); max-width: 72ch; }
.entete-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.discret { color: var(--encre-3); }
.creer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.creer-titre { color: var(--encre-2); font-weight: 550; margin-right: .2rem; }
.bouton .icone { width: 16px; height: 16px; stroke-width: 2; }

.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 1.3rem; }
.indicateur { margin: 0; padding: .85rem 1.1rem .9rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); min-width: 0; }
.indicateur dt { font-size: .74rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-3); }
.indicateur dd { margin: .2rem 0 0; font-size: clamp(1.15rem, 1rem + .7vw, 1.45rem); font-weight: 680; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indicateur dd.indicateur-note { font-size: .8rem; font-weight: 400; letter-spacing: 0; color: var(--encre-3); white-space: normal; }
.positif { color: var(--bon); }
.negatif { color: var(--alerte); }

.contrat-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem 1.5rem; }
.contrat-tete h2 { margin: .1rem 0 .2rem; overflow-wrap: anywhere; }
.contrat-total { margin: 0; color: var(--encre-3); font-size: .86rem; white-space: nowrap; }
.contrat-total strong { color: var(--encre); font-size: 1.05rem; font-variant-numeric: tabular-nums; margin-left: .3rem; }
.contrat form.ligne-formulaire, .carte form.ligne-formulaire { background: var(--surface-2); box-shadow: none; }

.statut { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--encre-2); }
.statut::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.statut-actif, .statut-en-cours, .statut-ouvert { background: var(--bon-doux); color: var(--bon); }
.statut-inactif, .statut-clos, .statut-cloture, .statut-ferme { background: var(--surface-3); color: var(--encre-3); }
.statut-prospect, .statut-en-attente { background: var(--attention-doux); color: var(--attention); }
.statut-ok, .statut-a-jour, .statut-confirme { background: var(--bon-doux); color: var(--bon); }
.statut-na, .statut-perimee, .statut-absente { background: var(--attention-doux); color: var(--attention); }
.statut-ko, .statut-echec, .statut-alerte { background: var(--alerte-doux); color: var(--alerte); }
.statut-en-cours { background: var(--primaire-doux); color: var(--primaire); }
.statut-abandonne, .statut-purge { background: var(--surface-3); color: var(--encre-3); }

.statut-complet { background: var(--bon-doux); color: var(--bon); }
.statut-partiel { background: var(--primaire-doux); color: var(--primaire); }
.statut-a-saisir { background: var(--attention-doux); color: var(--attention); }

/* Accueil : parcours en étapes et barre de progression. */
.indicateur-note a { color: inherit; }
.parcours { list-style: none; counter-reset: etape; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: .8rem 0 1.4rem; padding: 0; }
.parcours li { counter-increment: etape; display: flex; }
.parcours a { position: relative; display: flex; flex-direction: column; gap: .25rem; width: 100%; padding: 1rem 1.05rem 1.05rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); color: var(--encre-2); text-decoration: none; font-size: .88rem; line-height: 1.45; transition: border-color .12s, box-shadow .12s, transform .12s; }
.parcours a:hover { border-color: var(--primaire); box-shadow: var(--ombre-2); transform: translateY(-1px); }
.parcours a::after { content: counter(etape); position: absolute; top: .85rem; right: 1rem; font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--trait-fort); font-variant-numeric: tabular-nums; }
.parcours strong { color: var(--encre); font-size: .98rem; }
.parcours-icone { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: .35rem; border-radius: 10px; background: var(--primaire-doux); color: var(--primaire); }
.progression { margin: .6rem 0 1rem; }
.progression-barre { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progression-barre span { display: block; height: 100%; min-width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primaire), color-mix(in srgb, var(--primaire) 60%, var(--bon))); }
.progression p { margin: .45rem 0 0; color: var(--encre-2); font-size: .9rem; }

/* Sélecteur à segments (nature d'une nouvelle entité). */
.segments { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: .2rem 0 .6rem; background: var(--surface-3); border-radius: 10px; }
.segments .bouton { min-height: 34px; padding: .35rem .9rem; border-color: transparent; box-shadow: none; background: transparent; color: var(--encre-2); }
.segments a.bouton:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--encre); border-color: transparent; }
.segments strong.bouton { background: var(--surface); color: var(--primaire); box-shadow: var(--ombre-1); }

/* Masque de saisie : les champs se rangent en colonnes quand la place le permet. */
.formulaire fieldset { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: .2rem 1.4rem; align-items: start; }
.formulaire fieldset > * { margin: .55rem 0; min-width: 0; }
.formulaire fieldset > p:has(textarea), .formulaire fieldset > p:has(input[size="80"]), .formulaire fieldset > p:not(:has(input, select, textarea)), .formulaire fieldset > :not(p) { grid-column: 1 / -1; }
.formulaire fieldset input[type="text"], .formulaire fieldset input[type="date"], .formulaire fieldset select { width: 100%; }
.formulaire fieldset input[type="text"][size="6"], .formulaire fieldset input[type="text"][size="4"] { width: 8rem; }
.formulaire label { display: block; margin-bottom: .25rem; }
.formulaire label + br { display: none; }
.formulaire small { display: block; margin-top: .25rem; }

.filtre-tuiles { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 .2rem; }
.filtre-tuiles input { width: min(100%, 26rem); }
.filtre-vide { color: var(--encre-3); }
.tuiles { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.liste li.tuile { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "sigle corps" "pied pied"; gap: .7rem .8rem; padding: 1rem 1.05rem .85rem; }
.tuile-sigle { grid-area: sigle; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--primaire-doux); color: var(--primaire); }
.tuile.nature-foyer .tuile-sigle { background: color-mix(in srgb, var(--or) 18%, var(--surface)); color: color-mix(in srgb, var(--or) 78%, var(--encre)); }
.tuile.nature-societe .tuile-sigle { background: var(--surface-3); color: var(--encre-2); }
.tuile-corps { grid-area: corps; display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.3; }
.liste li.tuile a { overflow-wrap: anywhere; }
.tuile-alias { font-family: var(--police-chiffres); font-size: .78rem; color: var(--encre-3); letter-spacing: .01em; }
.tuile-pied { grid-area: pied; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding-top: .65rem; border-top: 1px solid var(--trait); font-size: .82rem; color: var(--encre-3); }
.tuile-pied .pastille { min-height: 22px; padding: 1px 8px; font-size: .74rem; }
.tuile-compte { margin-left: auto; font-variant-numeric: tabular-nums; }

.vide { display: grid; justify-items: center; gap: .2rem; text-align: center; padding: 2.4rem 1rem; margin: 1.2rem 0; border: 1px dashed var(--trait-fort); border-radius: var(--rayon); color: var(--encre-2); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.vide > .icone { width: 34px; height: 34px; color: var(--encre-3); stroke-width: 1.4; }
.vide p { margin: .3rem 0; }

/* ---------- Tablette et téléphone : le menu devient un tiroir ---------- */
@media (max-width: 1023.98px) {
  .coquille .page { margin-left: 0; }
  .nav { transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); box-shadow: none; width: min(86vw, 300px); }
  .nav-ouverte .nav { transform: none; box-shadow: var(--ombre-2); }
  .nav-ouverte { overflow: hidden; }
  .bouton-icone.ouvrir-nav { display: inline-grid; margin-left: -6px; }
  .barre-marque { display: flex; }
}
@media (max-width: 639.98px) {
  body { font-size: 15px; }
  input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], input[type="email"], input[type="tel"], input[type="url"], input:not([type]), select, textarea { font-size: 16px; }  /* évite le zoom automatique d'iOS */
  .barre { gap: 6px; }
  .barre-marque span:last-child { display: none; }
  .etat-identites span, .pastille.attention { font-size: .74rem; }
  .ligne-formulaire { flex-direction: column; align-items: stretch; gap: .4rem; }
  .ligne-formulaire input, .ligne-formulaire select, .ligne-formulaire button, .ligne-formulaire .bouton { width: 100%; }
  input[size], select { width: 100%; }
  main > p > .bouton, main > p > button, main > form > p > button, fieldset ~ p > button { width: 100%; margin-bottom: .5rem; }
  th, td { padding: .5rem .6rem; }
  .verdict, .source, .contrat, .carte, fieldset { padding-left: .9rem; padding-right: .9rem; }
  .liste { grid-template-columns: 1fr 1fr; gap: 8px; }
  .actions { margin-left: -6px; margin-right: -6px; }
  .actions button { flex: 1 1 100%; }
}
@media (max-width: 1023.98px) { .indicateurs { grid-template-columns: 1fr 1fr; } .parcours { grid-template-columns: 1fr 1fr; } }
@media (max-width: 639.98px) { .parcours { grid-template-columns: 1fr; } }
@media (max-width: 1023.98px) { .grille thead th { white-space: normal; } .grille input[type="text"] { min-width: 5.5rem; } }
@media (max-width: 639.98px) {
  thead th { white-space: normal; }
  .entete { align-items: stretch; }
  .entete-actions { width: 100%; }
  .entete-actions .bouton { flex: 1 1 auto; }
  .tuiles { grid-template-columns: 1fr; }
  .indicateurs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .indicateur { padding: .7rem .8rem; }
  .creer .bouton { flex: 1 1 40%; }
  .filtre-tuiles input { width: 100%; }

  /* Tableaux larges : chaque ligne devient une fiche, l'en-tête de colonne passe devant la valeur. */
  table.empile { display: block; }
  table.empile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.empile tbody { display: block; }
  table.empile tr { display: block; padding: .65rem .8rem; border-bottom: 1px solid var(--trait); }
  table.empile tr:last-child { border-bottom: 0; }
  table.empile td { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .22rem 0; border: 0; text-align: right; white-space: normal; background: transparent !important; overflow-wrap: anywhere; }
  table.empile td[data-titre]::before { content: attr(data-titre); flex: 0 0 auto; max-width: 46%; text-align: left; font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--encre-3); }
  table.empile td:first-child { font-weight: 650; font-size: .98rem; justify-content: flex-start; text-align: left; padding-bottom: .3rem; }
  table.empile td:first-child::before { content: none; }
  table.empile td:empty, table.empile td.vide-de-sens { display: none; }
  table.empile td:not([data-titre]) { justify-content: flex-start; text-align: left; }
  table.empile td input[type="text"], table.empile td select { flex: 1 1 54%; width: 54%; min-width: 0; }
  table.empile.grille td:first-child input[type="text"] { flex-basis: 100%; width: 100%; }
  table.empile tr.erreur { padding-top: .2rem; }
  table.empile tr.en-erreur { background: var(--alerte-doux); }
  .tableau:has(> table.empile) { overflow-x: visible; }
}
@media (max-width: 380px) { .liste { grid-template-columns: 1fr; } .indicateurs { grid-template-columns: 1fr; } }

/* Sans le script d'interface, un tableau large défile quand même sur petit écran. */
@media (max-width: 1023.98px) { main > table, section > table, form > table, details > table { display: block; overflow-x: auto; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

@media print {
  .nav, .barre, .voile, .evitement, .actions, button, .bouton { display: none !important; }
  .coquille .page { margin: 0; }
  body { background: #fff; color: #000; }
  .tableau, .verdict, .source, .contrat, fieldset { box-shadow: none; }
}

/* --- Fiche d'identité -------------------------------------------------------------- */
.chiffres { font-family: var(--police-chiffres); font-size: .92em; }
.lecteur-ecran { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.saisie .progression-barre span { background: var(--primaire); }  /* jamais de vert : il se lirait « conforme » */
.message > a:only-child { color: inherit; }
.fiche { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.4rem; align-items: start; margin-top: 1rem; }
.fiche-sommaire { position: sticky; top: 76px; padding: .5rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); }
.fiche-sommaire ul { list-style: none; margin: 0; padding: 0; }
.fiche-sommaire a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 44px; padding: .3rem .7rem; border-radius: 8px; color: var(--encre-2); text-decoration: none; font-size: .92rem; }
.fiche-sommaire a:hover { background: var(--surface-3); color: var(--encre); }
.fiche-compte { font-family: var(--police-chiffres); font-size: .78rem; font-weight: 500; color: var(--encre-3); white-space: nowrap; }
.fiche-corps { min-width: 0; }
.fiche-section { position: relative; margin: 0 0 1rem; padding: .3rem 1.2rem .9rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-1); scroll-margin-top: 80px; }
.fiche-section > details { margin: 0; padding: 0; border-top: 0; }
.fiche-section > details > summary { display: flex; align-items: center; gap: .6rem; min-height: 48px; padding: .3rem 9.5rem .3rem 0; font-size: 1.05rem; color: var(--encre); list-style-position: inside; }
.fiche-section > details > summary::before { content: "▸"; color: var(--encre-3); width: 1em; }
.fiche-section > details[open] > summary::before { content: "▾"; }
.fiche-section > details > summary::-webkit-details-marker { display: none; }
.fiche-section > details > summary { list-style: none; }
.fiche-section > h2 { margin: .7rem 0 .5rem; font-size: 1.05rem; }
.fiche-section h3 { margin: 1.1rem 0 .35rem; font-size: .76rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-3); }
.fiche-modifier { position: absolute; top: .55rem; right: 1rem; }
.fiche-champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1.8rem; margin: .4rem 0 .8rem; }
.fiche-champs > div { min-width: 0; }
.fiche-champs > .large { grid-column: 1 / -1; }
.fiche-champs dt { font-size: .8rem; color: var(--encre-3); }
.fiche-champs dd { margin: .1rem 0 0; overflow-wrap: anywhere; }
.a-completer { color: var(--attention); font-style: italic; }
.vide { color: var(--encre-3); }
.fiche-liste { list-style: none; margin: .4rem 0; padding: 0; }
.fiche-liste li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.1rem; padding: .65rem 0; border-top: 1px solid var(--trait); }
.fiche-liste li:first-child { border-top: 0; }
.fiche-liste-titre { font-weight: 600; overflow-wrap: anywhere; }
.fiche-liste-actions { margin-left: auto; display: flex; gap: 1rem; }
.actions-ligne { white-space: nowrap; }
.menu-actions { display: inline-block; margin: 0 0 0 .8rem; padding: 0; border: 0; vertical-align: top; }
.menu-actions summary { display: inline-block; padding: 0; font-weight: 400; font-size: .9rem; color: var(--encre-2); }
.menu-actions[open] { display: block; margin: .3rem 0 0; }
.menu-actions[open] > a, .menu-actions[open] > span { display: block; padding: .35rem 0; }
.lien-danger { color: var(--alerte); }
.inactif { color: var(--encre-3); cursor: not-allowed; }
button.danger, .bouton.danger { background: var(--alerte); border-color: var(--alerte); color: var(--surface); }
button.danger:hover, .bouton.danger:hover { background: color-mix(in srgb, var(--alerte) 85%, #000); border-color: var(--alerte); color: var(--surface); }
button[disabled] { opacity: .6; cursor: progress; }
.attendu { color: var(--primaire); font-weight: 700; }
.erreur-champ { color: var(--alerte); font-weight: 600; }
.champ-erreur input, .champ-erreur select, .champ-erreur textarea { border-color: var(--alerte); }
.formulaire fieldset input[type="tel"], .formulaire fieldset input[type="number"], .formulaire fieldset input[type="password"] { width: 100%; }
.avertissement-session { position: sticky; top: 76px; z-index: 6; box-shadow: var(--ombre-2); }
@media (max-width: 1023.98px) {
  .fiche { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  .fiche-sommaire { position: static; overflow-x: auto; padding: .3rem; }
  .fiche-sommaire ul { display: flex; gap: .2rem; }
  .fiche-sommaire a { white-space: nowrap; }
  .fiche-champs { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639.98px) {
  .fiche-section { padding: .2rem .9rem .8rem; }
  .fiche-section > details > summary { padding-right: 0; }
  .fiche-modifier { position: static; display: flex; justify-content: center; width: 100%; margin-top: .6rem; }
  .fiche-section p > .bouton, .entete-actions .bouton { width: 100%; justify-content: center; }
  .fiche-liste-actions { margin-left: 0; width: 100%; }
  input[type="tel"] { font-size: 16px; }
}
.insecable { white-space: nowrap; }
