/* =========================================================================
   SWISS LINGUA - DESIGN SYSTEM v1
   Feuille de style partagée. Tous les cockpits l'importent :
       <link rel="stylesheet" href="design-system.css">
   Source unique de vérité visuelle (voir ../tokens.md).
   Premium · suisse · avant-gardiste. Un seul design system, cohérence totale.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Polices
   - Inter (UI, corps, champs) via Google Fonts.
   - Bembo (serif éditorial) en local. ⚠️ Regular SEULEMENT : le navigateur
     synthétise gras/italique en proto. Prod = Bembo complète (Monotype) OU
     substitut open (ET Book / EB Garamond). Voir ../tokens.md.
   ------------------------------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "Bembo";
  src: url("../fonts/bembo-src/bembo-regular.woff2") format("woff2"),
       url("../fonts/bembo-src/bembo-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* =========================================================================
   TOKENS (variables CSS) - repris de ../tokens.md
   ========================================================================= */
:root {
  /* ── Couleurs de marque ─────────────────────────────────────────────── */
  --ink: #14140F;            /* Texte principal                            */
  --navy: #2A317D;           /* Primaire : titres, boutons, liens, nav     */
  --navy-700: #222A6E;       /* Marine au survol                           */
  --coral: #E84647;          /* Accent fort : CTA, emphase, badge live     */
  --coral-700: #C73132;      /* Corail au survol                           */
  --salmon: #F6BCB3;         /* Accent doux, tints                         */
  --salmon-soft: #FCEAE5;    /* Tint corail très léger                     */
  --ivory: #FFF7EE;          /* Surface chaude principale (fond de page)   */
  --greige: #F0EDE6;         /* Surface secondaire                         */
  --surface: #FFFFFF;        /* Cartes                                     */
  --on-dark: #FFFFFF;        /* Texte/éléments sur fond foncé (navy, corail)*/
  /* Muet assombri pour viser AA texte normal sur les DEUX surfaces :
     ≈ 4.7:1 sur blanc, ≈ 4.4:1 sur ivoire (vs 4.2/3.9 avant). WCAG 2.2 AA. */
  --muted: #5C5C56;          /* Texte secondaire                           */
  --line: #E7E2D8;           /* Bordures, séparateurs                      */
  --line-strong: #D8D2C5;    /* Bordures appuyées                          */

  /* ── États ──────────────────────────────────────────────────────────── */
  /* Teintes de TEXTE assombries pour viser ≥ 4.5:1 sur leur fond -soft
     (petit texte 12px des badges). Voir revue contraste WCAG 2.2 AA. */
  --success: #27684C;        --success-soft: #E3F1EA;   /* 5.5:1 sur soft */
  --warning: #8A5A12;        --warning-soft: #FBEFD9;   /* 5.6:1 sur soft */
  --danger:  #C73132;        --danger-soft:  #FCEAE5;
  --info:    #2A317D;        --info-soft:    #E8E9F3;

  /* ── Typographie ────────────────────────────────────────────────────── */
  --font-serif: "Bembo", "ET Book", "EB Garamond", Georgia, serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:  ui-monospace, "SF Mono", "JetBrains Mono", monospace;

  --text-display: 3.5rem;
  --text-h1: 2.5rem;
  --text-h2: 1.875rem;
  --text-h3: 1.375rem;
  --text-h4: 1.125rem;
  --text-lead: 1.25rem;
  --text-body: 1rem;
  --text-sm: 0.875rem;
  --text-xs: 0.75rem;
  --text-2xs: 0.6875rem;       /* 11px : libellés ultra-denses (scale CECRL, tabbar) */
  --text-stat: 1.75rem;        /* KPI compact (cartes résumé), entre h3 et kpi */
  --text-kpi: 2.25rem;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.08em;

  /* ── Espace (4 / 8 pt) ──────────────────────────────────────────────── */
  --space-1: 0.25rem;  --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.5rem;  --space-6: 2rem;
  --space-7: 3rem;     --space-8: 4rem;    --space-9: 6rem;   --space-10: 8rem;

  /* ── Rayons ─────────────────────────────────────────────────────────── */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-pill: 999px;

  /* ── Ombres (chaudes, teintées encre) ───────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(20, 20, 15, 0.04);
  --shadow-sm: 0 2px 8px rgba(20, 20, 15, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 20, 15, 0.08);
  --shadow-lg: 0 16px 48px rgba(20, 20, 15, 0.12);
  --shadow-focus: 0 0 0 3px rgba(42, 49, 125, 0.35);

  /* ── Mouvement ──────────────────────────────────────────────────────── */
  --dur-fast: 120ms;
  --dur-base: 240ms;
  --dur-slow: 480ms;
  --dur-counter: 1200ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Layout ─────────────────────────────────────────────────────────── */
  --container: 1200px;
  --sidebar-w: 264px;
  --topbar-h: 64px;
}

/* =========================================================================
   RESET LÉGER
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--ivory);            /* surface chaude principale */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; padding: 0; }
a { color: var(--navy); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--navy-700); }
a:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

/* =========================================================================
   TYPOGRAPHIE DE BASE
   Titres en Bembo (chaleur éditoriale), corps en Inter.
   ========================================================================= */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--navy);
  font-weight: 400;                    /* Bembo Regular ; le gras est synthétisé */
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
}
h1 { font-size: var(--text-h1); line-height: 1.1; }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); line-height: 1.25; }
h4 { font-size: var(--text-h4); line-height: 1.3; }

p { max-width: 68ch; }

small, .text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.lead { font-size: var(--text-lead); color: var(--ink); line-height: 1.5; }
.muted { color: var(--muted); }

/* Titre d'affichage vitrine : Inter Bold majuscules (style hero marque) */
.display {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--text-display);
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  text-transform: uppercase;
  color: var(--navy);
}

/* Sur-titre / label de section.
   Corail pur en petit texte échoue l'AA (3.67:1 sur ivoire) : on prend le
   marine (10.8:1). Le corail reste pour les gros titres, icônes et fonds
   pleins (brief). Variante .eyebrow--coral disponible si fond plein. */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--navy);
}

/* Variante corail réservée aux fonds pleins sombres (jamais sur clair). */
.eyebrow--coral { color: var(--coral); }

/* Sur-titre sur fond foncé : saumon clair (≈ 7:1 sur navy), lisible et chaud. */
.eyebrow--on-dark { color: var(--salmon); }

/* Mot d'emphase au fil du texte : Bembo corail, DROIT (pas d'italique).
   L'accent se fait par la couleur, pas par l'italique.
   ⚠️ Sur fond clair uniquement. Sur fond foncé, utiliser .emphasis--on-dark. */
.emphasis {
  font-family: var(--font-serif);
  color: var(--coral);
}
/* Variante italique : réservée aux NOMS et VALEURS DYNAMIQUES (langue d'un
   apprenant, nom de personne, ville…). Ne pas utiliser pour de l'emphase
   purement stylistique. NB : Bembo Regular seul → italique synthétisé en proto. */
.emphasis--dynamic { font-style: italic; }
/* Emphase sur fond foncé : corail pur sur navy ≈ 2:1 (illisible). On passe
   au saumon clair (≈ 7:1 sur navy), cohérent avec .eyebrow--on-dark. */
.emphasis--on-dark { color: var(--salmon); }

/* Utilitaire texte corail foncé (AA sur fond clair, ≈ 5.3:1 sur blanc) */
.text-coral-700 { color: var(--coral-700); }

/* Séparateur horizontal doux (remplace les <hr> inline) */
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-5) 0;
}

/* =========================================================================
   CARTE
   ========================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}
.card--hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.card__title { font-size: var(--text-h3); margin: 0; }

/* =========================================================================
   KPI - label + grand chiffre Bembo
   ========================================================================= */
.kpi { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.kpi__label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
}
.kpi__value {
  font-family: var(--font-serif);
  font-size: var(--text-kpi);
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow-wrap: break-word;
}
.kpi__value--navy { color: var(--navy); }
.kpi__unit { font-size: 0.5em; color: var(--muted); margin-left: var(--space-1); }
.kpi__delta {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.kpi__delta--up { color: var(--success); }
.kpi__delta--down { color: var(--danger); }

/* =========================================================================
   BADGE « EN DIRECT » - point pulsant + libellé
   ========================================================================= */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  /* Libellé en marine (9.5:1 sur salmon-soft) : le corail pur échoue
     (3.34:1). Le point pulsant corail reste le seul signal de couleur. */
  color: var(--navy);
  padding: var(--space-1) var(--space-3);
  background: var(--salmon-soft);
  border-radius: var(--radius-pill);
}
.badge-live::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: var(--radius-pill);
  background: var(--coral);
  box-shadow: 0 0 0 0 rgba(232, 70, 71, 0.5);
  animation: pulse-live 1.8s var(--ease-out) infinite;
}
@keyframes pulse-live {
  0%   { box-shadow: 0 0 0 0 rgba(232, 70, 71, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(232, 70, 71, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 70, 71, 0); }
}

/* Badge de fraîcheur neutre (« Synchronisé », « Mis à jour il y a 16 s ») */
.badge-fresh {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--muted);
}
.badge-fresh::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: var(--radius-pill);
  background: var(--success);
}

/* =========================================================================
   BADGE DE STATUT
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  background: var(--greige);
  color: var(--ink);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--navy    { background: var(--navy); color: var(--on-dark); }
/* Corail plein : fond coral-700 (#C73132) + texte blanc gras → ~5.0:1 (AA).
   Le coral pur #E84647 en fond de badge échoue (3.89:1 avec blanc, 12px). */
.badge--coral   { background: var(--coral-700); color: var(--on-dark); font-weight: 700; }

/* =========================================================================
   BOUTONS
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;                 /* un bouton ne casse jamais son libellé */
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primaire marine plein */
.btn-primary {
  background: var(--navy);
  color: var(--on-dark);
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); }

/* Accent corail plein (texte blanc gras, contraste AA) */
.btn-coral {
  background: var(--coral);
  color: var(--on-dark);
  border-color: var(--coral);
  font-weight: 700;
}
.btn-coral:hover { background: var(--coral-700); border-color: var(--coral-700); }

/* Fantôme (contour) */
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--greige); border-color: var(--navy); }

/* Discret (lien-bouton) */
.btn-quiet {
  background: transparent;
  color: var(--navy);
  padding-inline: var(--space-3);
}
.btn-quiet:hover { background: var(--greige); }

.btn--sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn--lg { padding: var(--space-4) var(--space-7); font-size: var(--text-body); }
.btn--block { width: 100%; }

/* Corail plein en PETITE taille (texte blanc < 14px gras) : on bascule le fond
   sur coral-700 (#C73132). Blanc sur coral-700 ≈ 5.0:1 → AA même en 12px, alors
   que le coral pur (#E84647) échouerait (≈4.0:1). S'applique à .btn-coral.btn--sm. */
.btn-coral.btn--sm {
  background: var(--coral-700);
  border-color: var(--coral-700);
}
.btn-coral.btn--sm:hover {
  background: var(--coral-700);
  border-color: var(--coral-700);
  filter: brightness(0.94);
}

/* =========================================================================
   PROGRESSION (barre animable)
   ========================================================================= */
.progress {
  width: 100%;
  height: 8px;
  background: var(--greige);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  width: 0;                            /* piloté par --value (ex: width: var(--value)) */
  background: var(--navy);
  border-radius: var(--radius-pill);
  transition: width var(--dur-counter) var(--ease-out);
}
.progress__bar--coral  { background: var(--coral); }
.progress__bar--salmon { background: var(--salmon); }
.progress__bar--success { background: var(--success); }

/* =========================================================================
   PILL (étiquette douce, ex : langue, niveau CECRL)
   ========================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--greige);
  color: var(--ink);
  border: 1px solid var(--line);
}
.pill--navy   { background: var(--info-soft); color: var(--navy); border-color: transparent; }
.pill--salmon { background: var(--salmon-soft); color: var(--coral-700); border-color: transparent; }

/* =========================================================================
   TABLE (serveur, élégante, lignes aérées)
   ========================================================================= */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table thead th {
  text-align: left;
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--greige);
  padding: var(--space-3) var(--space-5);
  white-space: nowrap;
}
.table tbody td {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--ivory); }
.table--num td, .table--num th { font-variant-numeric: tabular-nums; }
/* En-tête de colonne triable */
.table th[aria-sort] { cursor: pointer; }
.table th[aria-sort]:hover { color: var(--navy); }

/* =========================================================================
   DÉFILEMENT HORIZONTAL (tableaux larges) - flèches + fondus de bord
   Les flèches n'apparaissent que s'il reste du contenu à faire défiler
   (classes .scrollx--l / .scrollx--r posées par le composant ScrollX).
   ========================================================================= */
.scrollx { position: relative; }
.scrollx__viewport { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.scrollx__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--navy);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.scrollx__arrow:hover { background: var(--greige); border-color: var(--navy); }
.scrollx__arrow:active { transform: translateY(-50%) scale(0.92); }
.scrollx__arrow:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.scrollx__arrow svg { width: 18px; height: 18px; }
.scrollx__arrow--left { left: var(--space-3); }
.scrollx__arrow--right { right: var(--space-3); }
.scrollx--l .scrollx__arrow--left { opacity: 1; pointer-events: auto; }
.scrollx--r .scrollx__arrow--right { opacity: 1; pointer-events: auto; }
/* Fondus de bord : signalent visuellement le contenu masqué à gauche/droite. */
.scrollx::before,
.scrollx::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 56px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.scrollx::before { left: 0; background: linear-gradient(90deg, var(--surface) 25%, transparent); }
.scrollx::after { right: 0; background: linear-gradient(270deg, var(--surface) 25%, transparent); }
.scrollx--l::before { opacity: 1; }
.scrollx--r::after { opacity: 1; }

/* =========================================================================
   NAVIGATION - SIDEBAR
   ========================================================================= */
/* Sidebar MARINE (couleur primaire de marque) : tranche avec le panneau ivoire,
   rendu bancaire-grade. Collante (reste en vue quand le contenu défile). */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--navy);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: width var(--dur-base) var(--ease-out);
}
/* Filet lumineux discret en haut (profondeur premium). */
.sidebar::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

/* Tête : pastille de marque + libellé + bouton replier. */
.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: 0 var(--space-2);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: 0;
  font-family: var(--font-serif);
  font-size: var(--text-h4);
  color: var(--on-dark);
}
.sidebar__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--coral);
  color: var(--on-dark);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(232, 70, 71, 0.35);
}
.sidebar__brand-text { color: var(--on-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar__toggle:hover { background: rgba(255, 255, 255, 0.1); color: var(--on-dark); }
.sidebar__toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(246, 188, 179, 0.5); }
.sidebar__toggle svg { width: 18px; height: 18px; }

.sidebar__group-label {
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  padding: var(--space-4) var(--space-3) var(--space-2);
}

/* Item de nav (peut être un <button> : reset propre). */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--on-dark); }
.nav-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(246, 188, 179, 0.5); }
.nav-item--active { background: rgba(255, 255, 255, 0.1); color: var(--on-dark); font-weight: 600; }
.nav-item--active:hover { background: rgba(255, 255, 255, 0.13); }
/* Barre d'accent corail à gauche de l'item actif (signature de marque). */
.nav-item--active::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--coral);
}
.nav-item__icon { width: 20px; height: 20px; flex: none; color: rgba(255, 255, 255, 0.55); transition: color var(--dur-fast) var(--ease-out); }
.nav-item:hover .nav-item__icon { color: var(--on-dark); }
.nav-item--active .nav-item__icon { color: var(--salmon); }
.nav-item__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* État RÉTRACTÉ : icônes seules. La pastille de marque reste (identité). */
.sidebar--collapsed { padding-inline: var(--space-2); }
.sidebar--collapsed .sidebar__head { flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); padding: 0; }
.sidebar--collapsed .sidebar__brand-text,
.sidebar--collapsed .sidebar__group-label,
.sidebar--collapsed .nav-item__label { display: none; }
.sidebar--collapsed .nav-item { justify-content: center; padding-inline: 0; }
.sidebar--collapsed .nav-item--active::before { display: none; }

/* La colonne de contenu suit la largeur de la sidebar en douceur. */
.app-shell { transition: grid-template-columns var(--dur-base) var(--ease-out); }

/* =========================================================================
   NAVIGATION - TOPBAR
   ========================================================================= */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: 0 var(--space-7);
  background: color-mix(in srgb, var(--ivory) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title { font-size: var(--text-h4); margin: 0; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-3); }

/* Bouton burger (caché en desktop, affiché sous --bp-nav par les cockpits) */
.topbar__burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--navy);
  cursor: pointer;
}
.topbar__burger:hover { background: var(--greige); border-color: var(--navy); }
.topbar__burger:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* =========================================================================
   NAVIGATION MOBILE - DRAWER (partagé, piloté par les cockpits sous 1100px)
   Réutilise les .nav-item. Ouvert via [data-nav-open] sur le drawer.
   ========================================================================= */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;                       /* activé en .is-open */
}
.nav-drawer.is-open { display: block; }
.nav-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 15, 0.45);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.nav-drawer.is-open .nav-drawer__scrim { opacity: 1; }
.nav-drawer__panel {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: min(84vw, var(--sidebar-w));
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--dur-base) var(--ease-out);
  box-shadow: var(--shadow-lg);
}
.nav-drawer.is-open .nav-drawer__panel { transform: translateX(0); }
.nav-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.nav-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--navy);
  cursor: pointer;
}
.nav-drawer__close:hover { background: var(--greige); }
.nav-drawer__close:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
@media (prefers-reduced-motion: reduce) {
  .nav-drawer__scrim,
  .nav-drawer__panel { transition: none; }
}

/* =========================================================================
   AVATAR
   ========================================================================= */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: var(--on-dark);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  flex: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar--lg { width: 56px; height: 56px; font-size: var(--text-h4); }
.avatar--coral { background: var(--coral); }

/* =========================================================================
   BOUTON-ICÔNE (cible tactile 44px, ex : cloche de notifications)
   ========================================================================= */
.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { border-color: var(--navy); color: var(--navy); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* =========================================================================
   CHIP DE FILTRE
   ========================================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--navy); }
.chip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.chip--active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--on-dark);
}
.chip__close { font-size: 1em; line-height: 1; opacity: 0.7; }
.chip__close:hover { opacity: 1; }

/* =========================================================================
   CHAMPS DE SAISIE (toujours Inter, jamais de serif)
   ========================================================================= */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}
.input,
.select,
.textarea {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.4;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  width: 100%;
  appearance: none;                    /* tue le rendu natif (flèche système, ombrages OS) */
  -webkit-appearance: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.input::placeholder,
.textarea::placeholder { color: var(--muted); }

/* Survol : la bordure se renforce discrètement (retour d'interactivité). */
.input:hover:not(:disabled):not(:focus),
.select:hover:not(:disabled):not(:focus),
.textarea:hover:not(:disabled):not(:focus) { border-color: var(--muted); }

/* Focus : bordure marine + halo DOUX (pas le halo dur des boutons). */
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(42, 49, 125, 0.14);
}
.input:disabled,
.select:disabled,
.textarea:disabled { background-color: var(--greige); color: var(--muted); cursor: not-allowed; }
.textarea { min-height: 120px; resize: vertical; }

/* Menu déroulant : chevron maison (marine muet), plus la flèche système. Le
   fond reste blanc ; on ne pose QUE l'image de chevron par-dessus. */
.select {
  cursor: pointer;
  padding-right: calc(var(--space-4) + 1.25rem);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%235C5C56'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 1rem;
}
/* Chevron marine au focus/survol (petit soin d'état). */
.select:hover:not(:disabled),
.select:focus {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%232A317D'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E");
}

/* Contrôles compacts pour barres d'action inline (formulaires d'ajout d'un
   profil, d'un enfant, d'une inscription…). Largeur auto : ils s'alignent aux
   boutons dans une .row au lieu de s'étirer à 100 %. */
.input--sm,
.select--sm {
  width: auto;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}
.select--sm {
  padding-right: calc(var(--space-3) + 1.15rem);
  background-position: right var(--space-2) center;
  background-size: 0.9rem;
}

/* Barre de formulaire inline : champs + action alignés, aérés, retour ligne
   propre sur mobile. Remplace les style= flex répétés dans les cockpits. */
.form-inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
/* Chaque contrôle garde sa taille naturelle et passe à la ligne en bloc,
   plutôt que d'être écrasé (bouton dont le libellé se coupe sur 2 lignes). */
.form-inline > * { flex: 0 0 auto; }
/* Champs et boutons d'une même barre à la MÊME hauteur (alignement propre). */
.form-inline > .btn,
.form-inline > .input,
.form-inline > .select { min-height: 2.375rem; }

/* =========================================================================
   ALERTE (info / succès / avertissement / danger)
   ========================================================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  color: var(--ink);
}
.alert__icon { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.alert__title { font-weight: 600; margin-bottom: var(--space-1); }
.alert--info    { background: var(--info-soft);    border-color: color-mix(in srgb, var(--navy) 20%, transparent); }
.alert--info    .alert__icon { color: var(--navy); }
.alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert--success .alert__icon { color: var(--success); }
.alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert--warning .alert__icon { color: var(--warning); }
.alert--danger  { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert--danger  .alert__icon { color: var(--danger); }

/* =========================================================================
   RÉVÉLATION AU SCROLL (.reveal)
   À combiner avec un IntersectionObserver qui ajoute .is-visible.
   Cascade : --reveal-delay sur l'élément (ex: style="--reveal-delay: 120ms").
   ========================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;                   /* libère la GPU une fois révélé */
}
/* Filet de sécurité : si JS échoue ou est bloqué, le contenu .reveal ne doit
   jamais rester invisible. La classe .no-js est posée sur <html> par défaut et
   retirée en tête de script ; sans JS, elle reste et force l'affichage. */
.no-js .reveal { opacity: 1; transform: none; }

/* =========================================================================
   UTILITAIRES MINIMAUX
   ========================================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--space-6); }
.stack > * + * { margin-top: var(--space-4); }
.stack--tight > * + * { margin-top: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }

/* Espacements verticaux courants (remplacent les style= inline structurels). */
.mt-2 { margin-top: var(--space-2); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

/* Cible du lien d'évitement : focus posé sur le conteneur, sans halo visuel. */
[tabindex="-1"]:focus { outline: none; }

/* Masquage visuel mais lisible au lecteur d'écran (en-têtes d'actions, etc.). */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.grid { display: grid; gap: var(--space-4); }
.grid > * { min-width: 0; }            /* enfants de grille : rétrécir au lieu de déborder */
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app-shell > * { min-width: 0; }       /* colonne de contenu : rétrécir au lieu de déborder */
.app-main { padding: var(--space-6); min-width: 0; }

@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }            /* nav mobile gérée par les cockpits */
  .app-main { padding: var(--space-5); }
  :root { --text-display: 2.25rem; --text-h1: 1.75rem; --text-kpi: 2rem; }
}

/* =========================================================================
   ACCESSIBILITÉ - mouvement réduit
   Neutralise toutes les animations/transitions et fige les états révélés.
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .badge-live::before { animation: none; }
}

/* =========================================================================
   LARGEUR DE CONTENU - respiration sur grands écrans
   Le contenu (--content-max) reste à 1240px jusqu'à 1600px, puis s'élargit
   par paliers pour éviter le vide latéral sur les très grands moniteurs, sans
   allonger les lignes de texte au point de nuire à la lecture.
   ========================================================================= */
@media (min-width: 1600px) { :root { --content-max: 1360px; } }
@media (min-width: 1920px) { :root { --content-max: 1500px; } }

/* ============ Board / kanban (CRM pipeline) ============ */
.board { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); }
.board__col {
  flex: 0 0 15rem; display: flex; flex-direction: column; gap: var(--space-2);
  background: var(--ivory, #f6f1e7); border: 1px solid rgba(31, 48, 71, 0.10);
  border-radius: 0.5rem; padding: var(--space-2);
}
.board__col--over { border-color: var(--navy, #1f3047); background: #eee6d6; }
.board__col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 0.85rem; }
.board__col-total { color: var(--text-muted, #6b7280); font-weight: 500; }
.board__card {
  background: #fff; border: 1px solid rgba(31, 48, 71, 0.12); border-radius: 0.375rem;
  padding: var(--space-2); cursor: grab; font-size: 0.8rem;
}
.board__card--drag { opacity: 0.5; }
.board__card-title { font-weight: 600; }
.board__card-meta { color: var(--text-muted, #6b7280); margin-top: 0.15rem; }
