/* =========================================================================
   SIGEC · Composants d'interface — Design System premium
   ========================================================================= */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap");

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  color: var(--ink-900);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5 { font-family: var(--font-title); font-weight: 700; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { transition: width .18s ease; }

/* ---------- Sidebar — « étoffe officielle » ----------
   Vert forêt quasi-noir texturé façon tissage (--weave), fil tricolore
   vertical cousu sur la tranche droite, marqueurs kente (losanges) pour
   la navigation. Sérieux d'un document d'État, matière d'un textile. */
.sidebar {
  background: var(--weave), linear-gradient(178deg, var(--green-700), var(--green-800) 45%, var(--green-900) 100%);
  color: #eaf3ee; display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh;
}
.sidebar::after { /* fil tricolore cousu sur la tranche */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom,
    var(--bj-green) 0 34%, var(--bj-yellow) 34% 67%, var(--bj-red) 67% 100%);
  box-shadow: -1px 0 0 rgba(0,0,0,.28); /* sépare le segment vert du fond vert */
}
.sidebar__brand { display: flex; gap: 14px; align-items: center; padding: 22px 16px 18px; }
.sidebar__nom { min-width: 0; flex: 1; }
.sidebar__replier { flex: none; width: 28px; height: 28px; display: grid;
  place-items: center; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: #cfe3d7; transition: background .15s, color .15s, transform .2s; }
.sidebar__replier:hover { background: rgba(255,255,255,.18); color: #fff; }
.sidebar__replier .icon { transform: rotate(180deg); transition: transform .2s; }
/* Le logo est un sceau qui porte déjà son propre anneau et son disque clair :
   le porte-logo ne pose donc ni fond, ni rotation, ni bordure — il réserve la
   place, rien de plus. Toute décoration ajoutée entrerait en concurrence avec
   l'anneau du sceau. */
.sidebar__seal {
  width: 44px; height: 44px; flex: none; position: relative;
  display: grid; place-items: center;
}
.sidebar__seal img, .auth__seal img { display: block; width: 100%; height: 100%; }
.sidebar__brand .sidebar__seal { margin: 2px 8px 2px 0; }
.sidebar__brand b {
  font-family: var(--font-title); font-weight: 800; font-size: 16px;
  display: block; line-height: 1.15; letter-spacing: .01em; color: #fff;
}
.sidebar__brand span { font-size: 11px; color: #d6ebdd; display: block; margin-top: 3px; }
.nav { padding: 4px 14px 8px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav__group {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 6px 8px; font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: #ffd75e; font-weight: 700;
}
.nav__group::after { content: ""; flex: 1; height: 1px;
  background: linear-gradient(to right, rgba(255,190,0,.28), transparent); }
.nav__item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; color: #cfe3d7; font-weight: 500; font-size: 13.5px;
  margin: 2px 0; cursor: pointer; position: relative;
  transition: background .15s, color .15s, padding-left .15s;
}
.nav__item .ic { width: 18px; height: 18px; flex: none; display: grid; place-items: center; opacity: .8; transition: opacity .15s; }
.nav__item:hover { background: rgba(255,255,255,.07); color: #fff; padding-left: 15px; }
.nav__item:hover .ic { opacity: 1; }
.nav__item:focus-visible { outline: 2px solid var(--yellow-500); outline-offset: 2px; }
.nav__item.is-active {
  background: linear-gradient(90deg, rgba(255,190,0,.16), rgba(255,190,0,.05));
  color: #ffd75e; font-weight: 600;
}
.nav__item.is-active .ic { opacity: 1; color: var(--yellow-500); }
.nav__item.is-active::before { /* marqueur kente : losange cousu */
  content: ""; position: absolute; left: -8px; width: 7px; height: 7px;
  background: var(--yellow-500); transform: rotate(45deg); border-radius: 1px;
  box-shadow: 0 0 8px rgba(255,190,0,.55);
}
.nav__badge { margin-left: auto; background: var(--red-500); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: var(--r-full); padding: 1px 7px; }

/* Entrée de nav avec sous-options.
   « Génération du PDC » et « Suivi du PDC » s'écrivaient de la même taille, à
   la même place et dans la même couleur que leur parent : rien ne disait
   qu'ils étaient dessous. Les enfants pendent maintenant à un rail vertical,
   chacun accroché par une puce, en graisse plus légère — et le parent se
   marque discrètement quand sa branche est ouverte. */
.nav__parent { display: flex; align-items: center; gap: 2px; }
.nav__item--parent { flex: 1; min-width: 0; }
.nav__parent.is-deplie .nav__item--parent { color: #fff; }
.nav__parent.is-deplie .nav__item--parent .ic { opacity: 1; }
.nav__chevron {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center;
  background: none; border: none; color: #9fc2ab; cursor: pointer; border-radius: 6px;
  transition: transform .15s, color .15s, background .15s;
}
.nav__chevron:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav__chevron.is-open { transform: rotate(90deg); color: #ffd75e; }

.nav__children { display: none; position: relative; margin: 2px 0 6px 21px;
  padding-left: 14px; }
.nav__children.is-open { display: block; }
/* Le rail : c'est lui qui dit « ceci pend à l'entrée du dessus ». */
.nav__children::before { content: ""; position: absolute; left: 0; top: 4px;
  bottom: 10px; width: 1px; background: rgba(255,255,255,.16); }
.nav__item--child { font-size: 12.5px; font-weight: 400; padding: 7px 10px;
  color: #a8c6b4; gap: 9px; }
.nav__item--child:hover { padding-left: 12px; color: #fff; }
.nav__puce { flex: none; width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,.28); margin-left: -17px; margin-right: 3px;
  transition: background .15s, box-shadow .15s; }
.nav__item--child:hover .nav__puce { background: rgba(255,255,255,.6); }
.nav__item--child.is-active { color: #ffd75e; font-weight: 600;
  background: linear-gradient(90deg, rgba(255,190,0,.13), transparent 85%); }
.nav__item--child.is-active .nav__puce { background: var(--yellow-500);
  box-shadow: 0 0 0 3px rgba(255,190,0,.18); }
/* L'enfant actif n'a pas besoin du losange du parent : la puce le dit deja. */
.nav__item--child.is-active::before { display: none; }
/* ---------- Le rail : la barre repliée en icônes ----------
   Deux cent soixante-quatre pixels de navigation permanente, c'est un
   cinquième de la largeur pris à un tableau de suivi qui compte quatorze
   colonnes. Repliée, la barre garde ses icônes et rend le reste. */
body.nav-rail { --sidebar-w: 72px; }
body.nav-rail .sidebar__brand { padding: 22px 0 18px; justify-content: center; }
body.nav-rail .sidebar__nom,
body.nav-rail .nav__lib,
body.nav-rail .nav__chevron,
body.nav-rail .nav__children,
body.nav-rail .sidebar__foot { display: none; }
/* Le bouton de dépli reste EN FLUX sous le sceau : posé en absolu il se
   confondait avec l'étoffe, et une barre qu'on ne sait pas rouvrir est une
   barre perdue. */
body.nav-rail .sidebar__brand { flex-direction: column; gap: 12px; padding: 18px 0 16px; }
body.nav-rail .sidebar__seal { width: 44px; height: 44px; }
body.nav-rail .sidebar__replier { width: 32px; height: 32px;
  background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }
body.nav-rail .sidebar__replier .icon { transform: rotate(0deg); }
body.nav-rail .nav { padding: 4px 10px 8px; }
body.nav-rail .nav__item { justify-content: center; padding: 11px 0; gap: 0;
  margin: 3px 0; }
body.nav-rail .nav__item:hover { padding-left: 0; background: rgba(255,255,255,.12); }
body.nav-rail .nav__item .ic { width: 20px; height: 20px; opacity: .95; }
/* Le losange cousu sortait du rail : replié, l'élément actif se marque par
   son fond et sa couleur, comme partout ailleurs dans l'application. */
body.nav-rail .nav__item.is-active::before { display: none; }
body.nav-rail .nav__item.is-active { background: rgba(255,190,0,.18); }
body.nav-rail .nav__parent.is-deplie .nav__item--parent { background: rgba(255,255,255,.06); }
body.nav-rail .nav__parent { display: block; }
/* Les intitulés de groupe deviennent un simple trait : le mot ne tient pas,
   mais la coupure entre Pilotage et Planification, elle, doit rester. */
body.nav-rail .nav__group { font-size: 0; margin: 14px 8px 10px; gap: 0; }
body.nav-rail .nav__group::after { background: rgba(255,190,0,.3); }

/* L'infobulle du rail, posée par le shell : un `title` natif met une seconde
   à paraître, et une infobulle en CSS serait rognée par le défilement. */
.nav__bulle { position: fixed; z-index: 200; transform: translateY(-50%);
  padding: 6px 11px; border-radius: 8px; pointer-events: none;
  background: var(--green-950, #0f1b14); color: #fff; font-size: 12.5px;
  font-weight: 500; white-space: nowrap; box-shadow: var(--sh-3, 0 8px 24px rgba(0,0,0,.3)); }
.nav__bulle[hidden] { display: none; }

.sidebar__foot {
  padding: 14px 18px; font-size: 10.5px; color: #b7d2c2; letter-spacing: .04em;
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.18);
}

/* ---------- Header — barre de protocole ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.header {
  height: var(--header-h); background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(15,27,20,.02), 0 6px 18px -14px rgba(15,27,20,.25);
}
.header > div:not(.search):not(.commune-badge) { min-width: 0; }
/* Le bloc titre absorbe l'espace disponible, sans jamais s'écraser sous 170px */
.header > div:first-of-type { flex: 1 1 auto; min-width: 170px; }
.header .commune-badge, .header .icon-btn { flex: none; }
.header__user { display: flex; align-items: center; gap: 10px; flex: none; }
.header__user-meta { line-height: 1.15; white-space: nowrap; }
/* Largeurs intermédiaires : on sacrifie les libellés secondaires, jamais le titre */
@media (max-width: 1280px) {
  .header__user-meta { display: none; }
  .header .commune-badge span { display: none; }
}
.header h1 {
  font-size: 17px; font-weight: 800; letter-spacing: -.01em; position: relative;
  padding-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header h1::after { /* soulignement tricolore du titre de page */
  content: ""; position: absolute; left: 0; bottom: -2px; height: 3px; width: 44px;
  border-radius: 2px;
  background: linear-gradient(to right,
    var(--bj-green) 0 50%, var(--bj-yellow) 50% 80%, var(--bj-red) 80% 100%);
}
.header__sub { color: var(--ink-500); font-size: 12.5px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search {
  margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-full); padding: 8px 14px;
  width: clamp(150px, 20vw, 280px); flex: none;
  color: var(--ink-400); transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within { border-color: var(--green-600); background: #fff;
  box-shadow: 0 0 0 3px var(--green-100); color: var(--green-700); }
.search input { border: none; background: none; outline: none; font-size: 13px; width: 100%; color: var(--ink-900); }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r-full); border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; position: relative;
  color: var(--ink-700); transition: border-color .15s, background .15s, color .15s; }
.icon-btn:hover { border-color: var(--green-600); color: var(--green-700); background: var(--green-50); }
/* Pastille de la cloche : simple point quand vide, compteur lisible dès qu'un
   nombre de rappels y est écrit (shell.js::majCloche). */
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 8px; height: 8px;
  background: var(--red-500); border-radius: var(--r-full); border: 2px solid #fff;
  font-size: 10px; font-weight: 700; line-height: 1; color: #fff;
  display: grid; place-items: center; }
.icon-btn .dot:not(:empty) { min-width: 17px; height: 17px; padding: 0 4px; }
.avatar {
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: var(--green-800); color: var(--yellow-500);
  display: grid; place-items: center; font-weight: 800; font-family: var(--font-title);
  font-size: 13px; position: relative;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--green-100);
}

/* ---------- Content ---------- */
.content { padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { font-size: var(--fs-2xl); }
.page-head p { color: var(--ink-500); margin-top: 2px; }
.breadcrumb { color: var(--ink-400); font-size: 12.5px; margin-bottom: 6px; }
/* Un maillon cliquable du fil d'Ariane doit se voir : en héritant du gris du
   fil, il était indistinguable du texte mort — on cherchait un bouton qui
   semblait ne pas exister. */
.breadcrumb a { color: var(--green-700); font-weight: 600; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb a:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; border-radius: 3px; }

/* ---------- Grid & cards ---------- */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); overflow: hidden; }
/* La carte de la barre d'actions contient un menu déroulant en position
   absolute (« Plus d'actions ») : overflow:hidden le découperait. */
.card--actionbar { overflow: visible; }
.card__body { padding: 20px; }
.card__head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; }
.card__head h3 { font-size: 15px; }

/* KPI — grands chiffres éditoriaux, colonne vertébrale colorée */
.kpi { position: relative; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  border-radius: 0 3px 3px 0; background: var(--primary); }
.kpi--yellow::before { background: var(--yellow-500); }
.kpi--red::before { background: var(--red-500); }
.kpi--black::before { background: var(--ink-900); }
.kpi__label { color: var(--ink-500); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.kpi__value { font-family: var(--font-title); font-size: 36px; font-weight: 900; letter-spacing: -.02em;
  margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.kpi--red .kpi__value { color: var(--red-600); }
.kpi__delta { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta.up { color: var(--green-600); } .kpi__delta.down { color: var(--red-500); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-full); }
.badge--green { background: var(--green-100); color: var(--green-800); }
.badge--yellow { background: var(--yellow-100); color: #8a6d00; }
.badge--red { background: var(--red-100); color: var(--red-600); }
.badge--grey { background: var(--surface-2); color: var(--ink-500); }
.badge--blue { background: color-mix(in srgb, #1e6fb8 14%, #fff); color: #1a5c9c; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; border: none;
  border-radius: var(--r-sm); padding: 10px 18px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 8px; transition: transform .05s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--sh-1); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--yellow { background: var(--yellow-500); color: var(--green-900); }
.btn--ghost { background: var(--surface); color: var(--ink-700); border: 1px solid var(--line); }
.btn--danger { background: var(--red-500); color: #fff; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-500)); border-radius: var(--r-full); }
.progress__bar.warn { background: linear-gradient(90deg, var(--yellow-600), var(--yellow-500)); }
.progress__bar.danger { background: linear-gradient(90deg, var(--red-600), var(--red-500)); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--ink-500); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table tr:hover td { background: var(--surface-2); }
.table__name { font-weight: 600; }

/* ---------- Authentification — étoffe officielle ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth__aside {
  position: relative; color: #fff; padding: 52px 56px;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background: var(--weave), linear-gradient(155deg, var(--green-700), var(--green-800) 48%, var(--green-900) 100%);
}
.auth__aside::before { /* halo doré discret */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(640px 420px at 82% 8%, rgba(255,190,0,.14), transparent 62%);
}
.auth__aside::after { /* fil tricolore cousu sur la tranche droite */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom,
    var(--bj-green) 0 34%, var(--bj-yellow) 34% 67%, var(--bj-red) 67% 100%);
  box-shadow: -1px 0 0 rgba(0,0,0,.28);
}
.auth__brand { position: relative; z-index: 1; display: flex; gap: 18px; align-items: center; }
.auth__seal {
  width: 76px; height: 76px; flex: none; position: relative;
  display: grid; place-items: center; font-family: var(--font-title);
  font-weight: 900; font-size: 19px; line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.28));
}
.auth__seal > span { display: block; width: 100%; height: 100%; }
.auth__brand b { font-family: var(--font-title); font-weight: 800; font-size: 19px; letter-spacing: .01em; }
.auth__brand-sub { font-size: 12px; color: #d6ebdd; margin-top: 3px; }
.auth__pitch { position: relative; z-index: 1; }
.auth__kicker {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: #ffd75e;
}
.auth__kicker::before { content: ""; width: 7px; height: 7px; background: var(--yellow-500);
  transform: rotate(45deg); border-radius: 1px; }
.auth__pitch h1 {
  font-family: var(--font-title); font-weight: 900; font-size: clamp(28px, 3vw, 38px);
  line-height: 1.12; letter-spacing: -.02em; margin-bottom: 18px;
}
.auth__pitch h1 span { color: var(--yellow-500); }
.auth__pitch p { color: #c8ddd0; font-size: 15px; max-width: 46ch; line-height: 1.6; }
.auth__points { list-style: none; margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.auth__points li { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: #dcebe2; }
.auth__points li .icon { color: var(--yellow-500); flex: none; }
.auth__foot { position: relative; z-index: 1; font-size: 11.5px; color: #b7d2c2; letter-spacing: .03em; }

.auth__form-wrap { display: grid; place-items: center; padding: 40px; }
.auth__form { width: 100%; max-width: 420px; }
.auth__tabs {
  display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-full); padding: 4px; margin-bottom: 28px;
}
.auth__tab {
  flex: 1; border: none; background: none; padding: 9px 12px; cursor: pointer;
  border-radius: var(--r-full); font-size: 13px; font-weight: 600; color: var(--ink-500);
  font-family: var(--font-body); transition: background .15s, color .15s, box-shadow .15s;
}
.auth__tab:hover { color: var(--ink-900); }
.auth__tab.is-active { background: var(--green-700); color: #ffd75e; box-shadow: var(--sh-1); }
.auth__tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.auth__title {
  font-size: 26px; font-weight: 800; position: relative; padding-bottom: 6px; display: inline-block;
}
.auth__title::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 52px; border-radius: 2px;
  background: linear-gradient(to right,
    var(--bj-green) 0 50%, var(--bj-yellow) 50% 80%, var(--bj-red) 80% 100%);
}
.auth__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth__submit { width: 100%; justify-content: center; padding: 13px; margin-top: 8px; }
.auth__hint { text-align: center; margin-top: 22px; font-size: 12.5px; color: var(--ink-400); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 14px; outline: none; transition: border .15s, box-shadow .15s; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--green-100); }

.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-400); margin: 28px 0 12px; }
.muted { color: var(--ink-500); }
.swatch { height: 72px; border-radius: var(--r-md); box-shadow: var(--sh-1); display: flex;
  align-items: flex-end; padding: 8px; color: #fff; font-size: 11px; font-weight: 600; }

@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .auth { grid-template-columns: 1fr; } .auth__aside { display: none; } }
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  /* La sidebar ne disparait plus sans recours : elle glisse en
     superposition et reste accessible via le bouton ☰ du header. */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--sh-3);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-toggle { display: grid; }
  .nav-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50;
  }
  body.nav-open .nav-backdrop { display: block; }
  /* Sous 900 px la barre est deja escamotee : la replier en rail par-dessus
     donnerait une colonne d'icones sans etiquettes, ouverte par le bouton ☰
     — deux mecanismes pour un seul geste. Le rail ne vaut que sur grand
     ecran, la ou il rend de la place. */
  body.nav-rail { --sidebar-w: 264px; }
  body.nav-rail .sidebar__nom,
  body.nav-rail .nav__lib,
  body.nav-rail .nav__chevron,
  body.nav-rail .sidebar__foot { display: revert; }
  body.nav-rail .nav__children.is-open { display: block; }
  body.nav-rail .sidebar__brand { flex-direction: row; padding: 22px 16px 18px; }
  body.nav-rail .sidebar__seal { width: 44px; height: 44px; }
  body.nav-rail .nav__item { justify-content: flex-start; padding: 10px 12px; gap: 12px; }
  body.nav-rail .nav__group { font-size: 10px; }
  .nav__bulle { display: none; }
  .grid-3,.grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Agenda (Semaine / Mois / Liste) ---------- */
/* La PRIORITÉ porte la couleur (liseré + pastille), le TYPE porte l'icône. */
.ag-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.ag-toolbar__nav { display: flex; align-items: center; gap: 8px; }
.ag-toolbar__label { font-family: var(--font-title); font-size: 15px; min-width: 250px; text-align: center; }
.ag-toolbar__agent { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-500); margin-left: auto; }
.ag-toolbar select, .ag-filtres select, .ag-filtres input[type="search"] {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; padding: 7px 10px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-900); }
.ag-consult { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: #8a6d00; background: var(--yellow-100); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 14px; }

.ag-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.ag-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--r-full); }
.ag-badge.prio-urgent { background: var(--red-100); color: var(--red-600); }
.ag-badge.prio-important { background: var(--yellow-100); color: #8a6d00; }
.ag-badge.prio-normal { background: var(--green-100); color: var(--green-800); }
.ag-badge.prio-faible { background: var(--surface-2); color: var(--ink-500); }
.ag-badge--type { background: var(--surface-2); color: var(--ink-500); font-weight: 600; }

/* --- Vue Semaine --- */
.ag-card { overflow: auto; }
.ag-grid { display: grid; min-width: 780px; }
.ag-gutter-head { border-bottom: 1px solid var(--line); }
.ag-allday-lab { font-size: 10.5px; color: var(--ink-400); text-align: right; padding: 4px 8px 0 0; }
.ag-day-head { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line); }
.ag-day-head.is-today { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.ag-day-head__nom { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); }
.ag-day-head__date { font-family: var(--font-title); font-size: 17px; font-weight: 800; margin-top: 2px; }
.ag-day-head.is-today .ag-day-head__date { color: var(--primary); }

.ag-allday { min-height: 26px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 3px; display: flex; flex-direction: column; gap: 2px; }
.ag-allday.is-today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.ag-pilule { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: var(--r-sm);
  background: var(--surface-2); border-left: 3px solid var(--primary); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ag-gutter { position: relative; border-right: 1px solid var(--line); }
.ag-gutter__h { font-size: 11px; color: var(--ink-400); text-align: right; padding-right: 8px;
  transform: translateY(-6px); border-top: 1px solid var(--line); box-sizing: border-box; }
.ag-day { position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 100%); }
.ag-day.is-today { background-color: color-mix(in srgb, var(--primary) 3%, transparent); }
/* Repère « maintenant » sur la colonne du jour. */
.ag-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red-500); z-index: 2; }
.ag-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--red-500); }

.ag-ev { position: absolute; left: 3px; right: 3px; overflow: hidden; cursor: pointer;
  border-left: 3px solid var(--primary); border-radius: var(--r-sm); padding: 4px 7px; box-shadow: var(--sh-1); }
.ag-ev:hover { box-shadow: var(--sh-2); }
.ag-ev__h { font-size: 10.5px; font-weight: 700; color: var(--ink-500); }
.ag-ev__t { font-size: 12px; font-weight: 600; color: var(--ink-900); line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ag-ev__lieu { font-size: 10.5px; color: var(--ink-500); margin-top: 2px; }
.ag-ev.is-done, .ag-pilule.is-done, .ag-mois__ev.is-done { opacity: .55; }
.ag-ev.is-done .ag-ev__t, .ag-liste__ligne.is-done .ag-liste__titre { text-decoration: line-through; }

/* --- Vue Mois --- */
.ag-mois { display: grid; grid-template-columns: repeat(7, 1fr); min-width: 720px; }
.ag-mois__entete { padding: 9px 6px; text-align: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500);
  border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ag-mois__jour { min-height: 96px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line);
  padding: 5px; cursor: pointer; }
.ag-mois__jour:hover { background: var(--surface-2); }
.ag-mois__jour.is-hors { background: var(--surface-2); color: var(--ink-400); }
.ag-mois__jour.is-today { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.ag-mois__num { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.ag-mois__jour.is-today .ag-mois__num { color: var(--primary); }
.ag-mois__events { display: flex; flex-direction: column; gap: 2px; }
.ag-mois__ev { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 2px 5px; border-radius: 4px; background: var(--surface); border-left: 3px solid var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-mois__plus { font-size: 10.5px; font-weight: 600; color: var(--ink-500); padding-left: 5px; }

/* --- Vue Liste --- */
.ag-filtres { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ag-filtres input[type="search"] { flex: 1; min-width: 180px; }
.ag-liste { display: flex; flex-direction: column; }
.ag-liste__ligne { display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--line); border-left: 4px solid var(--primary); }
.ag-liste__ligne:last-child { border-bottom: none; }
.ag-liste__corps { flex: 1; min-width: 0; cursor: pointer; }
.ag-liste__titre { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; }
.ag-liste__meta { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.ag-liste__tags { display: flex; align-items: center; gap: 6px; flex: none; }

/* --- Fiche de détail --- */
.ag-fiche__ligne { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; color: var(--ink-700); }
/* Une convocation posée par un supérieur : elle se distingue de tout le reste
   de l'agenda, parce que c'est la seule entrée que son propriétaire n'a pas
   écrite et ne peut pas retirer. */
.ag-fiche__impose { display: flex; gap: 8px; font-size: 12.5px; margin-top: 12px; padding: 10px 12px;
  background: #eaf2fa; border: 1px solid #cfe0f0; border-radius: 10px; color: var(--ink-700); }
.ag-fiche__impose svg { color: var(--info); flex: none; }
.ag-fiche__serie { display: flex; gap: 8px; font-size: 12.5px; margin-top: 12px; padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--r-sm); color: var(--ink-700); line-height: 1.5; }

/* --- Récurrence --- */
/* ⟳ : occurrence d'une série ; barré = retouchée individuellement, donc
   protégée des modifications portant sur toute la série. */
.ag-recur { margin-left: 5px; font-size: 12px; color: var(--ink-400); }
.ag-recur.is-exception { text-decoration: line-through; color: var(--yellow-600); }

.ag-rec { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.ag-rec__switch { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--ink-700); }
.ag-rec__corps { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.ag-rec__ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ag-rec__ligne select, .ag-rec__ligne input[type="number"], .ag-rec__ligne input[type="date"] {
  font-family: var(--font-body); font-size: 13px; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink-900); }
.ag-rec__ligne input[type="number"] { width: 72px; }
.ag-rec__jour { width: 30px; height: 30px; border-radius: var(--r-full); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-500); font-weight: 700; font-size: 12px; cursor: pointer; }
.ag-rec__jour.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.ag-rec__resume { font-size: 12.5px; font-weight: 600; color: var(--green-800);
  background: var(--green-100); border-radius: var(--r-sm); padding: 8px 11px; }

.ag-portee { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.ag-portee:hover { border-color: var(--primary); background: var(--green-50); }
.ag-portee input { margin-top: 2px; }
.ag-avert { display: flex; gap: 8px; font-size: 12.5px; margin-top: 12px; padding: 10px 12px;
  background: var(--yellow-100); color: #6b5400; border-radius: var(--r-sm); line-height: 1.5; }
.ag-check { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; cursor: pointer; }

/* --- Bandeau de rappel (au-dessus du header, empilable avec .archive-banner) --- */
.rappel-banner { display: flex; align-items: center; gap: 10px; font-size: 13px;
  padding: 9px 24px; background: linear-gradient(90deg, #eaf6ee, #fbfefc);
  border-bottom: 1px solid var(--green-100); color: var(--green-800); }
.rappel-banner.is-urgent { background: linear-gradient(90deg, #fdecec, #fffafa);
  border-bottom-color: var(--red-100); color: var(--red-600); }
.rappel-banner .mini-btn { margin-left: auto; }
.rappel-banner__tag { font-size: 10.5px; font-weight: 700; background: rgba(0,0,0,.07);
  padding: 2px 7px; border-radius: var(--r-full); margin-left: 6px; }
.rappel-banner__x { width: 22px; height: 22px; display: grid; place-items: center; border: none;
  background: transparent; color: inherit; opacity: .6; cursor: pointer; border-radius: 5px; font-size: 17px; }
.rappel-banner__x:hover { opacity: 1; background: rgba(0,0,0,.07); }

/* --- Menu de la cloche : rappels en cours + notifications système --- */
.cloche-wrap { position: relative; display: flex; }
.cloche-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 330px; max-width: calc(100vw - 32px); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-3);
  overflow: hidden; }
.cloche-menu[hidden] { display: none; }
.cloche-menu__head { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-500); padding: 11px 14px 7px; }
.cloche-menu__list { max-height: 300px; overflow-y: auto; }
.cloche-item { display: block; padding: 9px 14px; border-top: 1px solid var(--line);
  text-decoration: none; color: var(--ink-900); }
.cloche-item:hover { background: var(--surface-2); }
.cloche-item b { display: block; font-size: 13px; font-weight: 600; }
.cloche-item span { font-size: 12px; color: var(--ink-500); }
.cloche-item.is-urgent b { color: var(--red-600); }
.cloche-vide { padding: 4px 14px 12px; font-size: 12.5px; color: var(--ink-500); }
.cloche-menu__notif { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-top: 1px solid var(--line); background: var(--surface-2); }
.cloche-menu__notif-txt { flex: 1; }
.cloche-menu__notif-txt b { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.cloche-menu__notif-txt span { font-size: 11.5px; line-height: 1.45; color: var(--ink-500); }
.cloche-menu__notif-txt span.is-erreur { color: var(--red-600); }
.cloche-menu__notif .mini-btn { flex: none; }

@media (max-width: 900px) { .ag-toolbar__label { min-width: 0; } .ag-toolbar__agent { margin-left: 0; } }

/* ---------- Exécution financière (Engagement / Mandatement / Paiement) ---------- */
.exf-lecture { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: #8a6d00; background: var(--yellow-100); border-radius: var(--r-sm);
  padding: 8px 12px; margin-bottom: 14px; }
.exf-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.exf-toolbar input[type="search"], .exf-toolbar select {
  font-family: var(--font-body); font-size: 13px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-900); }
.exf-toolbar input[type="search"] { flex: 1; min-width: 200px; }
.exf-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-500); cursor: pointer; }

.exf-table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exf-soldee { background: var(--surface-2); color: var(--ink-500); }
.exf-actions { white-space: nowrap; text-align: right; }

/* Saisie « actuel » directement dans la ligne : le montant et le reste se
   recalculent à la frappe, « Tout » remplit le maximum autorisé. */
.exf-saisie { display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.exf-saisie input {
  width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
  font-family: var(--font-body); font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.exf-saisie input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.exf-saisie input.is-over, .num.is-over { color: var(--red-600); border-color: var(--red-500); }

.exf-chev { width: 22px; height: 22px; display: grid; place-items: center; background: none;
  border: none; color: var(--ink-400); cursor: pointer; border-radius: 6px; transition: transform .15s; }
.exf-chev:hover { background: var(--surface-2); color: var(--ink-900); }
.exf-chev.is-open { transform: rotate(90deg); color: var(--primary); }

.exf-hist { padding: 12px 16px; background: var(--surface-2); }
.exf-hist .table { background: var(--surface); border-radius: var(--r-sm); }
/* Une opération contre-passée reste visible, barrée : piste d'audit. */
.exf-op-annulee td { text-decoration: line-through; color: var(--ink-400); }
/* Ligne de totaux de la vue consolidée pluriannuelle. */
.exf-total td { background: var(--surface-2); border-top: 2px solid var(--line); }

/* Bandeau du jeu de demonstration.
   Il ne se ferme pas : une capture d'ecran de demonstration doit rester
   reconnaissable comme telle, y compris hors de l'application. */
.demo-banner {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 18px; font-size: 12.5px; line-height: 1.45;
  background: repeating-linear-gradient(135deg,
    #fdeaea 0 12px, #fbe0e0 12px 24px);
  color: #8c1414; border-bottom: 1px solid #f0c9c9;
}
.demo-banner b { font-weight: 800; }
.demo-banner svg { flex: none; }

/* Le résumé de ce que la bande ne montre pas : plus discret que les deux
   rappels de tête, puisqu'il ne dit rien d'urgent par lui-même. */
.rappel-banner--reste { background: var(--surface-2); border-color: var(--line); color: var(--ink-500); }
.rappel-banner--reste svg { color: var(--ink-400); }
