/* Educo — charte reprise de Budget-DSIN (DM Sans, DM Mono, thèmes sombre et clair) */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg0: #0b0d14; --bg1: #11141e; --bg2: #181c29; --bg3: #1f2435; --bg4: #262c3e;
  --border: rgba(255,255,255,.22); --border2: rgba(255,255,255,.32); --filet: rgba(255,255,255,.12); --grille: rgba(255,255,255,.08);
  --t1: #edf0fa; --t2: #8892b0; --tf: #7480ab; --sb-titre: #a8b0cc;
  --blue: #4f8ef7; --violet: #6c5ce7; --violet-rgb: 139,124,246; --label: #7aadff;
  --green: #34d399; --red: #f87171; --amber: #fbbf24; --orange: #fb923c; --orange-rgb: 251,146,60; --neutre: #8892b0;
  --txt-green: #34d399; --txt-red: #f87171; --txt-amber: #fbbf24;
  --blue-rgb: 79,142,247; --green-rgb: 52,211,153; --red-rgb: 248,113,113; --amber-rgb: 251,191,36; --accent-rgb: 122,173,255;
  --grad: linear-gradient(135deg, #4f8ef7, #6c5ce7);
  --actif-fond: linear-gradient(135deg, rgba(79,142,247,.35), rgba(108,92,231,.3)); --actif-texte: #ffffff;
  --thead: #ffffff; --voile: rgba(255,255,255,.04); --voile-champ: rgba(255,255,255,.03); --voile-survol: rgba(255,255,255,.09);
  --hachure: rgba(255,255,255,.28); --ombre: rgba(0,0,0,.3); --ombre-forte: rgba(0,0,0,.55); --ombre-sceau: rgba(0,0,0,.55);
  --alerte-fond: #2d1e0e; --alerte-texte: #fcd34d; --logo-filtre: none;
  --note-entete: rgba(255,255,255,.72); --ast-entete: #ff4d4d;
  --mono: 'DM Mono', ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="clair"] {
  --bg0: #f4f6fb; --bg1: #ffffff; --bg2: #f7f9fd; --bg3: #eef2f9; --bg4: #e3e9f4;
  --border: rgba(17,24,39,.14); --border2: rgba(17,24,39,.24); --filet: rgba(17,24,39,.10); --grille: rgba(17,24,39,.07);
  --t1: #111827; --t2: #4b5563; --tf: #5b6472; --sb-titre: #5b6472;
  --blue: #2563eb; --violet: #6d28d9; --violet-rgb: 109,40,217; --label: #1d4ed8;
  --green: #087f52; --red: #dc2626; --amber: #d97706; --orange: #c2410c; --orange-rgb: 194,65,12; --neutre: #7b8794;
  --txt-green: #066641; --txt-red: #b91c1c; --txt-amber: #92400e;
  --blue-rgb: 37,99,235; --green-rgb: 8,127,82; --red-rgb: 220,38,38; --amber-rgb: 180,83,9; --accent-rgb: 37,99,235;
  --grad: linear-gradient(135deg, #2563eb, #6d28d9);
  --actif-fond: linear-gradient(135deg, rgba(37,99,235,.16), rgba(109,40,217,.12)); --actif-texte: #1d4ed8;
  --thead: #111827; --voile: rgba(17,24,39,.04); --voile-champ: rgba(17,24,39,.03); --voile-survol: rgba(17,24,39,.08);
  --hachure: rgba(17,24,39,.30); --ombre: rgba(15,23,42,.08); --ombre-forte: rgba(15,23,42,.22); --ombre-sceau: rgba(15,23,42,.3);
  --alerte-fond: #fffbeb; --alerte-texte: #92400e; --logo-filtre: invert(1) opacity(.85);
  --note-entete: rgba(255,255,255,.88); --ast-entete: #ffd6d6;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg0); color: var(--t1);
  font-family: 'DM Sans', system-ui, sans-serif; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: var(--label); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.mono { font-family: var(--mono); }
.discret { color: var(--tf); }
.droite { text-align: right; }

/* ---------- Barre supérieure ---------- */
.barre { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; min-height: 58px; padding: 8px 28px;
  background: var(--bg1); border-bottom: 1px solid var(--border); }
.marque { display: inline-flex; align-items: center; gap: 14px; }
.marque img.logo { display: block; height: 30px; width: auto; filter: var(--logo-filtre); }
.marque .trait { width: 1px; height: 28px; background: var(--border2); }
.marque .accueil { display: block; border-radius: 50%; }
/* Sceau Educo en cire rouge : le même fichier sur les deux thèmes, seule l'ombre portée change. */
.marque .sceau { display: block; width: 40px; height: 40px; filter: drop-shadow(0 2px 3px var(--ombre-sceau)); }
/* Numéro de version, celui de Educo.py, à droite du sceau. */
.marque .version { margin-left: -4px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 20px; font-family: var(--mono); font-size: 11px;
  color: var(--tf); white-space: nowrap; }
.onglets { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 12px; }
.onglet { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border: 0; border-radius: 8px; background: var(--voile);
  color: var(--t2); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.onglet:hover { color: var(--t1); }
.onglet[aria-current="page"] { background: var(--actif-fond); color: var(--actif-texte);
  box-shadow: 0 0 0 1.5px var(--blue), 0 3px 12px rgba(var(--blue-rgb), .3); }
.onglet .pastille { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px; }
.onglet.separe { margin-left: 6px; }
.p-ambre { background: rgba(var(--amber-rgb), .18); color: var(--txt-amber); }
.p-bleu { background: rgba(var(--blue-rgb), .18); color: var(--blue); }
.p-vert { background: rgba(var(--green-rgb), .14); color: var(--txt-green); }
.barre-droite { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.env { padding: 3px 10px; border-radius: 20px; background: rgba(var(--amber-rgb), .14); border: 1px solid rgba(var(--amber-rgb), .3);
  color: var(--txt-amber); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
/* Administrateur connecté en tant qu'un autre utilisateur : rappel permanent dans la barre. */
.incarnation { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; white-space: nowrap;
  background: rgba(var(--orange-rgb), .14); border: 1px solid rgba(var(--orange-rgb), .45); color: var(--orange); font-size: 11px; font-weight: 600; }
.compte { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.compte .initiales { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(var(--blue-rgb), .18); color: var(--label); font-size: 11px; font-weight: 600; }
.compte .qui { display: flex; flex-direction: column; line-height: 1.25; }
.compte .qui b { font-size: 12px; font-weight: 400; color: var(--t1); }
.compte .qui small { font-size: 10px; color: var(--tf); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--t2); font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer; text-decoration: none; }
.btn:hover { color: var(--t1); }
.btn-principal { border: 0; background: var(--grad); color: #ffffff; box-shadow: 0 3px 12px rgba(var(--blue-rgb), .34); }
.btn-principal:hover { color: #ffffff; filter: brightness(1.1); }
.btn-danger { border-color: rgba(var(--red-rgb), .22); background: rgba(var(--red-rgb), .12); color: var(--txt-red); }
.btn-danger:hover { color: var(--txt-red); border-color: rgba(var(--red-rgb), .5); }
.btn-export { padding: 6px 13px; background: linear-gradient(135deg, rgba(var(--green-rgb), .16), rgba(var(--green-rgb), .06));
  border-color: rgba(var(--green-rgb), .38); color: var(--txt-green); font-size: 12px; font-weight: 600; }
.btn-export:hover { color: var(--txt-green); border-color: rgba(var(--green-rgb), .7); }
/* Boutons à pictogramme seul : œil (se connecter en tant que), crayon orange (modifier). */
.btn-ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; flex-shrink: 0;
  border: 1px solid var(--border2); border-radius: 7px; background: var(--voile); color: var(--t2); cursor: pointer; vertical-align: middle; }
.btn-ico:hover { color: var(--t1); border-color: var(--t2); }
.btn-ico.crayon { border-color: rgba(var(--orange-rgb), .45); background: rgba(var(--orange-rgb), .08); color: var(--orange); }
.btn-ico.crayon:hover { border-color: var(--orange); background: rgba(var(--orange-rgb), .16); }
.btn-ico.grand { width: 36px; height: 36px; border-radius: 8px; }   /* même hauteur qu’un .btn */
.liste td.actions .btn-ico { margin-left: 4px; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 4px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 4px; }
.btn-lien { padding: 6px 8px; border: 0; background: none; color: var(--label); font-size: 12px; font-weight: 500; cursor: pointer; }
.btn[disabled], .btn-lien[disabled] { opacity: .5; cursor: not-allowed; }
.groupe-btn { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.groupe-btn > span { font-size: 11px; color: var(--tf); white-space: nowrap; }
.choix { padding: 5px 12px; background: var(--bg3); border: 1px solid var(--border2); border-radius: 4px; color: var(--t2);
  font-size: 12px; font-weight: 500; cursor: pointer; }
.choix:hover { color: var(--t1); }
.choix[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #ffffff; box-shadow: 0 2px 8px rgba(var(--blue-rgb), .35); }
.segment { display: flex; gap: 2px; padding: 3px; background: var(--bg3); border: 1px solid var(--border2); border-radius: 12px; }
.segment button { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--t2); font-size: 11px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; cursor: pointer; }
.segment button[aria-pressed="true"] { background: rgba(var(--blue-rgb), .18); box-shadow: inset 0 0 0 1px rgba(var(--blue-rgb), .35); color: var(--label); }

/* ---------- Bande sous le menu : filtres ou rubriques ---------- */
.bande { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 28px; background: var(--bg1);
  border-bottom: 1.5px solid var(--border); }
.bande:empty { display: none; }
/* Barre du haut et bande des rubriques restent visibles au défilement ; sous les fenêtres (.voile, 50).
   Sur un téléphone, où elles occupent une bonne part de l’écran, elles défilent avec la page. */
@media (min-width: 760px) { .haut { position: sticky; top: 0; z-index: 40; } }
/* Liste des contrats : le tableau défile dans son cadre (hauteur réglée par ajusterListeContrats), son en-tête reste visible. */
@media (min-width: 760px) {
  #table-contrats { overflow: auto; }
  #table-contrats .liste thead th { position: sticky; top: 0; z-index: 2; }
}
.bande .suite { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.recherche { position: relative; flex: 0 1 240px; min-width: 150px; }
.recherche svg { position: absolute; left: 11px; top: 50%; margin-top: -7.5px; color: var(--tf); }
.recherche input { display: block; width: 100%; height: 34px; padding: 0 14px 0 34px; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--t1); font-size: 13px; }
.filtre { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--tf); white-space: nowrap; }
.filtre select { height: 34px; max-width: 220px; padding: 0 8px; background-color: var(--bg3); border: 1px solid var(--border2); border-radius: 8px;
  color: var(--t1); font-size: 13px; font-weight: 500; }
.filtre select.actif { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.bande .fin { margin-left: auto; }
.compteur { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--blue); color: #ffffff; font-size: 10px; font-weight: 600; }
.rubriques { padding: 4px 28px; gap: 0; }
.rubrique { display: inline-flex; align-items: center; gap: 5px; margin: 4px 3px; padding: 5px 12px; border: 0; border-radius: 8px;
  background: var(--voile); color: var(--t2); font-size: 12px; font-weight: 500; text-decoration: none; cursor: pointer; }
.rubrique:hover { color: var(--t1); }
.rubrique[aria-current="page"] { background: var(--actif-fond); color: var(--actif-texte);
  box-shadow: 0 0 0 1.5px var(--blue), 0 3px 12px rgba(var(--blue-rgb), .3); }

/* ---------- Contenu ---------- */
main { flex: 1; min-width: 0; padding: 20px 28px 48px; }
.titre-vue { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.titre-vue h1 { margin: 0 4px 0 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.pilule { padding: 4px 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; font-family: var(--mono);
  font-size: 12px; color: var(--t2); white-space: nowrap; }
.pilule.vert { color: var(--txt-green); }
.pilule.bleu { background: rgba(var(--blue-rgb), .14); border-color: rgba(var(--blue-rgb), .3); color: var(--label); font-family: inherit; font-size: 11px; font-weight: 500; }
.outils { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
.outils .fin { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.note { margin: 10px 0 0; font-size: 11px; color: var(--tf); }
.vide { padding: 36px 20px; text-align: center; color: var(--t2); }
.vide h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--t1); }
.vide p { margin: 0 auto 14px; max-width: 520px; font-size: 13px; }
.vide .groupe-btn { justify-content: center; }

/* ---------- Tableaux ---------- */
.cadre-table { background: var(--bg1); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 28px var(--ombre); overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; font-size: 13px; }
.liste th { padding: 8px; background: var(--bg3); text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--thead); border-bottom: 2px solid var(--border2); white-space: nowrap; }
.liste th.droite { text-align: right; }
.liste th:first-child, .liste td:first-child { padding-left: 14px; }
.liste th:last-child, .liste td:last-child { padding-right: 14px; }
.liste th button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: inherit; font: inherit;
  letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.liste th .tri { font-size: 10px; opacity: .35; }
.liste th[aria-sort="ascending"] .tri, .liste th[aria-sort="descending"] .tri { opacity: 1; color: var(--label); }
.liste td { padding: 8px; border-bottom: 1px solid var(--border); font-size: 12px; line-height: 1.2; color: var(--t2); white-space: nowrap; }
.liste tbody tr:last-child td { border-bottom: 0; }
.liste tbody tr.cliquable { cursor: pointer; }
.liste tbody tr.cliquable:hover td { background: var(--bg3); }
.liste tbody tr.ligne-nouvelle td { animation: ligne-nouvelle 3s ease-out; }
@keyframes ligne-nouvelle { 0%, 45% { background-color: rgba(var(--blue-rgb), .22); } 100% { background-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .liste tbody tr.ligne-nouvelle td { background-color: rgba(var(--blue-rgb), .22); } }
.liste td.principal { font-weight: 500; color: var(--t1); }
.liste td.principal a { color: var(--t1); text-decoration: none; }
.liste td.principal a:hover { text-decoration: underline; }
.liste td.coupe { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.liste td.libre { white-space: normal; }
/* Journal : valeurs avant et après une modification, une ligne par champ. */
.liste td.ecart { white-space: normal; min-width: 200px; max-width: 360px; font-size: 12px; line-height: 1.45; }
.liste td.ecart div + div { margin-top: 3px; }
.liste td.date { font-family: var(--mono); font-size: 11px; color: var(--tf); }
.liste td.montant { font-family: var(--mono); color: var(--txt-green); text-align: right; }
.liste td.actions { text-align: right; }
.liste td.actions .btn { margin-left: 4px; }
.liste td.i-rouge { box-shadow: inset 4px 0 0 var(--red); }
.liste td.i-ambre { box-shadow: inset 4px 0 0 var(--amber); }
.liste td.i-bleu { box-shadow: inset 4px 0 0 var(--label); }
.c-rouge { color: var(--txt-red) !important; font-weight: 500; }
.c-ambre { color: var(--txt-amber) !important; font-weight: 500; }
.cadenas { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--txt-amber); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--voile); color: var(--tf); font-size: 10px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; }
.badge.vert { background: rgba(var(--green-rgb), .11); border-color: rgba(var(--green-rgb), .2); color: var(--txt-green); }
.badge.rouge { background: rgba(var(--red-rgb), .12); border-color: rgba(var(--red-rgb), .28); color: var(--txt-red); }
.badge.ambre { background: rgba(var(--amber-rgb), .12); border-color: rgba(var(--amber-rgb), .28); color: var(--txt-amber); }
.badge.bleu { background: rgba(var(--blue-rgb), .14); border-color: rgba(var(--blue-rgb), .22); color: var(--label); }

/* ---------- Tableau de bord ---------- */
.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.carte { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--border);
  border-left: 3px solid var(--c); border-radius: 12px; }
.carte .ico { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px;
  background: rgba(var(--c-rgb), .13); color: var(--ct); }
.carte .val { font-family: var(--mono); font-size: 18px; font-weight: 500; line-height: 1.2; color: var(--ct); }
.carte .lib { font-size: 12px; font-weight: 600; color: var(--t1); }
.carte .sous { font-size: 11px; color: var(--t2); }
.carte.rouge { --c: var(--red); --ct: var(--txt-red); --c-rgb: var(--red-rgb); }
.carte.ambre { --c: var(--amber); --ct: var(--txt-amber); --c-rgb: var(--amber-rgb); }
.carte.bleu { --c: var(--blue); --ct: var(--label); --c-rgb: var(--blue-rgb); }
.carte.vert { --c: var(--green); --ct: var(--txt-green); --c-rgb: var(--green-rgb); }
.widget { margin-bottom: 16px; min-width: 0; background: var(--bg2); border: 2px solid rgba(var(--accent-rgb), .34); border-radius: 12px;
  box-shadow: 0 4px 20px var(--ombre); overflow: hidden; }
.widget > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 12px;
  background: var(--grad); border-bottom: 1px solid var(--border2); }
.widget > header h2 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .03em; color: #ffffff; }
.widget > header span { font-size: 11px; color: rgba(255,255,255,.82); }
.widget > header strong { color: #ffffff; }
.widget .corps { padding: 12px; }
.widget .liste th:first-child, .widget .liste td:first-child { padding-left: 14px; }
.duo { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.duo > .large { flex: 2 1 600px; margin-bottom: 0; }
.duo > .etroit { flex: 1 1 320px; margin-bottom: 0; }

.frise-defile { overflow-x: auto; }
.frise { min-width: 900px; }
.frise-axe { display: grid; grid-template-columns: 240px minmax(0, 1fr); padding-right: 24px; height: 34px; }
.frise-axe > div:first-child { position: sticky; left: 0; z-index: 3; background: var(--bg2); }
.frise-axe > div:last-child { position: relative; }
.frise-axe span { position: absolute; bottom: 8px; padding-left: 6px; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--t2); white-space: nowrap; }
.frise-axe span.auj { padding-left: 0; transform: translateX(-4px); font-weight: 700; color: var(--label); }
.frise-corps { position: relative; }
.frise-grille { position: absolute; top: 0; bottom: 0; left: 240px; right: 24px; pointer-events: none; }
.frise-grille span { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grille); }
.frise-grille span.auj { width: 2px; margin-left: -1px; background: var(--blue); opacity: .8; }
.frise-ligne { position: relative; display: grid; grid-template-columns: 240px minmax(0, 1fr); width: 100%; padding: 0 24px 0 0; border: 0;
  border-top: 1px solid var(--filet); background: none; color: var(--t1); text-align: left; cursor: pointer; }
.frise-ligne:hover .nom b { text-decoration: underline; }
.frise-ligne .nom { position: sticky; left: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; min-width: 0;
  padding: 7px 14px 7px 10px; background: var(--bg2); border-right: 1px solid var(--filet); }
.frise-ligne .nom b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frise-ligne .nom small { font-size: 11px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piste { position: relative; display: block; min-height: 46px; overflow: hidden; }
.piste > i { position: absolute; top: 50%; font-style: normal; }
.m-trait { height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--c); }
.m-trait.pointille { border-radius: 0; background: repeating-linear-gradient(90deg, var(--c) 0 6px, transparent 6px 10px); }
.m-hachure { height: 14px; margin-top: -7px; border-radius: 2px; background: repeating-linear-gradient(135deg, var(--hachure) 0 1.5px, transparent 1.5px 6px); }
.m-tic { width: 2px; height: 20px; margin: -10px 0 0 -1px; background: var(--sb-titre); }
.m-losange { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 2px; background: var(--c); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--fond, var(--bg2)); }
.m-carre { width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--c); box-shadow: 0 0 0 3px var(--fond, var(--bg2)); }
.m-rond { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 3px solid var(--c); background: var(--fond, var(--bg2)); }
.m-date { margin: -9px 0 0 12px; padding: 0 4px; line-height: 18px; background: var(--fond, var(--bg2)); font-family: var(--mono); font-size: 11px;
  font-weight: 500; color: var(--ct); white-space: nowrap; }
.m-date.gauche { margin-left: -12px; transform: translateX(-100%); }
.m-date.leger { margin-left: 8px; font-weight: 400; }
.m-echu { left: 10px; margin-top: -10px; }
.n-retard, .n-urgent { --c: var(--red); --ct: var(--txt-red); }
.n-proche { --c: var(--amber); --ct: var(--txt-amber); }
.n-tard, .n-info { --c: var(--neutre); --ct: var(--t2); }
.legende { list-style: none; margin: 12px 0 0; padding: 0 4px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 11px; color: var(--t2); }
.legende li { display: flex; align-items: center; gap: 8px; }
.legende .ex { position: relative; display: inline-block; width: 24px; height: 16px; flex: none; }
.legende .ex i { position: absolute; top: 50%; }
.legende .m-losange, .legende .m-carre, .legende .m-rond { left: 12px; box-shadow: none; }
.legende .m-rond { background: transparent; }
.legende .m-tic { left: 12px; height: 16px; margin-top: -8px; }
.legende .m-trait, .legende .m-hachure { left: 0; width: 24px; }
.barres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.barres li { display: grid; grid-template-columns: minmax(0, 150px) minmax(40px, 1fr) auto; align-items: center; gap: 10px; font-size: 12px; }
.barres .quoi { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barres .jauge { display: block; height: 8px; border-radius: 4px; background: var(--grille); }
.barres .jauge i { display: block; height: 8px; border-radius: 4px; background: var(--grad); }
.barres .combien { font-family: var(--mono); color: var(--txt-green); white-space: nowrap; }
.total { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; }
.total b { font-weight: 600; }
.total span { font-family: var(--mono); font-weight: 500; color: var(--txt-green); }

/* ---------- Fenêtres ----------
   Habillage repris de Budget-DSIN : en-tête en dégradé avec le logo, bandeau de synthèse,
   corps qui défile, pied fixe. Vaut pour toutes les fenêtres, formulaire ou non. */
.voile { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(5px); animation: voile-entre .15s ease; }
.fenetre { display: flex; flex-direction: column; width: 800px; max-width: 100%; max-height: 96vh; background: var(--bg1);
  border: 1px solid var(--border2); border-radius: 20px; box-shadow: 0 28px 72px var(--ombre-forte); overflow: hidden;
  animation: fenetre-entre .2s cubic-bezier(.4, 0, .2, 1); }
.fenetre.petite { width: 480px; }
.fenetre > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.fenetre header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px;
  background: var(--grad); border-bottom: 1px solid var(--border2); }
.fenetre header .tete { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fenetre header img { display: block; height: 20px; width: auto; flex-shrink: 0; }
/* Sceau Educo à droite du logo Eduservices, séparé par un filet comme dans la barre du haut. */
.fenetre header .trait { width: 1px; height: 24px; background: rgba(255,255,255,.45); flex-shrink: 0; }
.fenetre header img.sceau { width: 32px; height: 32px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.fenetre header h2 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; color: #ffffff; overflow-wrap: anywhere; }
.fenetre header p { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,.8); }
.fenetre header .fin { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.note-req { margin-right: 4px; font-size: 11px; color: var(--note-entete); white-space: nowrap; }
.note-req .ast { color: var(--ast-entete); font-weight: 700; }
.fermer { display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: rgba(255,255,255,.85);
  font-size: 20px; line-height: 1; cursor: pointer; transition: color .14s; }
.fermer:hover { color: #ffffff; }
.bandeau { flex-shrink: 0; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px 20px; background: var(--bg2);
  border-bottom: 1px solid var(--border); }
.bandeau .b-ref { font-family: var(--mono); font-size: 13px; color: var(--label); white-space: nowrap; }
.bandeau .b-qui { max-width: 34%; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600; color: var(--t1); white-space: nowrap; }
.bandeau .b-objet { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--t2); }
.bandeau .b-manque { font-size: 11px; color: var(--txt-amber); white-space: nowrap; }
.bandeau .b-manque.complet { color: var(--txt-green); }
.bandeau .b-montant { font-family: var(--mono); font-size: 14px; color: var(--t1); white-space: nowrap; }
.bandeau .b-etat { padding: 3px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0; border-radius: 999px; }
/* Fenêtres à onglets : ancrées en haut, pour que la barre d'onglets ne bouge pas d'un onglet à l'autre. */
.fenetre.a-onglets { align-self: flex-start; margin-top: 3vh; max-height: 92vh; }
.onglets-fenetre { flex-shrink: 0; display: flex; flex-wrap: wrap; padding: 4px 17px; border-bottom: 1.5px solid var(--border); }
.onglet-f { display: inline-flex; align-items: center; gap: 5px; margin: 4px 3px; padding: 5px 12px; border: 0; border-radius: 8px;
  background: var(--voile); color: var(--t2); font-size: 12px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s; }
.onglet-f:hover { background: var(--voile-survol); color: var(--t1); }
.onglet-f[aria-selected="true"] { background: var(--actif-fond); color: var(--actif-texte);
  box-shadow: 0 0 0 1.5px var(--blue), 0 3px 12px rgba(var(--blue-rgb), .3); }
.onglet-f.en-erreur, .onglet-f.en-erreur:hover { color: var(--txt-red); }
.compte-onglet { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--grille); color: var(--sb-titre);
  font-family: var(--mono); font-size: 10px; line-height: 16px; text-align: center; }
.bt-pastille { position: relative; display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--amber); }
.onglet-f.en-erreur .bt-pastille { background: var(--red); }
.panneau-onglet .etiquettes + .mini { margin-top: 16px; }
.panneau-onglet .etiquettes + .section { margin-top: 18px; }
.panneau-onglet .etiquettes + .grille { margin-top: 16px; }
.fenetre .contenu { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 24px; }
.fenetre footer { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  padding: 14px 24px; border-top: 1px solid var(--border); }
.fenetre footer p { flex: 1 1 240px; margin: 0; font-size: 11px; font-style: italic; color: var(--tf); }
.fenetre footer .groupe-btn { justify-content: flex-end; gap: 10px; margin-left: auto; }
/* Création sur une ligne, dernière modification sur la ligne suivante */
.fenetre footer p.trace { line-height: 1.6; }
.fenetre footer p.trace span { display: block; }
@keyframes voile-entre { from { opacity: 0; } }
@keyframes fenetre-entre { from { opacity: 0; transform: translateY(12px); } }

.section { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--label); }
.section::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, rgba(var(--blue-rgb), .3), transparent); }
.section:first-child { margin-top: 0; }
.grille { display: grid; gap: 10px; }
.grille + .grille, .contenu > .groupe + .grille, .contenu > .grille + .groupe { margin-top: 10px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.groupe { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.groupe > label, .groupe > .lib { font-size: 11px; font-weight: 500; color: var(--label); }
.groupe .req { color: #ff4d4d; }
:root[data-theme="clair"] .groupe .req { color: #dc2626; }
.champ, .valeur { display: block; width: 100%; min-height: 38px; padding: 0 10px; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--t1); font-size: 13px; }
select.champ { padding: 0 8px; background-color: var(--bg3); }
textarea.champ { padding: 8px 10px; min-height: 58px; line-height: 1.5; resize: vertical; }
.champ:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(var(--blue-rgb), .15); outline: none; }
.champ[aria-invalid="true"] { border-color: var(--red); }
.champ[readonly], .valeur { display: flex; align-items: center; background: var(--voile-champ); color: var(--tf); }
.valeur.calcule, .champ.calcule { background: var(--bg2); color: var(--t1); }
.valeur.texte { align-items: flex-start; padding: 8px 10px; white-space: pre-wrap; line-height: 1.5; }
.aide { font-size: 11px; color: var(--tf); }
.erreur-champ { font-size: 11px; font-weight: 500; color: var(--txt-red); }
.paire { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px; }
.paire.prix { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.pastilles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 8px; background: var(--bg3);
  border: 1px solid var(--border2); border-radius: 8px; }
.pastilles.lecture { background: var(--voile-champ); }
.pastilles[aria-invalid="true"] { border-color: var(--red); }
.pastilles select { height: 26px; max-width: 180px; padding: 0 6px; background-color: var(--bg2); border: 1px solid var(--border2); border-radius: 4px;
  color: var(--t2); font-size: 11px; }
.puce { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; background: rgba(var(--blue-rgb), .14);
  border: 1px solid rgba(var(--blue-rgb), .22); color: var(--label); font-size: 11px; font-weight: 600; white-space: nowrap; }
.puce button { width: 16px; height: 16px; margin-right: -5px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit;
  font-size: 13px; line-height: 1; cursor: pointer; }
.message { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0 0; padding: 10px 14px; border-radius: 8px;
  background: rgba(var(--blue-rgb), .08); border: 1px solid rgba(var(--blue-rgb), .3); color: var(--label); font-size: 12px; line-height: 1.5; }
.message.alerte { background: var(--alerte-fond); border-color: rgba(var(--amber-rgb), .3); color: var(--alerte-texte); }
.message.erreur { background: rgba(var(--red-rgb), .1); border-color: rgba(var(--red-rgb), .3); color: var(--txt-red); }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; }

.mini { position: relative; height: 64px; margin: 0 6px; --fond: var(--bg1); }
.mini > i { position: absolute; top: 34px; font-style: normal; }
.mini .base { left: 0; right: 0; height: 1px; background: var(--border2); }
.mini .ecoule { height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--filet); }
.mini .auj { top: 15px; width: 2px; height: 36px; margin-left: -1px; background: var(--blue); }
.mini .auj-txt { top: 0; transform: translateX(-50%); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  line-height: 12px; color: var(--label); white-space: nowrap; }
.mini .repere { top: 47px; font-family: var(--mono); font-size: 11px; line-height: 14px; color: var(--tf); white-space: nowrap; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0 0; }
.tuile { padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; }
.tuile dt { margin-bottom: 4px; font-size: 10px; color: var(--t2); }
.tuile dd { margin: 0; font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--t1); }
.tuile dd + dd { margin-top: 2px; font-family: inherit; font-size: 11px; font-weight: 400; color: var(--tf); }
.tuile.rouge { border-color: rgba(var(--red-rgb), .4); }
.tuile.rouge dd { color: var(--txt-red); }
.tuile.rouge dd + dd { font-weight: 600; }
.tuile.ambre dd { color: var(--txt-amber); }
.tuile.bleu dd:first-of-type { color: var(--label); }
.decision { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.decision > span { margin-right: 4px; font-size: 11px; font-weight: 500; color: var(--label); }
.texte-aide { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--t2); }
.documents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.documents li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; }
.documents li > svg { flex-shrink: 0; color: var(--txt-green); }
.documents .doc { flex: 1 1 240px; min-width: 0; }
.documents .doc b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--t1); overflow-wrap: anywhere; }
.documents .doc small { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: var(--tf); }
.documents .groupe-btn { gap: 6px; }
.depot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.depot select { height: 28px; padding: 0 6px; background-color: var(--bg3); border: 1px solid var(--border2); border-radius: 4px; color: var(--t1); font-size: 12px; }
/* Corbeille de Budget-DSIN : le pictogramme seul, sans fond ni bordure. */
.btn-corbeille { flex: 0 0 auto; padding: 2px 4px; border: 0; border-radius: 4px; background: none; font-size: 15px; line-height: 1; cursor: pointer; }
.btn-corbeille:hover { background: rgba(var(--red-rgb), .12); }
/* Désactiver ou réactiver une valeur : emoji seul, survol neutre. */
.btn-emoji { flex: 0 0 auto; padding: 2px 4px; border: 0; border-radius: 4px; background: none; font-size: 15px; line-height: 1; cursor: pointer; }
.btn-emoji:hover { background: var(--voile-survol); }
.liste td.actions .btn-emoji, .liste td.actions .btn-corbeille, .liste td.actions .place-ico { margin-left: 6px; vertical-align: middle; }
.place-ico { display: inline-block; width: 27px; }
/* Zone de dépôt de la saisie : bouton ou glisser-déposer ; cadre plein et teinté quand un fichier la survole. */
.depot-fichiers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 12px; background: var(--voile-champ);
  border: 1px dashed var(--border2); border-radius: 8px; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.depot-fichiers .glisser { font-size: 13px; color: var(--t2); }
.depot-fichiers .aide { margin-left: auto; }
.depot-fichiers.survol { border-style: solid; border-color: var(--blue); background: rgba(var(--blue-rgb), .1); box-shadow: 0 0 0 1px var(--blue); }
.depot-fichiers.survol > * { pointer-events: none; }     /* le survol reste sur la zone, sans clignoter d'un enfant à l'autre */
.btn[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.fichiers { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fichiers:empty { display: none; }
.fichiers li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 8px 6px 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; }
.fichiers li > svg { flex-shrink: 0; color: var(--txt-green); }
.fichiers .nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--t1); }
.fichiers .taille { font-family: var(--mono); font-size: 11px; color: var(--tf); white-space: nowrap; }
.fichiers select { height: 26px; padding: 0 6px; background-color: var(--bg3); border: 1px solid var(--border2); border-radius: 4px; color: var(--t1); font-size: 12px; }
.histo { list-style: none; margin: 0; padding: 0; }
.histo li { display: grid; grid-template-columns: 118px 120px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 12px; }
.histo li:first-child { border-top: 0; }
.histo .quand { font-family: var(--mono); font-size: 11px; color: var(--tf); }
.histo .qui { color: var(--t2); }

/* ---------- Administration ---------- */
.panneau { padding: 16px 18px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--border); }
.panneau h2 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.panneau > p { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: var(--t2); }
.panneaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; max-width: 960px; }
.reglage { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.reglage .groupe { flex: 0 0 auto; }
.reglage .champ { width: 130px; }
.largeur { max-width: 960px; }
.rangee { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; max-width: 960px; margin-top: 10px; }
.action { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--border);
  border-left: 3px solid var(--c); border-radius: 12px; color: var(--t1); text-align: left; cursor: pointer; }
.action:hover { border-color: var(--c); }
.action[disabled] { opacity: .5; cursor: not-allowed; }
.action .ico { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px;
  background: rgba(var(--c-rgb), .13); color: var(--ct); }
.action b { display: block; font-size: 13px; font-weight: 600; }
.action small { display: block; font-size: 11px; color: var(--t2); }
.action.bleu { --c: var(--blue); --ct: var(--blue); --c-rgb: var(--blue-rgb); }
.action.vert { --c: var(--green); --ct: var(--txt-green); --c-rgb: var(--green-rgb); }
.action.rouge { --c: var(--red); --ct: var(--txt-red); --c-rgb: var(--red-rgb); }
.action.ambre { --c: var(--amber); --ct: var(--txt-amber); --c-rgb: var(--amber-rgb); }
.refs { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.ref { min-width: 0; border: 1px solid var(--border2); border-radius: 16px; overflow: hidden; }
.ref.ouverte { grid-column: 1 / -1; }
.ref > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--bg3); }
.ref > header h2 { margin: 0; min-width: 0; font-size: 15px; font-weight: 700; }
.ref > header h2 button { display: flex; align-items: flex-start; gap: 8px; padding: 0; border: 0; background: none; color: var(--t1); font: inherit;
  text-align: left; cursor: pointer; }
.ref .fleche { display: inline-block; color: var(--label); font-size: 18px; line-height: 1.1; transform: rotate(-90deg); transition: transform .15s; }
.ref.ouverte .fleche { transform: none; }
.ref h2 small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--t2); }
.ref h2 .nb { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--tf); }
.ref .corps { padding: 16px 18px; overflow-x: auto; }
.ajout { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ajout .champ { flex: 1 1 200px; max-width: 320px; min-height: 32px; }
.presents { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.presents li { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12px; }
.presents li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.presents small { font-size: 11px; color: var(--tf); }
.sous-titre { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--t2); }
.etat { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.rapport { margin: 12px 0 0; padding: 0 0 0 18px; font-size: 12px; color: var(--t2); }
.rapport li { margin-bottom: 4px; }

/* ---------- Annonces ---------- */
#annonces { position: fixed; bottom: 24px; right: 24px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.annonce { padding: 12px 18px; border-radius: 12px; background: var(--bg2); border: 1px solid rgba(var(--green-rgb), .35); color: var(--txt-green);
  font-size: 13px; font-weight: 500; box-shadow: 0 8px 32px var(--ombre-forte); max-width: 380px; }
.annonce.erreur { border-color: rgba(var(--red-rgb), .35); color: var(--txt-red); }

/* ---------- Connexion : la page de garde du manuel, en version nuit ---------- */
/* Aplat bleu Eduservices de la charte, rosace guillochée, sceau à cheval sur la limite, mot « Educo » ; le bas de la page est sombre. */
.page-connexion { --marine: #001E34; --acier: #5A90AA; --acier-clair: #7FB1CA; --nuit: #050C14; --texte-nuit: #9FB0BD;
  --sceau: clamp(124px, 18.5vh, 220px);               /* diamètre du sceau : toute la composition s'en déduit, */
  --aplat: calc(var(--sceau) * 2.226);                /* dans les proportions de la page de garde (sceau de 62 mm, aplat de 138 mm) */
  padding: 0; background: var(--nuit); color: #ffffff; }
.connexion { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; padding: 0; overflow: hidden; text-align: center; }
/* Un halo bleu clair, derrière le sceau seulement, lui donne du relief. */
.connexion .aplat { align-self: stretch; flex: 0 0 var(--aplat); display: flex; justify-content: center; align-items: flex-start;
  background: radial-gradient(ellipse calc(var(--sceau) * 1.36) calc(var(--sceau) * .97) at 50% 100%, rgba(90,144,170,.36), rgba(90,144,170,0) 72%), var(--marine); }
.connexion .eduservices { display: block; width: calc(var(--sceau) * .71); height: auto; margin-top: calc(var(--sceau) * .274); }
/* Rosace centrée sur le sceau, tracée par le script de la page : blanche sur l'aplat, bleu acier dessous. */
.connexion .rosace { position: absolute; left: 50%; top: var(--aplat); width: calc(var(--sceau) * 3.226); height: calc(var(--sceau) * 3.226);
  transform: translate(-50%, -50%); pointer-events: none; }
.connexion .rosace .haut { stroke: #ffffff; stroke-opacity: .28; }
.connexion .rosace .bas { stroke: var(--acier-clair); stroke-opacity: .26; }
.connexion h1 { position: relative; display: flex; flex-direction: column; align-items: center; margin: calc(var(--sceau) / -2) 0 0; }
.connexion .sceau-educo { display: block; width: var(--sceau); height: var(--sceau);
  filter: drop-shadow(0 calc(var(--sceau) * .039) calc(var(--sceau) * .058) rgba(0,12,24,.45)) drop-shadow(0 2px 3px rgba(0,12,24,.38)); }
.connexion .mot-educo { display: block; width: calc(var(--sceau) * 1.065); height: auto; margin-top: calc(var(--sceau) * .185); fill: #ffffff; }
.connexion .surtitre { position: relative; margin: 20px 0 0; font-size: 13px; font-weight: 500; letter-spacing: .3em; text-indent: .3em;
  text-transform: uppercase; color: var(--acier-clair); }
.connexion .surtitre::after { content: ''; display: block; width: 60px; height: 2px; margin: 15px auto 0; border-radius: 2px; background: var(--acier); }
.connexion .descriptif { position: relative; margin: 12px 0 0; font-size: 14.5px; color: var(--texte-nuit); }
.connexion .acces { position: relative; width: 340px; max-width: calc(100% - 48px); margin-top: 30px; }
.connexion .message { margin: 0 0 16px; text-align: left; }
.connexion .btn { width: 100%; min-height: 44px; padding: 10px 16px; font-size: 14px; }
.connexion .btn-principal { background: #ffffff; color: var(--marine); font-weight: 600; box-shadow: 0 8px 26px rgba(0,0,0,.5); transition: background .15s; }
.connexion .btn-principal:hover { filter: none; background: #DBE7EE; color: var(--marine); }
.connexion :focus-visible { outline-color: var(--acier-clair); }
.connexion form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.connexion .groupe > label { color: var(--texte-nuit); }
.connexion .champ:focus { border-color: var(--acier); box-shadow: 0 0 0 3px rgba(90,144,170,.25); }
.connexion .ou { margin: 16px 0; font-size: 11px; color: var(--texte-nuit); }
.connexion small { display: block; margin-top: 12px; font-size: 11px; color: var(--texte-nuit); }
.connexion .pied { position: relative; margin-top: auto; padding: 26px 24px 22px; font-size: 12.5px; color: var(--texte-nuit); }
.connexion .pied small { margin-top: 3px; color: var(--acier-clair); }
.connexion::after { content: ''; align-self: stretch; flex: 0 0 4px; background: var(--acier); }      /* liseré du bas */

/* ---------- v20 : finalité, fiche incomplète, rattachement, cocontractant ---------- */
.liste td.nom-contrat { min-width: 240px; max-width: 340px; white-space: normal; }
.finalite { display: block; margin-top: 3px; font-size: 11px; font-weight: 400; line-height: 1.35; color: var(--t2); }
.finalite.manquante { color: var(--txt-amber); font-style: italic; }
.indic { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 6px; border-radius: 5px;
  vertical-align: -4px; background: var(--voile-survol); color: var(--t2); }
.indic.ambre { background: rgba(var(--amber-rgb), .18); color: var(--txt-amber); }
.note .indic, .note svg { vertical-align: -2px; }
.lien-coco, .lien-fiche { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border2); text-underline-offset: 3px; }
.lien-coco:hover, .lien-fiche:hover { color: var(--label); text-decoration-color: currentColor; }
.lien-fiche { color: var(--label); }
.barres .quoi .lien-coco { text-decoration: none; }
.bandeau .b-qui .lien-coco { font-weight: 600; color: var(--t1); }
.bandeau .b-manque svg { vertical-align: -2px; }
.finalite-fiche { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 20px 10px; background: var(--bg2);
  border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.45; color: var(--t1); }
.finalite-fiche > .lib { font-size: 11px; font-weight: 500; color: var(--label); }
.finalite-fiche > span:not(.lib) { flex: 1 1 300px; min-width: 0; }
.cadre-fiche { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.liste tfoot td { background: var(--bg3); border-top: 2px solid var(--border2); border-bottom: 0; font-weight: 600; color: var(--t1); }
.liste tfoot tr + tr td { border-top: 1px solid var(--border); font-weight: 400; color: var(--t2); }
.aide-ligne { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
/* Validation des fiches (§ 3.8) */
.bloc-validation { margin-bottom: 18px; padding: 16px 18px; border: 1px solid var(--filet); border-radius: 12px; background: var(--bg2); }
.bloc-validation p { margin: 8px 0 0; color: var(--t1); }
.tete-validation { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.tete-validation .section { margin: 0; }
.etapes-validation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; padding: 0; list-style: none; }
.etapes-validation li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--t2); }
.etapes-validation li + li::before { content: ''; width: 24px; height: 2px; margin-right: 2px; background: var(--border); }
.etapes-validation .rond { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--border2); font-size: 12px; font-weight: 700; }
.etapes-validation .faite .rond { border-color: var(--green); background: rgba(var(--green-rgb), .16); color: var(--txt-green); }
.etapes-validation .courante { color: var(--t1); font-weight: 600; }
.etapes-validation .courante .rond { border-color: var(--blue); background: rgba(var(--blue-rgb), .2); color: var(--label); }
.validation-action { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 8px; }
.validation-action p { flex: 1 1 380px; margin: 0; }
.bloc-validation .groupe-btn { margin-top: 12px; }
.zone-renvoi { margin-top: 12px; }
.zone-renvoi label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--label); }
.message.attention { color: var(--txt-amber); }
/* Fil d'échanges */
.fil { display: flex; flex-direction: column; gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }
.fil .message { display: flex; gap: 12px; }
.fil .initiales { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg4); color: var(--label); font-size: 12px; font-weight: 700; }
.fil .bulle { flex: 1; min-width: 0; padding: 9px 13px; border: 1px solid var(--filet); border-radius: 10px; background: var(--bg2); }
.fil .tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.fil time { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--tf); }
.fil .bulle p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fil .evenement { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-left: 44px; font-size: 12.5px; color: var(--t2); }
.fil .evenement svg { color: var(--txt-green); }
.fil .evenement time { margin-left: 0; }
.mention { padding: 0 4px; border-radius: 4px; background: rgba(var(--blue-rgb), .16); color: var(--label); font-weight: 600; }
.fil-saisie { position: relative; padding-left: 44px; }
.fil-saisie > label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--label); }
.fil-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 10px; }
.fil-pied .texte-aide { flex: 1 1 360px; margin: 0; }
.mentions { max-width: 380px; margin: 6px 0 0; padding: 6px; list-style: none; border: 1px solid var(--border); border-radius: 10px; background: var(--bg3);
  box-shadow: 0 10px 30px var(--ombre-forte); }
.mentions button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 40px; padding: 5px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--t1); text-align: left; cursor: pointer; }
.mentions button:hover, .mentions button:focus-visible { background: var(--voile-survol); }
.mentions small { color: var(--t2); }
.case-valideur { display: flex; align-items: center; gap: 10px; font-weight: 600; }
/* Pastille de notifications */
.notifs { position: relative; }
.cloche { position: relative; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg2); color: var(--t1); cursor: pointer; }
.cloche:hover { background: var(--voile-survol); }
.cloche .compteur { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #11141e; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.panneau-notifs { position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; width: min(440px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 14px; background: var(--bg3); box-shadow: 0 18px 48px var(--ombre-forte); }
.tete-notifs { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--filet); }
.tete-notifs h2 { flex: 1; margin: 0; font-size: 15px; }
.panneau-notifs ul { margin: 0; padding: 6px; list-style: none; }
.notif { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 10px 10px 22px; border: 0; border-radius: 8px; background: none;
  color: var(--t1); text-align: left; cursor: pointer; position: relative; }
.notif:hover, .notif:focus-visible { background: var(--voile-survol); }
.notif.non-lue { background: rgba(var(--blue-rgb), .10); }
.notif.non-lue::before { content: ''; position: absolute; left: 8px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.notif .type { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--label); }
.notif .type-a_valider, .notif .type-renvoyee { color: var(--txt-amber); }
.notif .type-validee { color: var(--txt-green); }
.notif.non-lue .titre { font-weight: 600; }
.notif .detail { font-size: 12.5px; color: var(--t2); }
.notif time { font-family: var(--mono); font-size: 11.5px; color: var(--tf); }
.vide-notifs { margin: 0; padding: 18px 14px; color: var(--t2); }
.pied-notifs { margin: 0; padding: 10px 14px; border-top: 1px solid var(--filet); font-size: 12px; color: var(--tf); }
/* Administration › Courriels */
.intro-courriels { margin: -6px 0 16px; color: var(--t2); }
.courriels { display: flex; flex-direction: column; gap: 18px; max-width: 1180px; }
.courriels .grille { margin: 0; }
.cartes-courriels { gap: 18px; align-items: stretch; }
.courriels .panneau .texte-aide { margin: 10px 0 0; }
.etat-mode { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); }
.etat-mode b { color: var(--t1); }
.etat-mode span { color: var(--t2); }
.etat-mode.attention { border-color: rgba(var(--amber-rgb), .4); background: rgba(var(--amber-rgb), .10); }
.etat-mode.attention b { color: var(--txt-amber); }
.etat-mode.info { border-color: rgba(var(--blue-rgb), .4); background: rgba(var(--blue-rgb), .08); }
.etat-mode.erreur { border-color: rgba(var(--red-rgb), .45); background: rgba(var(--red-rgb), .10); }
.etat-mode.erreur b { color: var(--txt-red); }
.courriels .liste small.bloc, .courriels small.bloc { display: block; margin-top: 2px; font-size: 11.5px; }
.courriels .liste .centre { text-align: center; }
.case-envoi { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }
.ajout-copie { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.ajout-copie .champ { flex: 1 1 200px; width: auto; }
.jalons { display: flex; flex-wrap: wrap; gap: 8px; }
.choix-jalon { min-height: 32px; padding: 4px 13px; border: 1px solid var(--border2); border-radius: 20px; background: transparent; color: var(--t2);
  font-size: 12.5px; cursor: pointer; }
.choix-jalon[aria-pressed="true"] { border-color: rgba(var(--blue-rgb), .55); background: rgba(var(--blue-rgb), .16); color: var(--label); font-weight: 600; }
.choix-jalon.autre { border-style: dashed; color: var(--tf); }
.heure-envoi { margin-top: 14px; max-width: 240px; }
.apercu-jalons { margin: 12px 0 0 !important; padding: 9px 12px; border-radius: 8px; background: var(--voile); color: var(--t1) !important; }
.enregistrer-courriels { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.resultat-essai { margin: 10px 0 0 !important; }
.resultat-essai.vert { color: var(--txt-green) !important; }
.resultat-essai.ambre { color: var(--txt-amber) !important; }
.resultat-essai.rouge { color: var(--txt-red) !important; }
.apercu-courriels { border-color: rgba(var(--blue-rgb), .45); }
.apercu-courriels ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.apercu-courriels small { display: block; color: var(--t2); }
.titre-histo { margin: 8px 0 0; font-size: 16px; }
.compteur-car { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--tf); }
.compteur-car.a-saisir { color: var(--txt-red); }   /* pas « .vide » : la classe des messages de liste vide (36 px de marge) */
.compteur-car.limite { color: var(--txt-amber); }
.resultats { margin: 4px 0 0; padding: 4px; list-style: none; background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px;
  max-height: 210px; overflow-y: auto; }
.resultats button { display: flex; flex-direction: column; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none;
  color: var(--t1); font-size: 13px; text-align: left; cursor: pointer; }
.resultats button:hover, .resultats button:focus-visible { background: var(--voile-survol); }
.resultats small { font-size: 11px; color: var(--tf); }
.resultats .aucun { padding: 6px 8px; font-size: 12px; color: var(--tf); }
.resultats .fermee { color: var(--txt-red); font-weight: 600; }
.resultats-ajout { max-width: 720px; margin: -4px 0 12px; }
.avec-bouton { display: flex; align-items: center; gap: 6px; }
.avec-bouton .champ { flex: 1; min-width: 0; }
#zone-parent .puce { max-width: 100%; white-space: normal; }

/* ---------- v21 : clauses sensibles, bandeau d'alerte, calendrier ---------- */
.p-violet { background: rgba(var(--violet-rgb), .16); color: var(--violet); }
.indic.rouge { background: rgba(var(--red-rgb), .14); color: var(--txt-red); }
.indic + .indic { margin-left: 3px; }
.alerte-clauses { flex-shrink: 0; display: flex; gap: 10px; padding: 9px 20px; background: var(--alerte-fond); border-bottom: 1px solid rgba(var(--amber-rgb), .35);
  color: var(--alerte-texte); font-size: 12px; line-height: 1.45; }
.alerte-clauses.eleve { background: rgba(var(--red-rgb), .09); border-bottom-color: rgba(var(--red-rgb), .35); color: var(--txt-red); }
.alerte-clauses > svg { flex: none; margin-top: 1px; }
.alerte-clauses > div { flex: 1; min-width: 0; }
.alerte-clauses ul { margin: 3px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; color: var(--t1); }
.alerte-clauses li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alerte-clauses .btn-lien { padding: 0; font-size: 12px; }
.table-clauses td { vertical-align: top; }
.table-clauses td.description { min-width: 230px; line-height: 1.45; }
.table-clauses small { display: block; margin-top: 3px; font-size: 10.5px; color: var(--tf); }
.table-clauses small.alertes, .agenda small.alertes { color: var(--violet); }
.m-clause { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px var(--fond, var(--bg2)); }
.m-clause.n-retard { background: var(--red); }
.legende .m-clause { left: 12px; box-shadow: none; }
.clauses-saisie { display: flex; flex-direction: column; gap: 14px; }
.clause-carte { padding: 12px 14px 14px; background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border2)); border-radius: 10px; }
.clause-carte.r-faible { --c: var(--green); } .clause-carte.r-modere { --c: var(--amber); } .clause-carte.r-eleve { --c: var(--red); }
.clause-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--t1); }
.clause-tete .btn-retirer { margin-left: auto; }
.cal-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.cal-tete h2 { margin: 0 6px; min-width: 150px; font-size: 16px; font-weight: 600; }
.cal-defile { overflow-x: auto; background: var(--bg1); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 28px var(--ombre); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr)); min-width: 720px; }
.cal .jsem { padding: 8px; background: var(--bg3); border-bottom: 2px solid var(--border2); font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--thead); }
.cal .jour { display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 106px; padding: 6px; border-right: 1px solid var(--filet); border-bottom: 1px solid var(--filet); }
.cal .jour:nth-child(7n) { border-right: 0; }
.cal .jour.we { background: var(--voile-champ); }
.cal .jour.hors .num { opacity: .4; }
.cal .num { align-self: flex-start; font-family: var(--mono); font-size: 11px; line-height: 22px; color: var(--tf); font-variant-numeric: tabular-nums; }
.cal .jour.auj .num { display: inline-flex; justify-content: center; width: 22px; border-radius: 50%; background: var(--blue); color: #ffffff; font-weight: 600; }
.evt { display: block; width: 100%; padding: 2px 6px; border: 0; border-left: 3px solid var(--c); border-radius: 4px; background: rgba(var(--c-rgb), .13);
  color: var(--t1); font-size: 11px; line-height: 1.35; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.evt:hover { background: rgba(var(--c-rgb), .24); }
.evt.retard { box-shadow: inset 0 0 0 1px var(--red); }
.cal .plus { font-size: 10px; color: var(--tf); }
.t-preavis { --c: var(--red); --c-rgb: var(--red-rgb); }
.t-fin { --c: var(--blue); --c-rgb: var(--blue-rgb); }
.t-action { --c: var(--violet); --c-rgb: var(--violet-rgb); }
.t-seuil { --c: var(--amber); --c-rgb: var(--amber-rgb); }
.carre-type { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--c); }
.choix .carre-type { margin-right: 6px; vertical-align: -1px; }
.choix[aria-pressed="true"] .carre-type { box-shadow: 0 0 0 1.5px #ffffff; }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 12px; }
.agenda li:first-child { border-top: 0; }
.agenda .quand { font-family: var(--mono); font-size: 11px; color: var(--t2); }
.agenda .quoi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agenda .quoi b { display: flex; align-items: center; gap: 7px; font-weight: 500; color: var(--t1); }
.agenda .quoi small { color: var(--tf); }
.lien-ics { display: flex; gap: 8px; }
.lien-ics .champ { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
.etapes-ol { margin: 12px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.6; color: var(--t2); }

@media (max-width: 720px) {
  .barre, .bande { padding-left: 16px; padding-right: 16px; }
  main { padding: 16px 16px 40px; }
  .barre-droite { margin-left: 0; }
  .histo li { grid-template-columns: 1fr; gap: 2px; }
  .voile { padding: 0; }
  .fenetre { border-radius: 0; width: 100%; height: 100vh; max-height: 100vh; }
  .fenetre.a-onglets { margin-top: 0; max-height: 100vh; }
  .bandeau .b-objet { display: none; }
  .bandeau .b-qui { flex: 1; max-width: none; }
  .finalite-fiche, .alerte-clauses { padding-left: 16px; padding-right: 16px; }
  .alerte-clauses li { white-space: normal; }
  .agenda li { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
