/* Organigramme agence.woutils.com — tokens issus de specs/ux-design.md (fait foi).
   Light corporate : papier chaud, une couleur primaire, zéro gradient,
   zéro glassmorphism, zéro emoji. Mobile-first (874×402), desktop ≥1024px. */

:root {
  /* Couleurs */
  --fond: #FAFAF7;
  --surface: #FFFFFF;
  --creuse: #F3F2EE;
  --texte: #0E1526;
  --texte-2: #55606E;
  --texte-3: #8A93A0;
  --primaire: #2B4FE0;
  --primaire-hover: #2342BE;
  --bordure: #E4E2DA;
  --bordure-forte: #D4D2C8;
  --encours: #0A7B5A;
  --enfile: #64748B;
  --bloquee: #B45309;
  --inactif: #D1D5DB;

  /* Rayons */
  --r-carte: 14px;
  --r-avatar: 10px;
  --r-bouton: 8px;
  --r-sheet: 16px;

  /* Ombres minimales */
  --ombre-carte: 0 1px 2px rgba(14, 21, 38, .04);
  --ombre-panneau: -12px 0 32px rgba(14, 21, 38, .06);
  --ombre-sheet: 0 -8px 24px rgba(14, 21, 38, .12);

  /* Espacement — grille 8px */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s6: 24px; --s8: 32px; --s12: 48px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: 'cv01', 'ss03';
  font-size: 14px;
  line-height: 1.45;
}

body.panneau-ouvert { overflow: hidden; }

img { display: block; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1, h2, p, dl, dd, dt, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--primaire);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-bouton);
  border: 1px solid var(--bordure);
}
.skip-link:focus { left: var(--s4); top: var(--s4); z-index: 60; }

/* ---------------------------------------------------------------- Typo */

.kicker {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--texte-3);
  margin: 0 0 var(--s1);
}

.kicker-bloc {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--texte-3);
  margin-bottom: var(--s2);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Header */

.site-header {
  border-bottom: 1px solid var(--bordure);
  background: var(--surface);
}

.site-header__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--s4) var(--s4) var(--s3);
}

.site-titre {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.site-sous-titre {
  font-size: 13px;
  line-height: 18px;
  color: var(--texte-2);
  margin-top: 2px;
}

.tabs {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s3);
}

.tab {
  min-height: 44px;
  padding: var(--s2) var(--s4);
  border-radius: var(--r-bouton);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--texte-2);
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
}

.tab[aria-selected="true"] {
  color: var(--primaire);
  border-color: var(--primaire);
  font-weight: 600;
}

.tab:hover { border-color: var(--bordure-forte); }
.tab[aria-selected="true"]:hover { border-color: var(--primaire-hover); color: var(--primaire-hover); }

/* ---------------------------------------------------------------- Bannière */

.banniere {
  max-width: 1240px;
  margin: var(--s3) auto 0;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--bordure-forte);
  border-radius: var(--r-bouton);
  background: var(--creuse);
  color: var(--texte);
  font-size: 13px;
}

.banniere[hidden] { display: none; }

/* ---------------------------------------------------------------- Page */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--s4);
}

.etat-vide {
  color: var(--texte-3);
  font-size: 13px;
  line-height: 18px;
  padding: var(--s2) 0;
}

/* ---------------------------------------------------------------- Carte membre */

.membre {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-carte);
  box-shadow: var(--ombre-carte);
  min-width: 0;
}

.membre__tete {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-avatar);
}

.avatar,
.initiales {
  width: 48px;
  height: 48px;
  border-radius: var(--r-avatar);
  object-fit: cover;
}

.initiales {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--texte);
  text-transform: uppercase;
  letter-spacing: .02em;
  user-select: none;
}

.membre__infos { min-width: 0; }

.membre__nom {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.membre__role {
  font-size: 13px;
  line-height: 18px;
  color: var(--texte-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.membre__dot { margin-left: auto; flex: none; }

/* Point de statut — 8px (ux-design §1) */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}

.dot--encours {
  background: var(--encours);
  animation: pulse 2s ease-in-out infinite;
}

.dot--enfile {
  background: transparent;
  border: 1.5px solid var(--enfile);
  width: 6.5px;
  height: 6.5px;
}

.dot--bloquee { background: var(--bloquee); }
.dot--inactif { background: var(--inactif); }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .6; }
  50% { transform: scale(1.35); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .dot--encours { animation: none; }
}

/* ---------------------------------------------------------------- Organigramme — mobile (accordéon) */

.org-racine { margin-bottom: var(--s3); }

.groupe {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-carte);
  box-shadow: var(--ombre-carte);
  margin-bottom: var(--s3);
  overflow: hidden;
}

.groupe__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  width: 100%;
  min-height: 48px;
  padding: var(--s2) var(--s3);
  text-align: left;
}

.groupe__nom {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.groupe__meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: none;
}

.groupe__compte {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
}

.groupe__chevron {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--texte-2);
  border-bottom: 1.5px solid var(--texte-2);
  transform: rotate(-45deg);
  transition: transform 160ms ease-out;
}

.groupe.est-ouvert .groupe__chevron { transform: rotate(45deg); }

.groupe__corps {
  display: none;
  padding: 0 var(--s3) var(--s3);
}

.groupe.est-ouvert .groupe__corps { display: grid; gap: var(--s2); }

/* ---------------------------------------------------------------- Vue globale — mobile */

.global-compteur {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
  margin-bottom: var(--s3);
}

.global-equipe { margin-bottom: var(--s6); }

.global-equipe__titre {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  padding-bottom: var(--s1);
  border-bottom: 1px solid var(--bordure-forte);
}

.global-ligne {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  padding: var(--s1) 0;
  border-bottom: 1px solid var(--bordure);
}

.global-ligne__nom {
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}

.global-ligne__activite {
  color: var(--texte-2);
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---------------------------------------------------------------- Footer */

.site-footer {
  border-top: 1px solid var(--bordure);
  margin-top: var(--s8);
  padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
  justify-content: space-between;
}

.site-footer p {
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
}

.site-footer__fraicheur {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Scrim + panneau */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(14, 21, 38, .4);
  z-index: 40;
}

.scrim[hidden] { display: none; }

.panneau {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--ombre-sheet);
  transform: translateY(100%);
  visibility: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
  overflow-y: auto;
  transition: transform 240ms ease-out, visibility 0s 240ms;
}

.panneau.est-ouvert {
  transform: none;
  visibility: visible;
  transition: transform 240ms ease-out;
}

.panneau[hidden] { display: none; }

.panneau__poignee {
  flex: none;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.panneau__poignee::before {
  content: "";
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--bordure-forte);
}

.panneau__croix {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  width: 44px;
  height: 44px;
  border-radius: var(--r-bouton);
  font-size: 20px;
  line-height: 1;
  color: var(--texte-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.panneau__croix:hover { background: var(--creuse); color: var(--texte); }

.panneau__identite {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s1);
  padding: var(--s1) 0 var(--s4);
}

.panneau__avatar .avatar,
.panneau__avatar .initiales {
  width: 96px;
  height: 96px;
  border-radius: 14px;
}

.panneau__nom {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-top: var(--s2);
}

.panneau__role {
  font-size: 13px;
  line-height: 18px;
  color: var(--texte-2);
}

.panneau__bloc {
  border-top: 1px solid var(--bordure);
  padding: var(--s3) 0;
}

.panneau__encours { display: grid; gap: var(--s2); }

.encours-item__ligne {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
}

.encours-item__titre {
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--creuse);
  border-radius: var(--r-bouton);
  padding: var(--s1) var(--s2);
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-2);
  white-space: nowrap;
}

.encours-item__meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
  margin-top: var(--s1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.encours-autres {
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
}

.compteurs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
}

.compteurs__item dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}

.compteurs__item dt {
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
}

.panneau__derniere { display: grid; gap: var(--s1); }

.derniere-titre { font-weight: 600; font-size: 14px; line-height: 20px; }

.derniere-meta {
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.panneau__fraicheur {
  margin-top: auto;
  padding-top: var(--s3);
  font-size: 12px;
  line-height: 16px;
  color: var(--texte-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.panneau__fermer {
  flex: none;
  margin-top: var(--s3);
  min-height: 48px;
  border: 1px solid var(--bordure);
  border-radius: var(--r-bouton);
  font-weight: 600;
}

.panneau__fermer:hover { background: var(--creuse); border-color: var(--bordure-forte); }

/* ================================================================ Desktop ≥1024px */

@media (min-width: 1024px) {

  .site-header__inner,
  .page {
    padding-left: var(--s6);
    padding-right: var(--s6);
  }

  .site-header__ligne {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s6);
  }

  .tabs { margin-top: 0; }

  .site-titre { font-size: 24px; line-height: 32px; }

  /* Carte membre : avatar 40px desktop */
  .avatar, .initiales { width: 40px; height: 40px; }

  /* Racine CEO centrée + connecteurs 1px */
  .org-racine {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
  }

  .org-racine .membre { min-width: 280px; }

  .org-direction {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--s3) 0 0;
  }

  .org-direction::before,
  .org-equipes::before {
    content: "";
    display: block;
    width: 1px;
    height: 24px;
    background: var(--bordure-forte);
  }

  .org-direction::before { margin-bottom: var(--s3); }

  .org-equipes::before { margin-bottom: 0; }

  .org-direction .groupe__entete {
    justify-content: center;
    padding-bottom: var(--s3);
  }

  .org-direction .groupe__corps,
  .org-direction .groupe.est-ouvert .groupe__corps {
    grid-template-columns: repeat(2, minmax(0, 280px));
    justify-content: center;
  }

  /* Colonnes d'équipes — rail horizontal, scroll au-delà de 4 colonnes */
  .org-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 1fr);
    gap: var(--s3);
    border-top: 1px solid var(--bordure-forte);
    padding-top: var(--s3);
    width: max-content;
    min-width: 100%;
  }

  .org-equipes--scroll { overflow-x: auto; padding-bottom: var(--s2); }

  .groupe {
    position: relative;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    overflow: visible;
  }

  /* Stub vertical reliant la colonne au rail */
  .groupe::before {
    content: "";
    position: absolute;
    top: calc(-1 * var(--s3));
    left: 50%;
    width: 1px;
    height: var(--s3);
    background: var(--bordure-forte);
  }

  .groupe__entete {
    cursor: default;
    min-height: 0;
    padding: var(--s2) 0;
    justify-content: flex-start;
  }

  .groupe__chevron { display: none; }

  .groupe__corps,
  .groupe.est-ouvert .groupe__corps {
    display: grid;
    gap: var(--s2);
    padding: 0;
  }

  /* Vue globale : listes plus larges */
  .global-equipe { max-width: 860px; }

  /* Panneau : overlay latéral 400px */
  .panneau {
    inset: 0 0 0 auto;
    width: 400px;
    border-radius: 0;
    box-shadow: var(--ombre-panneau);
    transform: translateX(100%);
    transition: transform 240ms ease-out, visibility 0s 240ms;
    padding: var(--s6);
    padding-bottom: var(--s6);
  }

  .panneau.est-ouvert {
    transform: none;
    transition: transform 240ms ease-out;
  }

  .panneau__poignee { display: none; }

  .panneau__fermer { display: none; }

  .panneau__identite { padding-bottom: var(--s6); }
}

@media (prefers-reduced-motion: reduce) {
  .panneau, .groupe__chevron { transition: none; }
}
