/* =============================================================================
   SOTERYS - Base CSS
   ============================================================================= */

/* ---- Design tokens -------------------------------------------------------- */
:root {
  /* Couleurs */
  --color-primary: #C8102E;
  --color-primary-hover: #A00D25;
  --color-primary-light: #FEE2E6;

  --color-text: #0F172A;
  --color-text-muted: #475569;
  --color-text-soft: #94A3B8;

  --color-bg: #FFFFFF;
  --color-bg-alt: #F8FAFC;
  --color-bg-dark: #0F172A;

  --color-border: #E2E8F0;
  --color-border-strong: #CBD5E1;

  --color-success: #059669;
  --color-warning: #D97706;
  --color-error: #DC2626;

  /* Typographie */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;

  /* Echelle fluide (clamp) */
  --fs-xs: clamp(0.75rem, 0.7rem + 0.15vw, 0.8125rem);
  --fs-sm: clamp(0.875rem, 0.825rem + 0.15vw, 0.9375rem);
  --fs-base: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  --fs-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  --fs-xl: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem);
  --fs-2xl: clamp(1.5rem, 1.3rem + 0.7vw, 2rem);
  --fs-3xl: clamp(2rem, 1.7rem + 1.2vw, 2.75rem);
  --fs-4xl: clamp(2.5rem, 2rem + 2vw, 3.75rem);
  --fs-5xl: clamp(3rem, 2.3rem + 3vw, 5rem);

  /* Espacement (8pt grid) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Ombres */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  /* Transitions */
  --duration-fast: 150ms;
  --duration: 200ms;
  --duration-slow: 300ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 780px;
  --header-height: 72px;
}

/* ---- Reset moderne --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; transition: color var(--duration) var(--ease-out); }
a:hover { color: var(--color-primary); }
ul, ol { list-style: none; }

/* Focus visible accessible */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Skip link (accessibilité RGAA / WCAG 7.1.1).
   Invisible par defaut, apparait uniquement quand on tab dessus depuis la
   barre URL. Aligne sur la charte Soterys (rouge primaire). */
.skip-link {
  position: absolute;
  top: -50px;
  left: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  z-index: 1000;
  transition: top var(--duration) var(--ease-out);
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 3px solid white;
  outline-offset: -3px;
}
.skip-link:hover {
  /* Cas rare ou il est visible et on passe la souris dessus */
  background: #a30d24;
}

/* Utilitaires */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-accent { color: var(--color-primary); }

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.container--narrow { max-width: var(--container-narrow); }

/* Headings base */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
/* H2 max 2rem (demande Franck 2026-04-20) - typographie sobre.
   H1 ramene de 3rem a 2.125rem (34 px) le 2026-08-23 : mesure a 45 px sur la
   fiche d'un local, le titre ecrasait tout le reste de la page. Le plancher
   descend aussi, sinon l'ecart entre mobile et desktop disparaissait. */
h1 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2.125rem); }
h2 { font-size: clamp(1.375rem, 1.15rem + 0.9vw, 2rem); }
h3 { font-size: var(--fs-xl); }

p { max-width: 70ch; }

/* =============================================================================
   BOUTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  white-space: nowrap;
  transition: all var(--duration) var(--ease-out);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn--sm { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }
.btn--lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-base); }

.btn--primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--color-primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn--ghost:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border-color: var(--color-text);
}

/* `.btn--secondary` etait UTILISE 14 fois dans les gabarits et DEFINI NULLE
   PART : ces boutons tombaient sur le seul `.btn`, dont le fond et la bordure
   sont transparents - ils s'affichaient donc comme du texte avec du padding.
   Constat du PO le 2026-09-09 : « les boutons ne ressemblent pas a des
   boutons ». Variante NEUTRE PLEINE, entre le primaire et le fantome.
   Meme famille : `.btn--xs` et `.btn--active`, utilises et non definis. */
.btn--secondary {
  background: var(--color-bg-alt, #f1f5f9);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn--secondary:hover {
  background: var(--color-border, #e2e8f0);
  color: var(--color-text);
  border-color: var(--color-text);
}

.btn--xs { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); }

.btn--danger {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}
.btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: white;
}
.btn--danger:disabled {
  background: #fca5a5;
  border-color: #fca5a5;
  cursor: not-allowed;
}

.btn--ghost-light {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,0.3);
}
.btn--ghost-light:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-color: rgba(255,255,255,0.6);
}

/* =============================================================================
   FLASH MESSAGES
   ============================================================================= */
.flash {
  padding: var(--sp-4) var(--sp-5);
  margin-inline: auto;
  max-width: var(--container-narrow);
  margin-top: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 500;
}
.flash--success {
  background: #ECFDF5;
  color: var(--color-success);
  border-color: #A7F3D0;
}
.flash--error {
  background: #FEF2F2;
  color: var(--color-error);
  border-color: #FECACA;
}

/* =============================================================================
   SECTION TITLES
   ============================================================================= */
.section-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-12);
  max-width: 40ch;
}
.section-title > span:first-child {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-lead {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-bottom: var(--sp-10);
}

/* =============================================================================
   TOPBAR (utilisateur connecté / liens auth)
   ============================================================================= */
.topbar {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  /* Sticky stack avec le site-header en dessous */
  position: sticky;
  top: 0;
  z-index: 51;
}
.topbar__inner {
  display: flex;
  align-items: center;
  height: 36px;
  gap: var(--sp-5);
}
/* Le nav (Mes projets + org-switcher + cloche + logout, OU
   login/inscription si non-auth) est toujours pousse a droite via
   margin-left auto. L'email/user reste a gauche par defaut. */
.topbar__links { margin-left: auto; }
/* `.topbar__user` est un <a> cliquable depuis DEC-040 (hub Mon compte).
   Hover : leger highlight + underline pour signaler l'interactivite. */
a.topbar__user {
    text-decoration: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
a.topbar__user:hover { background: rgba(255, 255, 255, 0.06); color: var(--color-text); }
a.topbar__user:hover .topbar__email { color: var(--color-text); }

.topbar__user {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: auto;
  color: var(--color-text);
  font-weight: 500;
  min-width: 0;
}
.topbar__user svg { flex-shrink: 0; opacity: 0.6; }
.topbar__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.topbar__links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.topbar__links a {
  color: var(--color-text-muted);
  font-weight: 500;
  transition: color var(--duration) var(--ease-out);
}
.topbar__links a:hover { color: var(--color-text); }
/* Logout form-POST : rendu identique aux liens (Turbo-safe) */
.topbar__logout-form { display: inline; margin: 0; padding: 0; }
.topbar__logout-btn {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  color: var(--color-text-muted);
  font-weight: 500;
  transition: color var(--duration) var(--ease-out);
}
.topbar__logout-btn:hover { color: var(--color-text); }
/* ===========================================================
   Selecteur d'organisation active (multi-org V2 - DEC-036)
   Dropdown a cote du nom user dans la topbar
   =========================================================== */
.org-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: var(--sp-3);
}
.org-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  max-width: 200px;
}
.org-switcher__btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.1);
}
.org-switcher__btn[aria-expanded="true"] {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.12);
}
.org-switcher__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.org-switcher__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 6px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.18), 0 4px 12px -2px rgba(0, 0, 0, 0.1);
  min-width: 240px;
  max-width: 320px;
  z-index: 60;
  padding: 6px 0;
  font-size: 0.85rem;
}
.org-switcher__menu-section {
  padding: 4px 0;
}
.org-switcher__menu-section + .org-switcher__menu-section {
  border-top: 1px solid var(--color-border, #e2e8f0);
}
.org-switcher__menu-label {
  display: block;
  padding: 4px 14px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #64748b);
}
.org-switcher__menu-form { display: block; margin: 0; padding: 0; }
.org-switcher__menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 6px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  font: inherit;
  color: var(--color-text, #0f172a);
  cursor: pointer;
  transition: background var(--duration) var(--ease-out);
}
.org-switcher__menu-item:hover {
  background: var(--color-bg-soft, #f8fafc);
}
.org-switcher__menu-item.is-current {
  background: rgba(200, 16, 46, 0.06);
  color: var(--color-primary, #c8102e);
  font-weight: 600;
  cursor: default;
}
.org-switcher__menu-type {
  color: var(--color-text-muted, #64748b);
  font-size: 0.7rem;
  font-weight: 400;
}
.org-switcher__menu-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 14px;
  color: var(--color-text-muted, #64748b);
  text-decoration: none;
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.org-switcher__menu-action:hover {
  background: var(--color-bg-soft, #f8fafc);
  color: var(--color-primary, #c8102e);
}

.topbar__link--primary {
  color: var(--color-primary) !important;
  font-weight: 600 !important;
}
.topbar__link--primary:hover { color: var(--color-primary-hover) !important; }

@media (max-width: 640px) {
  .topbar__inner { height: 32px; gap: var(--sp-3); }
  .topbar__email { max-width: 140px; }
  .topbar__links { gap: var(--sp-3); }
  .topbar__user svg { display: none; }
  /* Topbar 32px mobile : aligne le site-header dessous */
  .site-header { top: 32px; }
}

/* =============================================================================
   TOPBAR RESERVEE (hook futur - annonces, bandeau maintenance, etc.)
   Quand le user est logge (16/05/2026 - refonte header app), la topbar
   n'a plus de contenu actif mais reste presente dans le DOM pour pouvoir
   injecter un bandeau ulterieurement sans casser le sticky stack.
   ============================================================================= */
.topbar--reserved {
  display: none;
}
.topbar--reserved + .site-header { top: 0; }

/* =============================================================================
   HEADER APP - actions (user connecte)
   Pattern : trois zones compactes a droite du logo
   [Bouton primaire "Mes projets"] [Icone cloche notif] [Avatar dropdown]
   Tous les boutons partagent la base `.header-action` pour homogeneite.
   ============================================================================= */
.site-header--app .site-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.header-action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out),
              border-color var(--duration) var(--ease-out);
}
.header-action:hover { background: rgba(15, 23, 42, 0.05); color: var(--color-text); }
.header-action svg { flex-shrink: 0; opacity: 0.65; }
.header-action:hover svg { opacity: 0.9; }

/* Variante "primaire" : Mes projets (action #1 du user logge). */
.header-action--primary {
  background: var(--color-bg-soft, #f8fafc);
  border-color: var(--color-border, #e2e8f0);
  color: var(--color-text);
}
.header-action--primary:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}
.header-action--primary:hover svg { opacity: 1; }

/* Variante "icone seule" : cloche, etc. */
.header-action--icon { padding: 0; width: 36px; justify-content: center; position: relative; }

/* La cloche heritait de styles dedies - on l'aligne sur header-action. */
.site-header--app .notif-bell.header-action--icon { width: 36px; height: 36px; }
.site-header--app .notif-bell__btn {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.site-header--app .notif-bell__btn:hover { background: rgba(15, 23, 42, 0.05); color: var(--color-text); }

@media (max-width: 640px) {
  .header-action--primary .header-action__label { display: none; }
  .header-action--primary { padding: 0 10px; }
}

/* =============================================================================
   USER MENU - dropdown unifie (compte + organisation + admin + deconnexion)
   ============================================================================= */
.user-menu { position: relative; }

.user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 8px 0 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}
.user-menu__trigger:hover,
.user-menu__trigger[aria-expanded="true"] {
  background: rgba(15, 23, 42, 0.05);
  border-color: var(--color-border, #e2e8f0);
}
.user-menu__trigger svg { color: var(--color-text-muted); }

.user-menu__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C8102E 0%, #8a0a1f 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  user-select: none;
}
.user-menu__avatar--lg {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.user-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  background: white;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.15), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
  z-index: 60;
  overflow: hidden;
  animation: user-menu-in 120ms ease-out;
}
@keyframes user-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-menu__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-bg-soft, #f8fafc);
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.user-menu__identity-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.user-menu__identity-text strong {
  font-size: var(--fs-sm);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu__identity-email {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Chip discret : type de compte + plan + lien vers la page abonnement.
   Affiche sous l'email dans la zone identite du dropdown. */
.user-menu__plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(200, 16, 46, 0.08);
  border: 1px solid rgba(200, 16, 46, 0.18);
  border-radius: 999px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  width: fit-content;
  transition: background .15s, border-color .15s;
}
.user-menu__plan-chip:hover {
  background: rgba(200, 16, 46, 0.14);
  border-color: rgba(200, 16, 46, 0.34);
}
.user-menu__plan-chip-sep {
  opacity: 0.5;
  font-weight: 400;
}

.user-menu__section {
  padding: 6px;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.user-menu__section:last-child,
.user-menu__section--footer { border-bottom: none; }
.user-menu__section--footer { background: #fafbfc; }

.user-menu__section-label {
  display: block;
  padding: 4px 10px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.user-menu__org-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: 5px;
  background: rgba(200, 16, 46, 0.06);
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.user-menu__org-current svg { color: var(--color-primary); flex-shrink: 0; }
.user-menu__org-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu__org-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: white;
  padding: 2px 6px;
  border-radius: 3px;
}
/* Marqueur discret "propriétaire" : petite couronne couleur primaire,
   accolée au nom de l'org sans bruit visuel. */
.user-menu__org-owner {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--color-primary);
  opacity: 0.85;
  flex-shrink: 0;
}
.user-menu__org-owner svg { display: block; }

.user-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 5px;
  color: var(--color-text);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.user-menu__item:hover { background: rgba(15, 23, 42, 0.05); }
.user-menu__item svg { color: var(--color-text-muted); flex-shrink: 0; }
.user-menu__item:hover svg { color: var(--color-text); }
.user-menu__item-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu__item-hint {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.user-menu__item--switch { padding-left: 32px; }
.user-menu__item--ghost { color: var(--color-text-muted); font-size: var(--fs-xs); }
.user-menu__item--logout { color: var(--color-primary); font-weight: 500; }
.user-menu__item--logout:hover { background: rgba(200, 16, 46, 0.08); }
.user-menu__item--logout svg { color: var(--color-primary); }

.user-menu__form { display: block; margin: 0; padding: 0; width: 100%; }

@media (max-width: 640px) {
  .user-menu__panel { min-width: 260px; right: -8px; }
}

/* Badge version (module changelog) en bas du dropdown utilisateur. */
.user-menu__version {
  border-top: 1px solid var(--color-border, #e2e8f0);
  padding: 6px 0;
  text-align: center;
  background: #fafbfc;
}
.user-menu__version-btn {
  background: transparent;
  border: none;
  padding: 4px 12px;
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
}
.user-menu__version-btn:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--color-text);
}

/* =============================================================================
   MODAL CHANGELOG - contenu specifique a la popup "Nouveautes"
   ============================================================================= */
.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.changelog-version {
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  padding: 14px 16px;
  background: white;
}
.changelog-version__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.changelog-version__num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(200, 16, 46, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.changelog-version__date {
  font-size: 11px;
  color: var(--color-text-muted);
}
.changelog-version__title {
  margin: 4px 0 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text);
}
.changelog-items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.changelog-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--color-text);
}
.changelog-item__tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}
.changelog-item__tag--feature     { background: rgba(34, 197, 94, 0.12);  color: #15803d; }
.changelog-item__tag--fix         { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.changelog-item__tag--improvement { background: rgba(168, 85, 247, 0.12); color: #7e22ce; }
.changelog-item__tag--breaking    { background: rgba(234, 88, 12, 0.14);  color: #c2410c; }
.changelog-item__label {
  flex: 1;
}

/* =============================================================================
   HEADER
   ============================================================================= */
.site-header {
  position: sticky;
  /* Empile sous la topbar (hauteur 36px desktop, 32px mobile via media query). */
  top: 36px;
  z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}
.site-header.is-scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: var(--sp-6);
}
.site-header__logo { display: inline-flex; align-items: center; }
.site-header__nav ul {
  display: flex;
  gap: var(--sp-6);
}
.site-header__nav a {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}
.site-header__nav a:hover { color: var(--color-text); }
.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.site-header__toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
}
.site-header__toggle span {
  height: 2px;
  background: var(--color-text);
  transition: all var(--duration) var(--ease-out);
  transform-origin: center;
}
.site-header__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.site-header__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .site-header__nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: white;
    border-bottom: 1px solid var(--color-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-slow) var(--ease-in-out);
    pointer-events: none;
  }
  .site-header__nav.is-open { max-height: 500px; pointer-events: auto; }
  .site-header__nav ul {
    flex-direction: column;
    padding: var(--sp-4) var(--sp-5);
    gap: var(--sp-2);
  }
  .site-header__nav a {
    display: block;
    padding: var(--sp-3) 0;
    font-size: var(--fs-base);
    border-bottom: 1px solid var(--color-border);
  }
  .site-header__toggle { display: flex; }
}

/* =============================================================================
   FOOTER
   ============================================================================= */
.site-footer {
  background: var(--color-bg-dark);
  color: #CBD5E1;
  padding: var(--sp-20) 0 var(--sp-8);
  margin-top: var(--sp-24);
}
.site-footer a { color: #CBD5E1; }
.site-footer a:hover { color: white; }

.site-footer__top {
  display: grid;
  grid-template-columns: 1.3fr 2fr;
  gap: var(--sp-12);
  padding-bottom: var(--sp-12);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.site-footer__tagline {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  max-width: 38ch;
}
.site-footer__social {
  display: flex;
  gap: var(--sp-3);
  list-style: none;
  margin: var(--sp-5) 0 0;
  padding: 0;
}
.site-footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  color: #CBD5E1;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.site-footer__social a:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.35);
  color: #FFFFFF;
}
.site-footer__social a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.site-footer__legal-small {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: #94A3B8;
  line-height: 1.6;
}
.site-footer__nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-8);
}
/* Des h2 et non des h4 : les titres se suivent sans sauter de niveau (PageSpeed). */
.site-footer__nav h2 {
  margin-top: 0;
  line-height: inherit;
  color: white;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.site-footer__nav ul { display: flex; flex-direction: column; gap: var(--sp-2); }
.site-footer__nav a { font-size: var(--fs-sm); }

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  padding-top: var(--sp-6);
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  /* Contraste AA sur le fond sombre (PageSpeed, 2026-10-24). */
  color: #94A3B8;
}
.site-footer__bottom a { color: inherit; }
.site-footer__bottom a:hover { color: white; }

@media (max-width: 768px) {
  .site-footer__top { grid-template-columns: 1fr; }
  .site-footer__nav { grid-template-columns: repeat(2, 1fr); }
}

/* =============================================================================
   PAGE HEADER (sub-pages)
   ============================================================================= */
.page-header {
  padding: var(--sp-20) 0 var(--sp-12);
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, transparent 100%);
  text-align: center;
}
.page-header__title { margin-bottom: var(--sp-4); }
.page-header__lead {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  max-width: 55ch;
  margin-inline: auto;
}

.legal-content {
  padding-block: var(--sp-8) var(--sp-20);
}
.legal-content article h2 {
  font-size: var(--fs-xl);
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
}
.legal-content article h3 {
  font-size: var(--fs-lg);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
}
.legal-content article p,
.legal-content article ul { margin-bottom: var(--sp-4); }
.legal-content article ul { list-style: disc; padding-left: var(--sp-6); }
.legal-content article li { margin-bottom: var(--sp-2); }
.legal-content__updated {
  margin-top: var(--sp-12);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
}

/* Page header subtitle (variante du lead) */
.page-header__subtitle {
  font-size: var(--fs-base);
  color: var(--color-text-muted);
  max-width: 65ch;
  margin: var(--sp-3) auto 0;
  line-height: 1.6;
}

/* Sommaire des pages legales */
.legal-toc {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-10);
}
.legal-toc strong {
  display: block;
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-soft);
}
.legal-toc ol {
  list-style: decimal;
  padding-left: var(--sp-5);
  margin: 0;
  columns: 2;
  column-gap: var(--sp-8);
}
.legal-toc li {
  margin-bottom: var(--sp-1);
  break-inside: avoid;
}
.legal-toc a {
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--fs-sm);
}
.legal-toc a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
@media (max-width: 700px) {
  .legal-toc ol { columns: 1; }
}

/* Tableaux dans les pages legales (RGPD, sous-traitants, durees) */
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-4) 0 var(--sp-6);
  font-size: var(--fs-sm);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.legal-table thead {
  background: var(--color-bg-alt);
}
.legal-table th,
.legal-table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}
.legal-table th {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--color-text);
}
.legal-table tbody tr:last-child td {
  border-bottom: none;
}
.legal-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.015);
}
@media (max-width: 700px) {
  .legal-table {
    font-size: 0.8rem;
  }
  .legal-table th,
  .legal-table td {
    padding: var(--sp-2) var(--sp-3);
  }
}

/* =============================================================================
   COOKIE BANNER (RGPD - Soterys n'utilise que des cookies essentiels)
   ============================================================================= */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--color-text);
  color: white;
  padding: var(--sp-4);
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-out);
}
.cookie-banner--visible {
  transform: translateY(0);
}
.cookie-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
}
.cookie-banner__content {
  flex: 1;
  min-width: 280px;
}
.cookie-banner__content strong {
  display: block;
  font-size: var(--fs-base);
  margin-bottom: var(--sp-1);
}
.cookie-banner__content p {
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}
.cookie-banner__content a {
  color: white;
  text-decoration: underline;
  font-weight: 500;
}
.cookie-banner__content a:hover {
  color: var(--color-primary);
}
@media (max-width: 700px) {
  .cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-3);
  }
  .cookie-banner .btn {
    width: 100%;
  }
}

/* =============================================================================
   FORMS
   ============================================================================= */
.contact-section { padding-block: var(--sp-8) var(--sp-20); }

/* Styling global des inputs (s'applique aussi aux formulaires générés par Symfony
   sans classe form-control, comme RegistrationFormType) */
input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  background: white;
  color: var(--color-text);
  font-family: inherit;
  line-height: 1.5;
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              background-color var(--duration) var(--ease-out);
}
input[type="email"]:hover:not(:focus):not(:disabled),
input[type="password"]:hover:not(:focus):not(:disabled),
input[type="text"]:hover:not(:focus):not(:disabled),
input[type="tel"]:hover:not(:focus):not(:disabled),
input[type="url"]:hover:not(:focus):not(:disabled),
input[type="search"]:hover:not(:focus):not(:disabled),
input[type="number"]:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled) {
  border-color: var(--color-text-soft);
  background: #FAFAFB;
}
input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.14);
  background: white;
}
input::placeholder, textarea::placeholder { color: var(--color-text-soft); }
textarea { min-height: 140px; resize: vertical; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.form-field { margin-bottom: var(--sp-5); }
.form-field label {
  display: block;
  font-weight: 500;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-2);
  color: var(--color-text);
}
.form-control {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  background: white;
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}
.form-control::placeholder { color: var(--color-text-soft); }

.form-field--checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--color-bg-alt);
  border-radius: var(--radius);
}
.form-field--checkbox input { margin-top: 0.2rem; width: 18px; height: 18px; accent-color: var(--color-primary); flex-shrink: 0; }
.form-field--checkbox label { margin-bottom: 0; font-size: var(--fs-sm); line-height: 1.5; }

.form-actions { margin-top: var(--sp-8); text-align: center; }
.form-actions__note {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--color-text-soft);
}

/* Erreurs de validation */
form ul {
  margin-top: var(--sp-2);
  color: var(--color-error);
  font-size: var(--fs-sm);
  list-style: none;
  padding-left: 0;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* =============================================================================
   AUTH CARD (login, register, forgot password, mfa setup)
   ============================================================================= */
.auth-shell {
  min-height: calc(100vh - var(--header-height) - 36px);
  padding: var(--sp-12) var(--sp-5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, white 60%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-10) var(--sp-8) var(--sp-8);
  box-shadow: var(--shadow-md);
}
.auth-card--wide { max-width: 560px; }
.auth-card__header {
  text-align: center;
  margin-bottom: var(--sp-8);
}
.auth-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary);
  margin-bottom: var(--sp-5);
}
.auth-card__title {
  font-size: var(--fs-2xl);
  line-height: 1.2;
  margin-bottom: var(--sp-2);
  color: var(--color-text);
}
.auth-card__lead {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin: 0;
  max-width: 40ch;
  margin-inline: auto;
}
.auth-card form { margin: 0; }
.auth-card .form-field { margin-bottom: var(--sp-4); }
.auth-card .form-row { margin-bottom: var(--sp-4); }
.auth-card .form-actions {
  margin-top: var(--sp-6);
  text-align: stretch;
}
.auth-card .form-actions .btn {
  width: 100%;
  justify-content: center;
  padding-block: var(--sp-3);
}
.auth-card .form-actions .btn[disabled],
.auth-card .form-actions .btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* === Asterisque rouge sur les labels des champs requis ===
   Symfony ajoute automatiquement class="required" sur les labels des champs
   declares avec required:true. On affiche un asterisque rouge apres le texte. */
.form-field label.required::after,
.form-field label[data-required="true"]::after {
  content: ' *';
  color: var(--color-primary);
  font-weight: 700;
  margin-left: 0.15rem;
}

/* === Password toggle (oeil afficher/masquer) === */
.password-toggle {
  position: relative;
}
.password-toggle input {
  padding-right: 2.5rem !important;
}
.password-toggle__btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-soft);
  border-radius: 6px;
  padding: 0;
}
.password-toggle__btn:hover {
  color: var(--color-primary);
  background: rgba(200, 16, 46, 0.06);
}
.password-toggle__btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* === Password strength meter (compteur + barre) === */
.password-meter {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: 0.75rem;
  color: var(--color-text-soft);
}
.password-meter__bar-wrap {
  flex: 1;
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.password-meter__bar {
  width: 0%;
  height: 100%;
  background: #e2e8f0;
  border-radius: 999px;
  transition: width 0.18s ease, background 0.18s ease;
}
.password-meter__counter {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  min-width: 3.5em;
  text-align: right;
}
.password-meter__counter.is-ok {
  color: #16a34a;
}

/* === Password match indicator === */
.password-match {
  margin-top: var(--sp-2);
  font-size: 0.75rem;
  font-weight: 500;
  min-height: 1em;
}
.password-match--ok {
  color: #16a34a;
}
.password-match--ko {
  color: #dc2626;
}
.pw-rules {
  list-style: none;
  margin: var(--sp-2) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.pw-rule {
  font-size: 0.72rem;
  color: var(--color-text-muted, #64748b);
  padding-left: 15px;
  position: relative;
  white-space: nowrap;
}
.pw-rule::before {
  content: "○";
  position: absolute;
  left: 0;
  color: #94a3b8;
}
.pw-rule.is-ok {
  color: #16a34a;
}
.pw-rule.is-ok::before {
  content: "✓";
  color: #16a34a;
}
.auth-card__remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
  font-size: var(--fs-sm);
}
.auth-card__remember label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 0;
  color: var(--color-text-muted);
  cursor: pointer;
}
.auth-card__remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  margin: 0;
}
.auth-card__remember a {
  color: var(--color-primary);
  font-weight: 500;
  font-size: var(--fs-sm);
}
.auth-card__footer {
  text-align: center;
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.auth-card__footer a {
  color: var(--color-primary);
  font-weight: 500;
}
.auth-card__footer a:hover { color: var(--color-primary-hover); }

/* Secret MFA affiché en Base32 */
.auth-card__secret {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-base);
  letter-spacing: 0.08em;
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius);
  word-break: break-all;
  text-align: center;
  margin: var(--sp-4) 0;
  color: var(--color-text);
}

@media (max-width: 640px) {
  .auth-shell { padding: var(--sp-6) var(--sp-4); }
  .auth-card { padding: var(--sp-8) var(--sp-5) var(--sp-6); }
}

/* =============================================================================
   ERROR PAGES (404, 500)
   ============================================================================= */
.error-shell {
  padding: var(--sp-16) 0 var(--sp-12);
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, white 70%);
}
.error-shell--solo {
  min-height: calc(100vh - var(--header-height) - 36px);
  display: flex;
  align-items: center;
  padding-block: var(--sp-20);
}
.error-shell__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--sp-12);
  align-items: center;
}
.error-shell__main--center { text-align: center; margin-inline: auto; max-width: 640px; }
.error-shell__code {
  display: inline-block;
  font-size: clamp(4rem, 3rem + 4vw, 6rem);
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary);
  letter-spacing: -0.04em;
  margin: 0 0 var(--sp-4);
  background: linear-gradient(180deg, var(--color-primary) 0%, #8B0B20 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.error-shell__title {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 var(--sp-5);
  color: var(--color-text);
}
.error-shell__lead {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  margin: 0 0 var(--sp-8);
  max-width: 50ch;
}
.error-shell__main--center .error-shell__lead { margin-inline: auto; }
.error-shell__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.error-shell__ctas--center { justify-content: center; }
.error-shell__help {
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
  margin: 0;
}
.error-shell__help a {
  color: var(--color-primary);
  font-weight: 500;
}
.error-shell__visual {
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-shell__visual svg {
  width: 100%;
  max-width: 380px;
  height: auto;
  animation: error-pulse 4s ease-in-out infinite;
}
@keyframes error-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(1.02); }
}

.error-features {
  padding: var(--sp-16) 0 var(--sp-20);
  border-top: 1px solid var(--color-border);
  background: white;
}
.error-features__title {
  text-align: center;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  margin: 0 0 var(--sp-3);
}
.error-features__lead {
  text-align: center;
  color: var(--color-text-muted);
  margin: 0 auto var(--sp-12);
  max-width: 50ch;
}
.error-features__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-bottom: var(--sp-10);
}
.error-features__card {
  padding: var(--sp-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: white;
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}
.error-features__card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.error-features__card h3 {
  font-size: var(--fs-base);
  margin: var(--sp-3) 0 var(--sp-2);
  color: var(--color-text);
}
.error-features__card p {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.55;
}
.error-features__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.error-features__cta { text-align: center; }

@media (max-width: 900px) {
  .error-shell__grid { grid-template-columns: 1fr; gap: var(--sp-8); text-align: center; }
  .error-shell__main { display: flex; flex-direction: column; align-items: center; }
  .error-shell__lead { margin-inline: auto; }
  .error-shell__ctas { justify-content: center; }
  .error-shell__visual { order: -1; }
  .error-shell__visual svg { max-width: 220px; }
  .error-features__grid { grid-template-columns: 1fr; gap: var(--sp-4); }
}

/* =============================================================================
   SUCCESS
   ============================================================================= */
.page-header--success { padding-top: var(--sp-16); }
.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px; height: 96px;
  margin: 0 auto var(--sp-6);
  border-radius: var(--radius-full);
  background: #ECFDF5;
  color: var(--color-success);
}
.success-actions { margin-top: var(--sp-8); }

/* =============================================================================
   MOTION PREFERENCES
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =============================================================================
   Bouton flottant "Remonter en haut"
   Apparait apres scroll > 320px (cf scroll-top-controller.js)
   ============================================================================= */
.scroll-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease-out, transform .18s ease-out, background-color .15s;
  z-index: 90;
}
.scroll-top.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.scroll-top:hover {
  background: var(--color-primary-hover, #a30e26);
}
.scroll-top:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* =============================================================================
   GLOSSAIRE SSI - /glossaire-ssi
   ============================================================================= */

/* ── Onglets catégorie ──────────────────────────────────────────────────────── */
.glo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-bottom: 1.25rem;
}

.glo-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 99px;
  background: #fff;
  font-size: .85rem;
  font-weight: 500;
  color: var(--color-text-muted, #64748b);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}

.glo-tab:hover {
  border-color: var(--color-primary, #C8102E);
  color: var(--color-primary, #C8102E);
}

.glo-tab--active {
  border-color: var(--color-primary, #C8102E);
  background: var(--color-primary, #C8102E);
  color: #fff;
}

.glo-tab--active:hover { color: #fff; }

.glo-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 .3rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  background: rgba(0,0,0,.08);
  color: inherit;
}

.glo-tab--active .glo-tab-count {
  background: rgba(255,255,255,.25);
}

/* ── Filtre A-Z ──────────────────────────────────────────────────────────────── */
.glo-az {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: .875rem;
}

.glo-az-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 6px;
  background: #fff;
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}

.glo-az-btn:hover {
  border-color: var(--color-primary, #C8102E);
  color: var(--color-primary, #C8102E);
}

.glo-az-btn--active {
  border-color: var(--color-primary, #C8102E);
  background: var(--color-primary-light, #FEE2E6);
  color: var(--color-primary, #C8102E);
}

/* ── Liste des termes ────────────────────────────────────────────────────────── */
.glo-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
}

.glo-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 1.25rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  background: #fff;
  transition: background .1s;
}

.glo-row:last-child { border-bottom: none; }

.glo-row:nth-child(even) { background: var(--color-bg-alt, #f8fafc); }

.glo-row--def {
  grid-template-columns: 220px 1fr;
}

.glo-row[hidden] { display: none; }

.glo-term {
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-text, #1e293b);
  align-self: start;
  padding-top: .05rem;
}

.glo-def {
  font-size: .875rem;
  color: var(--color-text-muted, #475569);
  line-height: 1.55;
}

@media (max-width: 640px) {
  .glo-row,
  .glo-row--def {
    grid-template-columns: 1fr;
    gap: .15rem .25rem;
  }

  .glo-term {
    color: var(--color-primary, #C8102E);
    font-size: .8rem;
  }
}

/* ── Panneau ─────────────────────────────────────────────────────────────────── */
.glo-panel[hidden] { display: none !important; }

/* legacy - kept for safety */
.glossaire-entry[hidden],
.glossaire-letter-anchor[hidden] {
  display: none;
}

/* =========================================================
   SYMBOLES SOTERYS
   Jeu maison, source unique dans App\Ui\IconRegistry.
   Cf 00-PROJECT/NOTE_SYMBOLOGIE.md pour les cinq regles du
   dessin et pour ce que dit (et ne dit pas) la reglementation.
   ========================================================= */

.ds-icon {
  flex: none;
  vertical-align: -0.125em;
  transition: transform 0.16s ease-out, color 0.14s;
}
/* Icone absente du registre : carre tirete, visible en dev, jamais bloquant. */
.ds-icon--missing { color: var(--color-text-soft, #94A3B8); }

/* --- Survol 1 : le point actif ------------------------------------------
   Le rouge marque ce qui est actif (regle 5 du jeu). Au survol d'un element
   interactif, l'icone se met sous tension. Masque partout ailleurs : une
   icone decorative dans un titre ne clignote pas. */
.ds-icon__pulse { opacity: 0; transition: opacity 0.14s; }
a:hover  > .ds-icon .ds-icon__pulse,
a:focus-visible > .ds-icon .ds-icon__pulse,
button:hover > .ds-icon .ds-icon__pulse,
button:focus-visible > .ds-icon .ds-icon__pulse,
.btn:hover .ds-icon .ds-icon__pulse,
.btn:focus-visible .ds-icon .ds-icon__pulse { opacity: 1; }

/* --- Survol 2 : le deplacement directionnel ------------------------------
   Reserve aux icones qui ONT un sens : le registre les marque lui-meme
   (`dir`). Une corbeille ne va nulle part, elle ne bouge pas. */
a:hover > .ds-icon--dir-x,  button:hover > .ds-icon--dir-x,  .btn:hover .ds-icon--dir-x  { transform: translateX(2px); }
a:hover > .ds-icon--dir-x-, button:hover > .ds-icon--dir-x-, .btn:hover .ds-icon--dir-x- { transform: translateX(-2px); }
a:hover > .ds-icon--dir-y,  button:hover > .ds-icon--dir-y,  .btn:hover .ds-icon--dir-y  { transform: translateY(-2px); }
a:hover > .ds-icon--dir-y-, button:hover > .ds-icon--dir-y-, .btn:hover .ds-icon--dir-y- { transform: translateY(2px); }

@media (prefers-reduced-motion: reduce) {
  .ds-icon { transition: color 0.14s; }
  a:hover > .ds-icon, button:hover > .ds-icon, .btn:hover .ds-icon { transform: none; }
}

/* Bouton de suppression SECONDAIRE : `btn--ghost btn--danger` s'affichait en
   rouge plein, aussi fort que l'action principale posee a cote (« Voir les
   locaux »). Une suppression se lit, elle ne s'impose pas : contour rouge,
   fond transparent. Vaut pour tous les boutons qui combinent les deux, dont
   « Supprimer ce niveau ». */
.btn--ghost.btn--danger {
  background: transparent;
  color: #dc2626;
  border-color: #dc2626;
}
.btn--ghost.btn--danger:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #b91c1c;
}

/* Page « confirmez votre adresse email » (apres l'inscription). */
.verify-email__note {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin: var(--sp-4) 0 0;
}
.auth-card .verify-email__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ===========================================================
   Double authentification : connexion, activation, Mon compte
   =========================================================== */
.mfa-steps {
  font-size: var(--fs-xs, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0 0 var(--sp-4);
}
.mfa-code-input {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  text-align: center;
}
.mfa-trusted {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  margin-top: var(--sp-2);
}
.mfa-status {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin: var(--sp-4) 0 0;
  text-align: center;
}
.mfa-status--error {
  color: var(--color-primary);
  font-weight: 500;
}
.mfa-linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--color-primary);
  font: inherit;
  font-size: var(--fs-sm);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.mfa-resend,
.mfa-cancel {
  text-align: center;
  margin-top: var(--sp-4);
}
.mfa-switch {
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border, #e2e8f0);
  font-size: var(--fs-sm);
}
.mfa-switch p {
  margin: 0 0 var(--sp-2);
  color: var(--color-text-muted);
}
.mfa-switch ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}
.mfa-backup {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
}
.mfa-backup summary {
  cursor: pointer;
  color: var(--color-primary);
}
.mfa-qr {
  display: block;
  margin: var(--sp-4) auto;
  max-width: 100%;
  height: auto;
  background: #fff;
  padding: var(--sp-3);
  border-radius: 8px;
  border: 1px solid var(--color-border, #e2e8f0);
}
.mfa-secret {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-align: center;
  word-break: break-all;
}
.mfa-howto {
  font-size: var(--fs-sm);
  margin: var(--sp-4) 0 0;
  padding-left: 1.2rem;
}
.mfa-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2) var(--sp-6);
  margin: var(--sp-6) 0;
  padding-left: 1.6rem;
  font-family: 'Courier New', monospace;
  font-size: 1.05rem;
}
.auth-card .mfa-codes__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.mfa-choices {
  list-style: none;
  margin: var(--sp-6) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-3);
}
.mfa-choice {
  display: grid;
  gap: var(--sp-1, 4px);
  padding: var(--sp-4);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 10px;
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.mfa-choice:hover,
.mfa-choice:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}
.auth-card.mfa-setup--wide {
  max-width: 800px;
}
.mfa-setup--wide .auth-card__lead {
  max-width: none;
}
.mfa-choices form {
  margin: 0;
}
button.mfa-choice {
  width: 100%;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mfa-choice span {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.mfa-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  vertical-align: middle;
  margin-left: var(--sp-2);
}
.mfa-badge--on {
  background: #dcfce7;
  color: #166534;
}
.mfa-later {
  margin-top: var(--sp-6);
  text-align: center;
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
}
.mfa-reminder {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: calc(100% - 32px);
  max-width: 460px;
  border: 0;
  border-radius: 12px;
  padding: var(--sp-6);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.mfa-reminder::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.mfa-reminder h2 {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xl, 1.25rem);
}
.mfa-reminder p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.mfa-reminder__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}
.mfa-reminder__actions form {
  margin: 0;
}
.auth-card .help {
  display: block;
  margin-top: var(--sp-1, 4px);
  font-size: var(--fs-xs, 0.75rem);
  color: var(--color-text-muted);
}

/* CGVU */
.legal-content article h4 { font-size: var(--fs-base); margin: var(--sp-4) 0 var(--sp-2); }
.cgvu-table-wrap { overflow-x: auto; margin-bottom: var(--sp-4); }
.cgvu-note {
  background: var(--color-primary-light);
  border-radius: 8px;
  padding: var(--sp-3) var(--sp-4);
}
.cgvu-version-note { margin-bottom: var(--sp-4); }
.cgvu-changements {
  background: var(--color-primary-light);
  border-radius: 8px;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.cgvu-changements ul { margin: var(--sp-2) 0; padding-left: var(--sp-4); }
.cgvu-changements p { margin: 0; }
.cgvu-refus { margin-top: var(--sp-4); font-size: var(--fs-sm); color: var(--color-text-muted); }
.cgvu-refus a { color: var(--color-primary); }
.cgvu-copyright { font-size: var(--fs-sm); color: var(--color-text-muted); }
.form-field--checkbox label a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* =============================================================================
   SOUSCRIPTION (confirmation avant paiement, DEC-286) : carte large et
   compacte, tout tient sans defiler sur un ecran d'ordinateur.
   ============================================================================= */
.souscription.auth-shell { padding-top: var(--sp-8); }
.souscription__card.auth-card { max-width: 640px; padding: var(--sp-6) var(--sp-8); }
.souscription__header { margin-bottom: var(--sp-4); }
.souscription__title { font-size: 1.35rem; margin: 0 0 var(--sp-1); }
.souscription__lead { margin: 0; color: var(--color-text-muted); }
.souscription__prix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md, 6px);
}
.souscription__prix dt { font-size: 0.8rem; color: var(--color-text-muted); }
.souscription__prix dd { margin: 0; font-weight: 600; }
.souscription__total dd { font-weight: 700; color: var(--color-text); }
.souscription__section { font-size: 1rem; margin: 0 0 var(--sp-3); }
.souscription__grille {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0 var(--sp-4);
}
.souscription__grille .form-field { margin-bottom: var(--sp-3); }
.souscription__large { grid-column: 1 / -1; }
.souscription__optionnel { font-weight: 400; color: var(--color-text-muted); font-size: 0.8rem; }
.souscription__note { margin: var(--sp-2) 0 var(--sp-4); font-size: 0.85rem; color: var(--color-text-muted); }
.souscription__actions { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
@media (max-width: 560px) {
  .souscription__card.auth-card { padding: var(--sp-5) var(--sp-4); }
  .souscription__prix { grid-template-columns: 1fr 1fr; }
  .souscription__total { grid-column: 1 / -1; }
  .souscription__grille { grid-template-columns: 1fr; }
  .souscription__actions { flex-direction: column-reverse; }
  .souscription__actions .btn { width: 100%; justify-content: center; }
}
