/* =====================================================================
   CRM CENTURY 21 — Design system
   Aucune dépendance, aucune étape de build. Variables CSS + composants.
   Thème clair et sombre pilotés par un attribut sur <html>.
   ===================================================================== */

/* ---------------------------------------------------------------
   1. Jetons de design
   --------------------------------------------------------------- */

:root {
  /* Identité CENTURY 21 */
  --c21-or:            #BEAF87;
  --c21-or-clair:      #D4C9AB;
  --c21-or-fonce:      #9A8B63;
  --c21-or-tres-clair: #F5F1E7;
  --c21-noir:          #1C1C1C;
  --c21-anthracite:    #2B2B2B;

  /* Surfaces */
  --fond:              #F6F6F4;
  --surface:           #FFFFFF;
  --surface-2:         #FAFAF8;
  --surface-3:         #F1F1EE;
  --surface-survol:    #F5F4F1;

  /* Textes */
  --texte:             #1C1C1C;
  --texte-doux:        #5A5A57;
  --texte-faible:      #8C8C88;
  --texte-inverse:     #FFFFFF;

  /* Bordures */
  --bordure:           #E4E4DF;
  --bordure-forte:     #D2D2CB;
  --bordure-focus:     var(--c21-or);

  /* États */
  --succes:            #15803D;
  --succes-fond:       #DCFCE7;
  --alerte:            #B45309;
  --alerte-fond:       #FEF3C7;
  --danger:            #B91C1C;
  --danger-fond:       #FEE2E2;
  --info:              #1D4ED8;
  --info-fond:         #DBEAFE;

  /* Typographie */
  --police: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --police-titre: var(--police);
  --police-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  --t-xs:   0.6875rem;  /* 11px */
  --t-sm:   0.75rem;    /* 12px */
  --t-base: 0.8125rem;  /* 13px — densité CRM */
  --t-md:   0.875rem;   /* 14px */
  --t-lg:   1rem;       /* 16px */
  --t-xl:   1.25rem;    /* 20px */
  --t-2xl:  1.5rem;     /* 24px */
  --t-3xl:  1.875rem;   /* 30px */

  /* Espacements */
  --e-1: 0.25rem;  --e-2: 0.5rem;   --e-3: 0.75rem;  --e-4: 1rem;
  --e-5: 1.25rem;  --e-6: 1.5rem;   --e-8: 2rem;     --e-10: 2.5rem;
  --e-12: 3rem;    --e-16: 4rem;

  /* Rayons */
  --r-sm: 4px;  --r: 8px;  --r-md: 10px;  --r-lg: 14px;  --r-full: 999px;

  /* Ombres */
  --ombre-xs: 0 1px 2px rgba(28, 28, 28, .05);
  --ombre-sm: 0 1px 3px rgba(28, 28, 28, .07), 0 1px 2px rgba(28, 28, 28, .04);
  --ombre:    0 4px 12px rgba(28, 28, 28, .07), 0 1px 3px rgba(28, 28, 28, .05);
  --ombre-lg: 0 12px 32px rgba(28, 28, 28, .11), 0 4px 8px rgba(28, 28, 28, .05);
  --ombre-or: 0 0 0 3px rgba(190, 175, 135, .28);

  /* Dimensions */
  --barre-laterale: 248px;
  --barre-laterale-reduite: 64px;
  --entete-hauteur: 56px;

  --transition: 140ms cubic-bezier(.4, 0, .2, 1);

  color-scheme: light;
}

html[data-theme="sombre"] {
  --fond:            #15161A;
  --surface:         #1C1E23;
  --surface-2:       #212429;
  --surface-3:       #282C32;
  --surface-survol:  #2A2E35;

  --texte:           #ECECE9;
  --texte-doux:      #A8A8A3;
  --texte-faible:    #74746F;
  --texte-inverse:   #15161A;

  --bordure:         #2E323A;
  --bordure-forte:   #3C414A;

  --c21-or-tres-clair: #2A2721;

  --succes-fond:     #14321F;
  --alerte-fond:     #35260C;
  --danger-fond:     #3A1618;
  --info-fond:       #15243F;

  --ombre-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --ombre-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --ombre:    0 4px 12px rgba(0, 0, 0, .45);
  --ombre-lg: 0 12px 32px rgba(0, 0, 0, .55);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --fond:            #15161A;
    --surface:         #1C1E23;
    --surface-2:       #212429;
    --surface-3:       #282C32;
    --surface-survol:  #2A2E35;
    --texte:           #ECECE9;
    --texte-doux:      #A8A8A3;
    --texte-faible:    #74746F;
    --texte-inverse:   #15161A;
    --bordure:         #2E323A;
    --bordure-forte:   #3C414A;
    --c21-or-tres-clair: #2A2721;
    --succes-fond:     #14321F;
    --alerte-fond:     #35260C;
    --danger-fond:     #3A1618;
    --info-fond:       #15243F;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------
   2. Réinitialisation
   --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

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

body {
  font-family: var(--police);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--texte);
  background: var(--fond);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, svg, video, canvas { display: block; max-width: 100%; }

input, button, textarea, select { font: inherit; color: inherit; }

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

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5 {
  font-family: var(--police-titre);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.011em;
}

h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }

:focus-visible {
  outline: 2px solid var(--c21-or);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--c21-or-clair); color: var(--c21-noir); }

/* Barres de défilement discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--bordure-forte) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--bordure-forte);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--texte-faible); background-clip: content-box; }

/* ---------------------------------------------------------------
   3. Structure : barre latérale + contenu
   --------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--barre-laterale) 1fr;
  min-height: 100vh;
}

.app[data-lateral="reduit"] { grid-template-columns: var(--barre-laterale-reduite) 1fr; }

/* --- Barre latérale --- */

.lateral {
  background: var(--c21-noir);
  color: #D9D9D4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 40;
}

.lateral__marque {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: 0 var(--e-4);
  height: var(--entete-hauteur);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.lateral__logo {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--c21-or);
  color: var(--c21-noir);
  display: grid; place-items: center;
  font-weight: 800; font-size: var(--t-sm);
  letter-spacing: -0.03em;
}

.lateral__titre {
  font-weight: 600;
  font-size: var(--t-md);
  color: #FFF;
  letter-spacing: .01em;
  white-space: nowrap;
}
.lateral__titre small {
  display: block;
  font-size: var(--t-xs);
  font-weight: 400;
  color: var(--c21-or);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lateral__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--e-3) var(--e-2) var(--e-4);
}

.lateral__groupe + .lateral__groupe { margin-top: var(--e-4); }

.lateral__groupe-titre {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #6E6E68;
  padding: var(--e-2) var(--e-3) var(--e-1);
  font-weight: 600;
  white-space: nowrap;
}

.lateral__lien {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: 7px var(--e-3);
  border-radius: var(--r);
  color: #C3C3BE;
  font-size: var(--t-md);
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
}

.lateral__lien:hover { background: rgba(255, 255, 255, .06); color: #FFF; }

.lateral__lien.actif {
  background: rgba(190, 175, 135, .16);
  color: var(--c21-or);
}

.lateral__lien.actif::before {
  content: "";
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--c21-or);
  border-radius: 0 3px 3px 0;
}

.lateral__lien svg { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.7; }

.lateral__badge {
  margin-left: auto;
  background: var(--danger);
  color: #FFF;
  font-size: var(--t-xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.lateral__badge--neutre { background: rgba(255,255,255,.14); color: #D9D9D4; }

.lateral__pied {
  flex-shrink: 0;
  padding: var(--e-3);
  border-top: 1px solid rgba(255, 255, 255, .07);
}

/* Mode réduit */
.app[data-lateral="reduit"] .lateral__titre,
.app[data-lateral="reduit"] .lateral__groupe-titre,
.app[data-lateral="reduit"] .lateral__lien span,
.app[data-lateral="reduit"] .lateral__badge { display: none; }

.app[data-lateral="reduit"] .lateral__lien { justify-content: center; padding: 9px; }

/* --- Zone principale --- */

.principal { display: flex; flex-direction: column; min-width: 0; }

.entete {
  height: var(--entete-hauteur);
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: 0 var(--e-5);
  position: sticky;
  top: 0;
  z-index: 30;
}

.entete__recherche {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.entete__recherche input {
  width: 100%;
  height: 34px;
  padding: 0 var(--e-3) 0 34px;
  border: 1px solid var(--bordure);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: var(--t-md);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.entete__recherche input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--c21-or);
  box-shadow: var(--ombre-or);
}

.entete__recherche svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--texte-faible);
  pointer-events: none;
}

.entete__raccourci {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: var(--t-xs);
  color: var(--texte-faible);
  background: var(--surface-3);
  border: 1px solid var(--bordure);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  font-family: var(--police-mono);
  pointer-events: none;
}

.entete__actions { margin-left: auto; display: flex; align-items: center; gap: var(--e-1); }

.contenu {
  flex: 1;
  padding: var(--e-6);
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------------------------------------------------------
   4. En-tête de page
   --------------------------------------------------------------- */

.page-entete {
  display: flex;
  align-items: flex-start;
  gap: var(--e-4);
  flex-wrap: wrap;
  margin-bottom: var(--e-5);
}

.page-entete__texte { min-width: 0; flex: 1; }

.page-entete h1 {
  font-size: var(--t-2xl);
  display: flex;
  align-items: center;
  gap: var(--e-3);
  flex-wrap: wrap;
}

.page-entete__sous-titre {
  color: var(--texte-doux);
  font-size: var(--t-md);
  margin-top: 2px;
}

.page-entete__actions { display: flex; gap: var(--e-2); flex-wrap: wrap; }

.fil-ariane {
  display: flex;
  align-items: center;
  gap: var(--e-2);
  font-size: var(--t-sm);
  color: var(--texte-faible);
  margin-bottom: var(--e-2);
  flex-wrap: wrap;
}
.fil-ariane a:hover { color: var(--c21-or-fonce); }
.fil-ariane__sep { opacity: .5; }

/* ---------------------------------------------------------------
   5. Cartes
   --------------------------------------------------------------- */

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  box-shadow: var(--ombre-xs);
}

.carte__entete {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: var(--e-4) var(--e-5);
  border-bottom: 1px solid var(--bordure);
}

.carte__titre {
  font-size: var(--t-md);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--e-2);
}

.carte__titre svg { width: 16px; height: 16px; color: var(--c21-or-fonce); }

.carte__actions { margin-left: auto; display: flex; gap: var(--e-2); align-items: center; }

.carte__corps { padding: var(--e-5); }
.carte__corps--serre { padding: var(--e-3); }
.carte__corps--nu { padding: 0; }

.carte__pied {
  padding: var(--e-3) var(--e-5);
  border-top: 1px solid var(--bordure);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
  display: flex;
  align-items: center;
  gap: var(--e-3);
}

/* ---------------------------------------------------------------
   6. Grilles
   --------------------------------------------------------------- */

.grille { display: grid; gap: var(--e-4); }
.grille--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grille--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grille--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grille--biens { grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }

.colonnes-principal-lateral {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--e-5);
  align-items: start;
}

@media (max-width: 1100px) {
  .colonnes-principal-lateral { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   7. Indicateurs (KPI)
   --------------------------------------------------------------- */

.kpi {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  padding: var(--e-4);
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

a.kpi:hover {
  border-color: var(--c21-or);
  box-shadow: var(--ombre-sm);
  transform: translateY(-1px);
}

.kpi__haut { display: flex; align-items: center; gap: var(--e-2); }

.kpi__icone {
  width: 32px; height: 32px;
  border-radius: var(--r);
  display: grid; place-items: center;
  background: var(--c21-or-tres-clair);
  color: var(--c21-or-fonce);
  flex-shrink: 0;
}
.kpi__icone svg { width: 16px; height: 16px; }

.kpi__icone--succes { background: var(--succes-fond); color: var(--succes); }
.kpi__icone--alerte { background: var(--alerte-fond); color: var(--alerte); }
.kpi__icone--danger { background: var(--danger-fond); color: var(--danger); }
.kpi__icone--info   { background: var(--info-fond);   color: var(--info); }

.kpi__libelle {
  font-size: var(--t-sm);
  color: var(--texte-doux);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kpi__valeur {
  font-size: var(--t-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi__detail { font-size: var(--t-sm); color: var(--texte-faible); }

.kpi__evolution {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--t-sm);
  font-weight: 600;
}
.kpi__evolution--hausse { color: var(--succes); }
.kpi__evolution--baisse { color: var(--danger); }

/* Jauge de progression vers un objectif */
.jauge {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.jauge__barre {
  height: 100%;
  background: var(--c21-or);
  border-radius: var(--r-full);
  transition: width 400ms cubic-bezier(.4, 0, .2, 1);
}
.jauge__barre--succes { background: var(--succes); }
.jauge__barre--alerte { background: var(--alerte); }
.jauge__barre--danger { background: var(--danger); }

/* ---------------------------------------------------------------
   8. Boutons
   --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--e-2);
  height: 34px;
  padding: 0 var(--e-4);
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: var(--t-md);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition), transform var(--transition);
  user-select: none;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn--principal {
  background: var(--c21-or);
  color: var(--c21-noir);
  font-weight: 600;
  box-shadow: var(--ombre-xs);
}
.btn--principal:hover:not(:disabled) { background: var(--c21-or-fonce); color: #FFF; }

.btn--sombre { background: var(--c21-noir); color: #FFF; }
.btn--sombre:hover:not(:disabled) { background: var(--c21-anthracite); }

.btn--secondaire {
  background: var(--surface);
  border-color: var(--bordure-forte);
  color: var(--texte);
}
.btn--secondaire:hover:not(:disabled) {
  background: var(--surface-survol);
  border-color: var(--texte-faible);
}

.btn--fantome { background: transparent; color: var(--texte-doux); }
.btn--fantome:hover:not(:disabled) { background: var(--surface-3); color: var(--texte); }

.btn--danger { background: var(--danger); color: #FFF; }
.btn--danger:hover:not(:disabled) { background: #991B1B; }

.btn--danger-doux {
  background: transparent;
  color: var(--danger);
  border-color: var(--bordure);
}
.btn--danger-doux:hover:not(:disabled) { background: var(--danger-fond); border-color: var(--danger); }

.btn--succes { background: var(--succes); color: #FFF; }
.btn--succes:hover:not(:disabled) { background: #166534; }

.btn--sm { height: 28px; padding: 0 var(--e-3); font-size: var(--t-sm); }
.btn--sm svg { width: 13px; height: 13px; }
.btn--lg { height: 40px; padding: 0 var(--e-5); font-size: var(--t-lg); }

.btn--icone { width: 34px; padding: 0; }
.btn--icone.btn--sm { width: 28px; }

.btn--bloc { width: 100%; }

.btn-groupe {
  display: inline-flex;
  border: 1px solid var(--bordure-forte);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.btn-groupe .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--bordure);
  height: 32px;
}
.btn-groupe .btn:last-child { border-right: none; }
.btn-groupe .btn.actif { background: var(--c21-or-tres-clair); color: var(--c21-or-fonce); font-weight: 600; }

/* ---------------------------------------------------------------
   9. Formulaires
   --------------------------------------------------------------- */

.champ { margin-bottom: var(--e-4); }

.champ__label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--texte-doux);
  margin-bottom: 5px;
}

.champ__label .requis { color: var(--danger); margin-left: 2px; }

.champ__aide {
  font-size: var(--t-sm);
  color: var(--texte-faible);
  margin-top: 4px;
}

.champ__erreur {
  font-size: var(--t-sm);
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.saisie,
.select,
.zone-texte {
  width: 100%;
  min-height: 34px;
  padding: 6px var(--e-3);
  border: 1px solid var(--bordure-forte);
  border-radius: var(--r);
  background: var(--surface);
  font-size: var(--t-md);
  color: var(--texte);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.saisie:hover, .select:hover, .zone-texte:hover { border-color: var(--texte-faible); }

.saisie:focus, .select:focus, .zone-texte:focus {
  outline: none;
  border-color: var(--c21-or);
  box-shadow: var(--ombre-or);
}

.saisie::placeholder, .zone-texte::placeholder { color: var(--texte-faible); }

.saisie:disabled, .select:disabled, .zone-texte:disabled {
  background: var(--surface-3);
  color: var(--texte-faible);
  cursor: not-allowed;
}

.saisie.erreur, .select.erreur, .zone-texte.erreur {
  border-color: var(--danger);
  background: var(--danger-fond);
}
.saisie.erreur:focus { box-shadow: 0 0 0 3px rgba(185, 28, 28, .18); }

.zone-texte { min-height: 84px; resize: vertical; line-height: 1.6; }

.select {
  appearance: none;
  padding-right: var(--e-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C8C88' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--e-3) center;
}

/* Champ avec unité (m², MAD, %) */
.champ-unite { position: relative; display: flex; }
.champ-unite .saisie { padding-right: 48px; }
.champ-unite__unite {
  position: absolute;
  right: 1px; top: 1px; bottom: 1px;
  display: flex; align-items: center;
  padding: 0 var(--e-3);
  font-size: var(--t-sm);
  color: var(--texte-faible);
  background: var(--surface-3);
  border-radius: 0 var(--r) var(--r) 0;
  pointer-events: none;
  font-weight: 500;
}

/* Intervalle min / max */
.champ-intervalle {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--e-2);
}
.champ-intervalle__sep { color: var(--texte-faible); font-size: var(--t-sm); }

/* Cases à cocher et boutons radio */
.case {
  display: inline-flex;
  align-items: center;
  gap: var(--e-2);
  cursor: pointer;
  font-size: var(--t-md);
  user-select: none;
}

.case input[type="checkbox"],
.case input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--c21-or-fonce);
  cursor: pointer;
  flex-shrink: 0;
}

/* Sélection multiple présentée en pastilles */
.pastilles-choix {
  display: flex;
  flex-wrap: wrap;
  gap: var(--e-2);
}

.pastille-choix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--e-3);
  border: 1px solid var(--bordure-forte);
  border-radius: var(--r-full);
  font-size: var(--t-sm);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  user-select: none;
}
.pastille-choix:hover { border-color: var(--c21-or); background: var(--c21-or-tres-clair); }
.pastille-choix input { position: absolute; opacity: 0; pointer-events: none; }
.pastille-choix:has(input:checked) {
  background: var(--c21-or);
  border-color: var(--c21-or);
  color: var(--c21-noir);
  font-weight: 600;
}

/* Interrupteur */
.interrupteur {
  display: inline-flex;
  align-items: center;
  gap: var(--e-3);
  cursor: pointer;
  user-select: none;
}
.interrupteur input { position: absolute; opacity: 0; }
.interrupteur__piste {
  width: 36px; height: 20px;
  background: var(--bordure-forte);
  border-radius: var(--r-full);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.interrupteur__piste::after {
  content: "";
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: #FFF;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--ombre-xs);
}
.interrupteur input:checked + .interrupteur__piste { background: var(--c21-or); }
.interrupteur input:checked + .interrupteur__piste::after { transform: translateX(16px); }
.interrupteur input:focus-visible + .interrupteur__piste { box-shadow: var(--ombre-or); }

/* Disposition de formulaire */
.form-grille { display: grid; gap: 0 var(--e-4); grid-template-columns: repeat(12, 1fr); }
.col-1{grid-column:span 1}.col-2{grid-column:span 2}.col-3{grid-column:span 3}
.col-4{grid-column:span 4}.col-5{grid-column:span 5}.col-6{grid-column:span 6}
.col-7{grid-column:span 7}.col-8{grid-column:span 8}.col-9{grid-column:span 9}
.col-10{grid-column:span 10}.col-11{grid-column:span 11}.col-12{grid-column:span 12}

@media (max-width: 860px) {
  .form-grille > [class^="col-"] { grid-column: span 12; }
}

.section-form {
  border-top: 1px solid var(--bordure);
  padding-top: var(--e-5);
  margin-top: var(--e-5);
}
.section-form:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.section-form__titre {
  font-size: var(--t-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--c21-or-fonce);
  margin-bottom: var(--e-4);
  display: flex;
  align-items: center;
  gap: var(--e-2);
}

/* ---------------------------------------------------------------
   10. Tableaux
   --------------------------------------------------------------- */

.tableau-conteneur {
  overflow-x: auto;
  border-radius: var(--r-md);
}

.tableau {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-md);
}

.tableau thead th {
  text-align: left;
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--texte-faible);
  padding: var(--e-3) var(--e-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--bordure);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tableau thead th a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tableau thead th a:hover { color: var(--c21-or-fonce); }

.tableau tbody td {
  padding: var(--e-3) var(--e-4);
  border-bottom: 1px solid var(--bordure);
  vertical-align: middle;
}

.tableau tbody tr { transition: background var(--transition); }
.tableau tbody tr:hover { background: var(--surface-survol); }
.tableau tbody tr:last-child td { border-bottom: none; }

.tableau--compact tbody td, .tableau--compact thead th { padding: 6px var(--e-3); }

.tableau .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau .actions { text-align: right; white-space: nowrap; width: 1%; }

.tableau__ligne-lien { cursor: pointer; }

/* Cellule principale : titre + sous-titre */
.cellule-principale { display: flex; align-items: center; gap: var(--e-3); min-width: 0; }
.cellule-principale__texte { min-width: 0; }
.cellule-principale__titre {
  font-weight: 600;
  color: var(--texte);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cellule-principale__titre:hover { color: var(--c21-or-fonce); }
.cellule-principale__sous {
  font-size: var(--t-sm);
  color: var(--texte-faible);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------
   11. Pastilles d'état
   --------------------------------------------------------------- */

.pastille {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--e-2);
  border-radius: var(--r-sm);
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pastille::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pastille--sans-point::before { display: none; }

.pastille--neutre  { background: var(--surface-3);  color: var(--texte-doux); }
.pastille--or      { background: var(--c21-or-tres-clair); color: var(--c21-or-fonce); }
.pastille--succes  { background: var(--succes-fond); color: var(--succes); }
.pastille--alerte  { background: var(--alerte-fond); color: var(--alerte); }
.pastille--danger  { background: var(--danger-fond); color: var(--danger); }
.pastille--info    { background: var(--info-fond);   color: var(--info); }

.pastille--pleine-or     { background: var(--c21-or); color: var(--c21-noir); }
.pastille--pleine-danger { background: var(--danger); color: #FFF; }

/* ---------------------------------------------------------------
   12. Avatars
   --------------------------------------------------------------- */

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c21-or-tres-clair);
  color: var(--c21-or-fonce);
  display: grid; place-items: center;
  font-size: var(--t-sm);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--bordure);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 24px; height: 24px; font-size: var(--t-xs); }
.avatar--lg { width: 44px; height: 44px; font-size: var(--t-md); }
.avatar--xl { width: 72px; height: 72px; font-size: var(--t-xl); }
.avatar--sombre { background: var(--c21-noir); color: var(--c21-or); border-color: transparent; }

.avatars-empiles { display: flex; }
.avatars-empiles .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatars-empiles .avatar:first-child { margin-left: 0; }

/* ---------------------------------------------------------------
   13. Messages flash et encarts
   --------------------------------------------------------------- */

.flash-zone {
  position: fixed;
  top: calc(var(--entete-hauteur) + var(--e-3));
  right: var(--e-5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
  max-width: 400px;
  pointer-events: none;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--e-3);
  padding: var(--e-3) var(--e-4);
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-left: 3px solid var(--texte-faible);
  box-shadow: var(--ombre-lg);
  font-size: var(--t-md);
  pointer-events: auto;
  animation: flash-entree 240ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes flash-entree {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}

.flash--succes { border-left-color: var(--succes); }
.flash--erreur { border-left-color: var(--danger); }
.flash--alerte { border-left-color: var(--alerte); }
.flash--info   { border-left-color: var(--info); }

.flash svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.flash--succes svg { color: var(--succes); }
.flash--erreur svg { color: var(--danger); }
.flash--alerte svg { color: var(--alerte); }
.flash--info   svg { color: var(--info); }

.flash__fermer { margin-left: auto; color: var(--texte-faible); flex-shrink: 0; }
.flash__fermer:hover { color: var(--texte); }

.encart {
  display: flex;
  gap: var(--e-3);
  padding: var(--e-3) var(--e-4);
  border-radius: var(--r);
  font-size: var(--t-md);
  border: 1px solid;
  align-items: flex-start;
}
.encart svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.encart--info   { background: var(--info-fond);   border-color: var(--info);   color: var(--info); }
.encart--succes { background: var(--succes-fond); border-color: var(--succes); color: var(--succes); }
.encart--alerte { background: var(--alerte-fond); border-color: var(--alerte); color: var(--alerte); }
.encart--danger { background: var(--danger-fond); border-color: var(--danger); color: var(--danger); }
.encart strong { font-weight: 700; }

/* ---------------------------------------------------------------
   14. État vide — jamais de cul-de-sac
   --------------------------------------------------------------- */

.vide {
  text-align: center;
  padding: var(--e-12) var(--e-5);
  color: var(--texte-doux);
}

.vide__icone {
  width: 52px; height: 52px;
  margin: 0 auto var(--e-4);
  border-radius: var(--r-lg);
  background: var(--surface-3);
  display: grid; place-items: center;
  color: var(--texte-faible);
}
.vide__icone svg { width: 24px; height: 24px; }

.vide__titre { font-size: var(--t-lg); font-weight: 600; color: var(--texte); margin-bottom: var(--e-2); }
.vide__texte { font-size: var(--t-md); max-width: 380px; margin: 0 auto var(--e-5); }

/* ---------------------------------------------------------------
   15. Onglets
   --------------------------------------------------------------- */

.onglets {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--bordure);
  overflow-x: auto;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }

.onglet {
  padding: var(--e-3) var(--e-4);
  font-size: var(--t-md);
  font-weight: 500;
  color: var(--texte-doux);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  gap: var(--e-2);
}
.onglet:hover { color: var(--texte); }
.onglet.actif { color: var(--c21-or-fonce); border-bottom-color: var(--c21-or); font-weight: 600; }

.onglet__compteur {
  background: var(--surface-3);
  color: var(--texte-doux);
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 0 5px;
  border-radius: var(--r-sm);
  min-width: 17px;
  text-align: center;
}
.onglet.actif .onglet__compteur { background: var(--c21-or-tres-clair); color: var(--c21-or-fonce); }

.onglet-panneau[hidden] { display: none !important; }

/* ---------------------------------------------------------------
   16. Menus déroulants
   --------------------------------------------------------------- */

.menu { position: relative; }

.menu__contenu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 208px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  box-shadow: var(--ombre-lg);
  padding: var(--e-1);
  z-index: 50;
  animation: menu-entree 120ms ease-out;
}

.menu__contenu--gauche { right: auto; left: 0; }
.menu__contenu--haut { top: auto; bottom: calc(100% + 6px); }

@keyframes menu-entree {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.menu__item {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  width: 100%;
  padding: 7px var(--e-3);
  border-radius: var(--r-sm);
  font-size: var(--t-md);
  color: var(--texte);
  text-align: left;
  transition: background var(--transition);
}
.menu__item:hover { background: var(--surface-survol); }
.menu__item svg { width: 15px; height: 15px; color: var(--texte-faible); flex-shrink: 0; }
.menu__item--danger { color: var(--danger); }
.menu__item--danger svg { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-fond); }

.menu__sep { height: 1px; background: var(--bordure); margin: var(--e-1) 0; }

.menu__entete {
  padding: var(--e-3);
  border-bottom: 1px solid var(--bordure);
  margin: calc(var(--e-1) * -1) calc(var(--e-1) * -1) var(--e-1);
}

/* ---------------------------------------------------------------
   17. Fenêtres modales
   --------------------------------------------------------------- */

.modale {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--e-4);
  background: rgba(28, 28, 28, .5);
  backdrop-filter: blur(3px);
  animation: fondu 140ms ease-out;
}

@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }

.modale__boite {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--ombre-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  animation: modale-entree 180ms cubic-bezier(.2, .8, .2, 1);
}

.modale__boite--large { max-width: 840px; }
.modale__boite--xl { max-width: 1120px; }

@keyframes modale-entree {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modale__entete {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: var(--e-4) var(--e-5);
  border-bottom: 1px solid var(--bordure);
  flex-shrink: 0;
}
.modale__titre { font-size: var(--t-lg); font-weight: 600; }
.modale__fermer { margin-left: auto; color: var(--texte-faible); }
.modale__fermer:hover { color: var(--texte); }

.modale__corps { padding: var(--e-5); overflow-y: auto; flex: 1; }

.modale__pied {
  display: flex;
  gap: var(--e-2);
  justify-content: flex-end;
  padding: var(--e-4) var(--e-5);
  border-top: 1px solid var(--bordure);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------
   18. Timeline d'activité
   --------------------------------------------------------------- */

.timeline { position: relative; padding-left: var(--e-8); }

.timeline::before {
  content: "";
  position: absolute;
  left: 15px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--bordure);
}

.timeline__item { position: relative; padding-bottom: var(--e-5); }
.timeline__item:last-child { padding-bottom: 0; }

.timeline__puce {
  position: absolute;
  left: calc(var(--e-8) * -1);
  top: 0;
  width: 31px; height: 31px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--bordure);
  display: grid; place-items: center;
  color: var(--texte-faible);
  z-index: 1;
}
.timeline__puce svg { width: 14px; height: 14px; }

.timeline__puce--or     { background: var(--c21-or-tres-clair); border-color: var(--c21-or); color: var(--c21-or-fonce); }
.timeline__puce--succes { background: var(--succes-fond); border-color: var(--succes); color: var(--succes); }
.timeline__puce--info   { background: var(--info-fond);   border-color: var(--info);   color: var(--info); }
.timeline__puce--danger { background: var(--danger-fond); border-color: var(--danger); color: var(--danger); }

.timeline__entete { display: flex; align-items: baseline; gap: var(--e-2); flex-wrap: wrap; }
.timeline__titre { font-weight: 600; font-size: var(--t-md); }
.timeline__date { font-size: var(--t-sm); color: var(--texte-faible); margin-left: auto; white-space: nowrap; }
.timeline__corps { font-size: var(--t-md); color: var(--texte-doux); margin-top: 3px; }
.timeline__auteur { font-size: var(--t-sm); color: var(--texte-faible); margin-top: 4px; }

/* ---------------------------------------------------------------
   19. Carte de bien (vue grille)
   --------------------------------------------------------------- */

.carte-bien {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.carte-bien:hover {
  border-color: var(--c21-or);
  box-shadow: var(--ombre);
  transform: translateY(-2px);
}

.carte-bien__visuel {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-3);
  overflow: hidden;
}
.carte-bien__visuel img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}
.carte-bien:hover .carte-bien__visuel img { transform: scale(1.04); }

.carte-bien__sans-photo {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--texte-faible);
}
.carte-bien__sans-photo svg { width: 30px; height: 30px; }

.carte-bien__etiquettes {
  position: absolute;
  top: var(--e-2); left: var(--e-2);
  display: flex; gap: 4px; flex-wrap: wrap;
  max-width: calc(100% - var(--e-4));
}

.carte-bien__ref {
  position: absolute;
  bottom: var(--e-2); right: var(--e-2);
  background: rgba(28, 28, 28, .82);
  color: #FFF;
  font-size: var(--t-xs);
  font-family: var(--police-mono);
  padding: 2px 6px;
  border-radius: var(--r-sm);
}

.carte-bien__corps { padding: var(--e-3) var(--e-4); flex: 1; display: flex; flex-direction: column; gap: 5px; }

.carte-bien__prix {
  font-size: var(--t-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.carte-bien__prix small { font-size: var(--t-sm); font-weight: 500; color: var(--texte-faible); }

.carte-bien__titre {
  font-weight: 600;
  font-size: var(--t-md);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.carte-bien__lieu {
  font-size: var(--t-sm);
  color: var(--texte-faible);
  display: flex;
  align-items: center;
  gap: 4px;
}
.carte-bien__lieu svg { width: 12px; height: 12px; flex-shrink: 0; }

.carte-bien__caracteristiques {
  display: flex;
  gap: var(--e-3);
  font-size: var(--t-sm);
  color: var(--texte-doux);
  margin-top: auto;
  padding-top: var(--e-2);
  border-top: 1px solid var(--bordure);
  flex-wrap: wrap;
}
.carte-bien__carac { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.carte-bien__carac svg { width: 13px; height: 13px; color: var(--texte-faible); }

/* ---------------------------------------------------------------
   20. Kanban
   --------------------------------------------------------------- */

.kanban {
  display: flex;
  gap: var(--e-3);
  overflow-x: auto;
  padding-bottom: var(--e-4);
  align-items: flex-start;
  min-height: 480px;
}

.kanban__colonne {
  flex: 0 0 292px;
  background: var(--surface-2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}

.kanban__entete {
  padding: var(--e-3);
  border-bottom: 1px solid var(--bordure);
  display: flex;
  align-items: center;
  gap: var(--e-2);
  flex-shrink: 0;
}

.kanban__puce { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban__nom { font-weight: 600; font-size: var(--t-md); }
.kanban__compteur {
  margin-left: auto;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--texte-faible);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: var(--r-full);
}

.kanban__liste {
  padding: var(--e-2);
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}

.kanban__liste.survol-depot {
  background: var(--c21-or-tres-clair);
  outline: 2px dashed var(--c21-or);
  outline-offset: -4px;
  border-radius: var(--r);
}

.kanban__carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r);
  padding: var(--e-3);
  cursor: grab;
  box-shadow: var(--ombre-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.kanban__carte:hover { box-shadow: var(--ombre-sm); border-color: var(--bordure-forte); }
.kanban__carte:active { cursor: grabbing; }
.kanban__carte.en-deplacement { opacity: .4; }

.kanban__carte-titre { font-weight: 600; font-size: var(--t-md); margin-bottom: 3px; }
.kanban__carte-meta {
  display: flex;
  align-items: center;
  gap: var(--e-2);
  font-size: var(--t-sm);
  color: var(--texte-faible);
  margin-top: var(--e-2);
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------
   21. Barre de filtres
   --------------------------------------------------------------- */

.filtres {
  display: flex;
  gap: var(--e-2);
  flex-wrap: wrap;
  align-items: flex-end;
  padding: var(--e-3) var(--e-4);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  margin-bottom: var(--e-4);
}

.filtres .champ { margin-bottom: 0; }
.filtres .saisie, .filtres .select { height: 32px; font-size: var(--t-md); }

.filtre-actif {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px var(--e-2) 3px var(--e-3);
  background: var(--c21-or-tres-clair);
  color: var(--c21-or-fonce);
  border-radius: var(--r-full);
  font-size: var(--t-sm);
  font-weight: 500;
}
.filtre-actif a { display: grid; place-items: center; opacity: .6; }
.filtre-actif a:hover { opacity: 1; }
.filtre-actif svg { width: 12px; height: 12px; }

/* ---------------------------------------------------------------
   22. Pagination
   --------------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  flex-wrap: wrap;
}

.pagination__info { font-size: var(--t-sm); color: var(--texte-doux); }
.pagination__pages { display: flex; gap: 3px; margin-left: auto; }

.pagination__page {
  min-width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  font-size: var(--t-md);
  color: var(--texte-doux);
  padding: 0 var(--e-2);
  transition: background var(--transition), color var(--transition);
}
.pagination__page:hover { background: var(--surface-3); color: var(--texte); }
.pagination__page.actif { background: var(--c21-or); color: var(--c21-noir); font-weight: 700; }
.pagination__page.desactive { opacity: .4; pointer-events: none; }

/* ---------------------------------------------------------------
   23. Listes descriptives (fiches)
   --------------------------------------------------------------- */

.liste-def { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: var(--e-2) var(--e-4); }
.liste-def dt { font-size: var(--t-sm); color: var(--texte-faible); font-weight: 500; }
.liste-def dd { font-size: var(--t-md); font-weight: 500; min-width: 0; overflow-wrap: break-word; }

.liste-def--lignes { display: block; }
.liste-def--lignes > div {
  display: flex;
  justify-content: space-between;
  gap: var(--e-4);
  padding: 7px 0;
  border-bottom: 1px solid var(--bordure);
}
.liste-def--lignes > div:last-child { border-bottom: none; }

/* ---------------------------------------------------------------
   24. Utilitaires
   --------------------------------------------------------------- */

.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-baseline{ align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1    { flex: 1; min-width: 0; }
.ml-auto   { margin-left: auto; }

.g-1 { gap: var(--e-1); } .g-2 { gap: var(--e-2); } .g-3 { gap: var(--e-3); }
.g-4 { gap: var(--e-4); } .g-5 { gap: var(--e-5); } .g-6 { gap: var(--e-6); }

.mt-1{margin-top:var(--e-1)}.mt-2{margin-top:var(--e-2)}.mt-3{margin-top:var(--e-3)}
.mt-4{margin-top:var(--e-4)}.mt-5{margin-top:var(--e-5)}.mt-6{margin-top:var(--e-6)}
.mb-1{margin-bottom:var(--e-1)}.mb-2{margin-bottom:var(--e-2)}.mb-3{margin-bottom:var(--e-3)}
.mb-4{margin-bottom:var(--e-4)}.mb-5{margin-bottom:var(--e-5)}.mb-6{margin-bottom:var(--e-6)}
.m-0{margin:0}

.t-xs{font-size:var(--t-xs)}.t-sm{font-size:var(--t-sm)}.t-md{font-size:var(--t-md)}
.t-lg{font-size:var(--t-lg)}.t-xl{font-size:var(--t-xl)}.t-2xl{font-size:var(--t-2xl)}

.gras     { font-weight: 600; }
.tres-gras{ font-weight: 700; }
.normal   { font-weight: 400; }

.doux    { color: var(--texte-doux); }
.faible  { color: var(--texte-faible); }
.or      { color: var(--c21-or-fonce); }
.succes  { color: var(--succes); }
.danger  { color: var(--danger); }
.alerte  { color: var(--alerte); }
.info-c  { color: var(--info); }

.centre { text-align: center; }
.droite { text-align: right; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--police-mono); font-size: var(--t-sm); }
.majuscules { text-transform: uppercase; letter-spacing: .06em; }

.tronque { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tronque-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pleine-largeur { width: 100%; }
.cache { display: none !important; }

.separateur { height: 1px; background: var(--bordure); border: none; margin: var(--e-4) 0; }

.puce-couleur { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Infobulle */
[data-infobulle] { position: relative; }
[data-infobulle]::after {
  content: attr(data-infobulle);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c21-noir);
  color: #FFF;
  font-size: var(--t-xs);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 60;
}
[data-infobulle]:hover::after { opacity: 1; }

/* Chargement */
.squelette {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-survol) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: squelette 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes squelette {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.tourniquet {
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tourne .6s linear infinite;
  display: inline-block;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------
   25. Pages sans barre latérale (connexion, erreurs)
   --------------------------------------------------------------- */

.page-nue {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--e-5);
  background:
    radial-gradient(1000px 500px at 12% -8%, rgba(190, 175, 135, .16), transparent 60%),
    radial-gradient(800px 400px at 105% 108%, rgba(190, 175, 135, .10), transparent 55%),
    var(--fond);
}

.boite-auth {
  width: 100%;
  max-width: 404px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-lg);
  box-shadow: var(--ombre-lg);
  padding: var(--e-8);
}

.boite-auth__marque {
  text-align: center;
  margin-bottom: var(--e-6);
}

.boite-auth__logo {
  width: 52px; height: 52px;
  margin: 0 auto var(--e-4);
  border-radius: var(--r-md);
  background: var(--c21-noir);
  color: var(--c21-or);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: var(--t-xl);
  letter-spacing: -0.04em;
}

.boite-auth__titre { font-size: var(--t-xl); margin-bottom: var(--e-1); }
.boite-auth__sous  { font-size: var(--t-md); color: var(--texte-doux); }

/* ---------------------------------------------------------------
   26. Responsive
   --------------------------------------------------------------- */

.bascule-lateral { display: none; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }

  .lateral {
    position: fixed;
    left: 0; top: 0;
    width: var(--barre-laterale);
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--ombre-lg);
  }
  .app[data-lateral-mobile="ouvert"] .lateral { transform: none; }

  .voile-lateral {
    position: fixed;
    inset: 0;
    background: rgba(28, 28, 28, .45);
    z-index: 39;
  }

  .bascule-lateral { display: inline-flex; }

  .contenu { padding: var(--e-4); }
  .entete { padding: 0 var(--e-4); }
  .entete__recherche { max-width: none; }
  .entete__raccourci { display: none; }

  .page-entete { flex-direction: column; align-items: stretch; }
  .page-entete__actions .btn { flex: 1; }

  .flash-zone { left: var(--e-3); right: var(--e-3); max-width: none; }
}

@media (max-width: 640px) {
  :root { --t-base: 0.875rem; --t-md: 0.9375rem; }

  .contenu { padding: var(--e-3); }
  .carte__corps { padding: var(--e-4); }
  .boite-auth { padding: var(--e-5); border: none; box-shadow: none; background: transparent; }

  /* Les tableaux deviennent des cartes empilées */
  .tableau--mobile-cartes thead { display: none; }
  .tableau--mobile-cartes tbody tr {
    display: block;
    border: 1px solid var(--bordure);
    border-radius: var(--r);
    margin-bottom: var(--e-2);
    padding: var(--e-2);
    background: var(--surface);
  }
  .tableau--mobile-cartes tbody td {
    display: flex;
    justify-content: space-between;
    gap: var(--e-3);
    border: none;
    padding: 4px var(--e-2);
    text-align: right;
  }
  .tableau--mobile-cartes tbody td::before {
    content: attr(data-libelle);
    font-size: var(--t-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texte-faible);
    text-align: left;
    flex-shrink: 0;
  }
  .tableau--mobile-cartes tbody td.actions { justify-content: flex-end; }
  .tableau--mobile-cartes tbody td.actions::before { display: none; }
}

/* ---------------------------------------------------------------
   27. Impression
   --------------------------------------------------------------- */

@media print {
  .lateral, .entete, .page-entete__actions, .filtres,
  .pagination, .flash-zone, .btn, .sans-impression { display: none !important; }

  .app { grid-template-columns: 1fr; }
  .contenu { padding: 0; max-width: none; }
  .carte { border: 1px solid #DDD; box-shadow: none; break-inside: avoid; }
  body { background: #FFF; font-size: 11pt; }
  a { text-decoration: none; color: inherit; }
}

/* Respect des préférences d'accessibilité */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
