/* ============================================================
   Proxima — la feuille de styles de CamRack (voir STYLE_GUIDE.md)
   La marque vit dans les jetons --accent* ci-dessous : on la change à UN endroit.

   PALIERS RESPONSIVE — les quatre seuls permis. Une media query ne lit pas de variable :
   les valeurs s'écrivent donc en dur, mais ce sont toujours celles-ci.
     ≤  640 px  téléphone        une colonne, navigation qui défile, marges récupérées
     ≤  900 px  tablette         grilles repliées, menu de réglages au-dessus du contenu
     ≤ 1130 px  portable étroit  navigation repliée par groupes, rail des fiches sous le corps
     ≥ 2000 px  très grand écran l'entête tient sur une seule rangée
   On écrit en max-width (le petit écran en dernier) ; un min-width prend le palier + 1
   (641, 901, 1131). Avant : seize largeurs (400, 480, 560, 600, 700, 720, 760, 820, 960,
   1100, 1280…) qui se chevauchaient et laissaient des trous de 20 px où rien ne tenait.
   ============================================================ */

:root {
    /* Surfaces */
    --bg-primary:    #f8f9fc;
    --bg-secondary:  #ffffff;
    --bg-tertiary:   #f0f1f5;
    --bg-elevated:   #ffffff;
    --bg-glass:       rgba(0, 0, 0, 0.02);
    --bg-glass-hover: rgba(0, 0, 0, 0.04);
    --bg-primary-rgb: 248, 249, 252;

    /* Text — les trois niveaux respectent le contraste WCAG AA (4,5:1 pour du texte
       courant) sur les TROIS surfaces de l'app : --bg-secondary (#ffffff, les cartes),
       --bg-primary (#f8f9fc, la page) et --bg-tertiary (#f0f1f5, les entêtes de table).
       C'est la surface la plus claire qui commande — un gris qui passe sur la page
       échoue souvent sur une carte blanche.
         primary   17,1:1  ·  secondary  7,1:1  ·  muted  5,6:1  (mesuré sur #ffffff)
       Avant ce réglage, « muted » tombait à 2,2:1 : les entêtes de colonnes, les
       libellés de KPI et les aides de formulaire étaient en dessous de la norme. */
    --text-primary:   #1a1a2e;
    --text-secondary: #52586a;
    --text-muted:     #646873;

    /* Accent. --accent porte le TEXTE (liens, onglet actif) ; --accent-fill porte les
       FONDS PLEINS sous du blanc (chip actif, pastille d'identité). Les deux divergent en
       thème sombre : le texte doit s'éclaircir là où le fond doit rester foncé. */
    --accent:         #003ee9;
    --accent-fill:    #003ee9;
    --accent-soft:    rgba(0, 62, 233, 0.10);
    --accent-glow:    rgba(0, 62, 233, 0.16);
    --accent-gradient: linear-gradient(135deg, #003ee9, #3366ff);
    /* La fin claire du dégradé, seule : barres d'avancement, point « Prêt » de l'entête. */
    --accent-progression: #3366ff;

    /* Borders */
    --border:        rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.04);

    /* Scrollbar */
    --scrollbar-thumb:       rgba(0, 0, 0, 0.18);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.32);

    /* Radii */
    --radius-sm:   8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:   0 1px 2px  rgba(0, 0, 0, 0.05);
    --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Le dégradé doux des surfaces d'accueil et le reflet des squelettes de chargement. */
    --accent-wash: radial-gradient(120% 100% at 0% 0%, rgba(0, 62, 233, 0.10) 0%, rgba(0, 62, 233, 0.00) 60%);
    --shimmer: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-glass-hover) 50%, var(--bg-tertiary) 100%);

    /* Le texte posé sur un remplissage plein (bouton primaire, étape en cours, bouton danger).
       Blanc dans les deux thèmes : ce sont les remplissages qui restent assez foncés. */
    --texte-sur-plein: #ffffff;

    /* ---- STATUTS : un seul jeu, quatre sens, cinq rôles ----
       Avant ces jetons, ~150 couleurs de statut étaient écrites en dur — trois rouges « danger »,
       deux ambres pour la même attente, autant de verts — chacune avec sa copie sombre.
       Chaque sens (success · warning · danger · info) a cinq rôles, jamais interchangeables :
         --status-X        le SIGNAL : point, filet, bordure de rappel. Jamais du texte (≈ 3:1).
         --status-X-texte  le TEXTE, sur la surface ou sur son propre fond pâle : ≥ 4,5:1 au pire,
                           calculé sur les trois surfaces du thème, fond pâle composé par-dessus.
         --status-X-fond   le fond pâle d'une pastille, d'un bandeau, d'une ligne marquée.
         --status-X-bord   le contour de ce bandeau ou de cette carte.
         --status-X-plein  un remplissage qui porte du blanc (≥ 4,5:1 sous --texte-sur-plein).
       Fond et bord sont translucides : ils valent dans les deux thèmes. Seul le texte change en
       sombre (plus bas). Le jaune ne dit qu'une chose : quelqu'un doit agir ou décider. */
    --status-success:       #22c55e;
    --status-success-texte: #137638;   /* 4,6:1 au pire (sur son fond, posé sur #f0f1f5) */
    --status-success-fond:  rgba(34, 197, 94, 0.14);
    --status-success-bord:  rgba(34, 197, 94, 0.35);
    --status-success-plein: #15803d;   /* blanc dessus : 5,0:1 */

    --status-warning:       #f59e0b;
    --status-warning-texte: #945a06;   /* 4,6:1 — #d97706 en texte plafonnait à 3,2:1 */
    --status-warning-fond:  rgba(234, 179, 8, 0.16);
    --status-warning-bord:  rgba(234, 179, 8, 0.35);
    --status-warning-plein: #a16207;   /* 4,9:1 */

    --status-danger:        #ef4444;
    --status-danger-texte:  #b91c1c;   /* 4,8:1 — #ef4444 en texte ne donnait que 3,8:1 */
    --status-danger-fond:   rgba(239, 68, 68, 0.14);
    --status-danger-bord:   rgba(239, 68, 68, 0.35);
    --status-danger-plein:  #dc2626;   /* 4,8:1 — blanc sur #ef4444 : 3,8:1, sous la norme */

    --status-info:          #3b82f6;
    --status-info-texte:    #1d4ed8;   /* 5,0:1 */
    --status-info-fond:     rgba(59, 130, 246, 0.16);
    --status-info-bord:     rgba(59, 130, 246, 0.35);
    --status-info-plein:    #2563eb;   /* 5,2:1 */

    /* La teinte DISTINCTE (violet) — un état final ni bon ni mauvais : lead converti, commande
       fabriquée, compte d'administration. Elle épargne au bleu de l'info un second sens. */
    --status-accent-texte:  #6d28d9;   /* 5,2:1 */
    --status-accent-fond:   rgba(139, 92, 246, 0.16);
    --status-accent-bord:   rgba(139, 92, 246, 0.35);

    /* La teinte du TYPE de fiche (entête lead / soumission / commande) — voir .fiche-entete. */
    --fiche-lead:       #f59e0b;
    --fiche-soumission: #3b82f6;
    --fiche-commande:   #22c55e;
    --fiche-dose:       7%;

    /* ---- EMPILEMENT (z-index) : six étages ----
       Une petite valeur locale (1, 2, 3) reste permise À L'INTÉRIEUR d'un composant (en-tête
       collant d'une table, chevron du chemin de vie) : elle ne se compare qu'à ses voisines.
       Tout ce qui flotte au-dessus de la PAGE prend un de ces jetons. Avant, le bandeau
       d'erreur de Blazor et le voile des modales étaient tous deux à 1000 : l'un cachait l'autre.
         --z-dropdown  menus, calendrier, popover de pointage — SOUS l'entête collant : un menu
                       ouvert qui défile passe dessous au lieu de masquer la navigation
         --z-sticky    l'entête de l'app
         --z-bandeau   bandeaux fixés à la fenêtre : conflit d'écriture, reconnexion (celui-ci
                       est un <dialog> modal, donc déjà dans la couche du dessus ; le jeton
                       documente sa place). Au-dessus du contenu, sous tiroirs et modales.
         --z-drawer    le tiroir latéral et son voile
         --z-modal     confirmations et modales — au-dessus du tiroir qui les ouvre
         --z-toast     le bandeau d'erreur de Blazor : rien ne doit pouvoir le cacher */
    --z-dropdown: 30;
    --z-sticky:   50;
    --z-bandeau:  700;
    --z-drawer:   900;
    --z-modal:    1000;
    --z-toast:    1100;

    /* ---- TYPOGRAPHIE : sept crans (le corps est à 15 px, sur html) ----
       Les tailles intermédiaires (12,5 · 13,5 px) restent là où elles règlent une densité
       précise (grilles, rails) ; un nouveau style prend un cran de cette échelle. */
    --fs-xxs: 11px;   /* compteurs, libellés en capitales */
    --fs-xs:  12px;   /* aides, pastilles, cellules denses */
    --fs-sm:  13px;   /* texte secondaire, cellules */
    --fs-md:  14px;   /* onglets, texte des contrôles */
    --fs-lg:  16px;   /* titres de carte et de section */
    --fs-xl:  20px;
    --fs-xxl: 24px;

    /* Un contour qui doit SE VOIR (zone de dépôt en pointillés, cadre d'attente) : --border est
       volontairement presque invisible, trop pour un pointillé qui invite au geste. */
    --border-strong: rgba(0, 0, 0, 0.18);

    /* Surlignage de la vue 3D du configurateur. Orange franc : c'est la couleur
       COMPLÉMENTAIRE du bleu de l'acier, donc la pièce visée ne peut pas se confondre
       avec le rayonnage — même en survolant une zone dense de montants. */
    --surligne: #f2600c;

    /* ---- Fond de l'application : le bleu de marque et sa tapisserie ----
       Repris de Rippa. Le fond porte le dégradé de marque (marine → bleu CamRack) et une
       tapisserie de mini-rayonnages — le PRODUIT de CamRack, dessiné du même trait que le
       logo (wwwroot/images/logo*.svg). La tuile fait 80 px et porte DEUX rayonnages en
       quinconce : sans ce décalage, la répétition se lit comme une grille. Opacité 14 %.

       Ce qui rend l'opération sûre, c'est la FEUILLE : le contenu ne s'écrit pas sur le bleu,
       il remonte sur une surface claire (.app-main). Aucun écran n'a à recolorer son texte. */
    --fond-haut:    #0b1d5e;
    --fond-bas:     #0d47c9;
    --fond-degrade: linear-gradient(160deg, var(--fond-haut) 0%, var(--fond-bas) 100%);
    --fond-motif:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='6' stroke-linecap='round' stroke-linejoin='round' opacity='0.14'%3E%3Cg transform='translate(5 5) scale(0.3)'%3E%3Cpath d='M14 8V92M86 8V92M14 42H86M14 72H86M6 92H22M78 92H94'/%3E%3Crect x='24' y='16' width='24' height='22' rx='2'/%3E%3Crect x='53' y='24' width='23' height='14' rx='2'/%3E%3Crect x='24' y='50' width='52' height='18' rx='2'/%3E%3Crect x='24' y='80' width='20' height='12' rx='2'/%3E%3C/g%3E%3Cg transform='translate(45 45) scale(0.3)'%3E%3Cpath d='M14 8V92M86 8V92M14 42H86M14 72H86M6 92H22M78 92H94'/%3E%3Crect x='24' y='16' width='24' height='22' rx='2'/%3E%3Crect x='53' y='24' width='23' height='14' rx='2'/%3E%3Crect x='24' y='50' width='52' height='18' rx='2'/%3E%3Crect x='24' y='80' width='20' height='12' rx='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");

    /* Le trait et l'encre de ce qui vit À MÊME le bleu — l'entête et le pied, rien d'autre.
       Identiques dans les deux thèmes : le fond y est sombre des deux côtés. */
    --fond-trait:   rgba(255, 255, 255, 0.16);
    --fond-encre:   #ffffff;
    --fond-encre-2: rgba(255, 255, 255, 0.76);
    --fond-encre-3: rgba(255, 255, 255, 0.58);
}

[data-theme="dark"] {
    --fiche-dose:    11%;
    --bg-primary:    #0f1419;
    --bg-secondary:  #161b22;
    --bg-tertiary:   #1e242c;
    --bg-elevated:   #1a2028;
    --bg-glass:       rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --bg-primary-rgb: 15, 20, 25;

    /* Même exigence qu'en thème clair, la surface la plus SOMBRE en moins : ici c'est
       la plus claire (--bg-tertiary #1e242c) qui commande.
         primary  15,7:1  ·  secondary  7,3:1  ·  muted  5,6:1  (mesuré sur #0f1419)
       « muted » était à 3,2:1 sur les entêtes de table — sous la norme lui aussi. */
    --text-primary:   #e6edf3;
    --text-secondary: #9aa4b1;
    --text-muted:     #858d9f;

    /* Les statuts en sombre : seul le TEXTE s'éclaircit (fonds et bords sont translucides, les
       remplissages pleins gardent leur blanc). Contrastes au pire, sur son fond posé sur #1e242c :
       success 7,0:1 · warning 6,8:1 · danger 5,0:1 · info 5,0:1 · accent 4,8:1. */
    --status-success-texte: #4ade80;
    --status-warning-texte: #fbbf24;
    --status-danger-texte:  #f87171;
    --status-info-texte:    #60a5fa;
    --status-accent-texte:  #a78bfa;
    --border-strong: rgba(255, 255, 255, 0.20);

    /* Bleu CamRack éclairci pour le fond sombre — même marque qu'en thème clair,
       juste assez relevée pour que liens et boutons primaires restent lisibles. */
    --accent:      #6b93ff;
    --accent-fill: #2f5ee0;
    --accent-glow: rgba(0, 62, 233, 0.32);
    --accent-soft: rgba(107, 147, 255, 0.16);

    /* Sur fond sombre l'orange doit s'éclaircir, comme l'accent — même rôle, même écart. */
    --surligne: #ffa14a;

    /* Le fond de marque en sombre : le même dégradé, descendu d'un cran. Le motif ne change pas. */
    --fond-haut: #060d2b;
    --fond-bas:  #0a2466;

    --border:        rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);

    --scrollbar-thumb:       rgba(255, 255, 255, 0.18);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.32);

    --shadow-sm: 0 1px 2px  rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);

    color-scheme: dark;
}

/* ---- Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Le fond de marque, posé sur `body` SEUL : tant que <html> n'a pas de fond, celui de <body>
   se propage au canevas et couvre toute la fenêtre. La tapisserie est au-dessus du dégradé,
   et `fixed` l'ancre à la fenêtre — un motif qui défile avec le contenu attire l'œil. */
body {
    background-color: var(--fond-haut);
    background-image: var(--fond-motif), var(--fond-degrade);
    background-attachment: fixed;
}

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

/* ---- Scrollbars ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}
*::-webkit-scrollbar          { width: 10px; height: 10px; }
*::-webkit-scrollbar-track    { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}
*::-webkit-scrollbar-corner   { background: transparent; }

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* L'entête tient sur DEUX rangées par défaut : marque, recherche et outils en haut,
   navigation dessous, sur toute la largeur.

   Pourquoi par défaut et pas seulement sur téléphone : le contenu de l'entête mesure
   ~1980 px (135 de marque + 1073 de navigation + 691 d'outils + marges). Aucun portable
   n'a cette largeur. Tant que la barre gardait `height: 56px`, la navigation se repliait
   sur trois rangées DANS une boîte de 56 px centrée — « Accueil » et « Configurateur »
   passaient au-dessus du haut de la fenêtre, hors d'atteinte à la souris. D'où la règle :
   la hauteur SUIT le contenu (`min-height`, jamais `height`), et la navigation prend sa
   propre rangée dès qu'elle ne rentre pas à côté du reste. */
.appbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    /* min-height, PAS height : une rangée qui se replie doit agrandir la barre, pas
       déborder par-dessus (ou au-dessus de) la page. */
    min-height: 56px;
    padding: 6px 24px;
    /* L'entête vit SUR le bleu (comme chez Rippa). Collante, donc pas transparente : la
       feuille défile dessous. Un marine à 78 % plus le flou suffit. */
    background: color-mix(in srgb, var(--fond-haut) 78%, transparent);
    border-bottom: 1px solid var(--fond-trait);
    backdrop-filter: blur(20px);

    /* Le seul endroit, avec le pied, où le texte s'écrit sur le bleu : on réécrit les JETONS
       pour la sous-arborescence plutôt que de recolorer onglets, recherche et pastilles un
       par un — ils les héritent, y compris à travers le CSS isolé de MainLayout. */
    --text-primary:   var(--fond-encre);
    --text-secondary: var(--fond-encre-2);
    --text-muted:     var(--fond-encre-3);
    --accent:         var(--fond-encre);
    --accent-fill:    rgba(255, 255, 255, 0.22);
    --accent-soft:    rgba(255, 255, 255, 0.18);
    --border:         rgba(255, 255, 255, 0.26);
    --bg-secondary:   rgba(255, 255, 255, 0.10);
    --bg-glass:       rgba(255, 255, 255, 0.10);
    --bg-glass-hover: rgba(255, 255, 255, 0.16);
    /* L'ambre en TEXTE sur le bleu : le foncé du thème clair y serait illisible, et le bleu est
       le même dans les deux thèmes. Un ambre clair, comme en thème sombre, un cran plus pâle. */
    --status-warning-texte: #fcd34d;
}
.appbar-leading,
.appbar-trailing { display: flex; align-items: center; gap: 12px; }
.appbar-leading  { flex: 1 1 auto; min-width: 0; }
.appbar-trailing { flex: 0 0 auto; }
/* La navigation passe en dernier (order) et occupe toute la largeur : sa rangée à elle. */
.appbar-center   { flex: 1 0 100%; min-width: 0; order: 3; }

/* Très grand écran seulement : tout rentre sur une seule rangée, on y revient. */
@media (min-width: 2000px) {
    .appbar { flex-wrap: nowrap; height: 56px; padding: 0 24px; gap: 16px; }
    .appbar-center { flex: 1 1 auto; order: 0; }
}

/* La hauteur de la barre collante, en jeton : tout ce qui se colle SOUS elle (menu de
   configuration, ancres) doit s'en écarter, sinon la barre lui passe par-dessus. Valeur
   volontairement généreuse — trop d'air ne casse rien, pas assez cache le contenu.
   L'ordre compte : le défaut d'abord, les media queries ensuite (même spécificité). */
:root { --appbar-h: 96px; }
@media (min-width: 2000px) { :root { --appbar-h: 56px; } }
@media (max-width: 900px)  { :root { --appbar-h: 140px; } }

.brand-lockup      { display: inline-flex; align-items: center; gap: 12px; }
.brand-lockup-name { font-weight: 600; font-size: 18px; font-family: inherit; letter-spacing: -0.015em; color: var(--text-primary); }

/* LE LOGO de CamRack : un mini-rayonnage, un fichier, deux variantes (images/logo.svg, carré
   de marque pour les feuilles claires ; logo-blanc.svg, le trait seul, pour le bleu). */
.brand-logo { display: block; height: 30px; width: 30px; flex-shrink: 0; }

.appbar-badge {
    font-weight: 500; font-size: var(--fs-xxs); font-family: inherit;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.6;
}
/* Pastille « Dev » (BadgeEnvironnement.razor) : ambre plutôt que l'accent — l'accent dit
   « c'est la marque », l'ambre dit « attention, pas la production ». Teintes de .tag.warn.
   La pastille « Démo » garde la teinte neutre de .appbar-badge : rien à craindre, c'est fictif. */
.appbar-badge.badge-dev {
    /* Ambre CLAIR : sur le bleu de marque, l'ambre foncé serait illisible — et le bleu est le
       même dans les deux thèmes, donc une seule règle. */
    color: var(--status-warning-texte);
    background: color-mix(in srgb, var(--status-warning) 22%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status-warning-texte) 45%, transparent);
}
@media (max-width: 640px) {
    /* Sur téléphone, la phrase entière pousserait la navigation : le titre (survol, lecteur
       d'écran) garde l'explication. */
    .appbar-badge.badge-dev, .appbar-badge.badge-demo {
        max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
}

.status-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500; font-size: var(--fs-xxs); font-family: inherit;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: var(--status-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-success) 18%, transparent);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.btn-icon:hover { background: var(--bg-glass-hover); color: var(--accent); }
.btn-icon.is-active { color: var(--accent); background: var(--accent-soft); }
a.btn-icon { text-decoration: none; }
/* Variante resserrée : dans une ligne de tableau, 34px casserait la hauteur de ligne. */
.btn-icon.compact { width: 26px; height: 26px; font-size: var(--fs-sm); }
/* Variante destructive : le survol vire au rouge, pas à l'accent — supprimer n'est
   pas une action de marque. */
.btn-icon.danger:hover { color: var(--status-danger-texte); background: var(--bg-glass-hover); }

/* ---- Mobile ----
   Sur petit écran, tout débordement horizontal fait « dézoomer » le navigateur, ce qui casse
   toute la mise en page (grilles qui repassent en 2 colonnes, champs coupés). On réduit donc le
   padding de la barre du haut et du contenu pour tout faire tenir dans la largeur de l'écran. */
/* ---- Entête sur petit écran (tablette, téléphone) ----
   Les deux rangées sont déjà la règle par défaut (voir `.appbar` plus haut). Ici, on
   resserre : sur un téléphone, le moindre débordement horizontal fait dézoomer TOUTE la
   page, et l'app devient illisible. La rangée du haut doit donc pouvoir se comprimer —
   la recherche prend ce qui reste au lieu d'imposer sa largeur ; la navigation, elle,
   défile horizontalement (voir MainLayout.razor.css). */
@media (max-width: 900px) {
    .appbar { padding: 8px 14px; gap: 8px 10px; }
    /* La rangée du haut doit pouvoir se comprimer : à 390 px, ses outils mesurent ~590 px
       à leur taille naturelle. Sans `min-width: 0`, un conteneur flex refuse de descendre
       sous son contenu et c'est la PAGE qui s'élargit — le navigateur dézoome alors tout. */
    .appbar-leading  { flex: 0 1 auto; }
    .appbar-trailing { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
    .appbar .search-field,
    .appbar .recherche-globale { flex: 1 1 90px; min-width: 0; }
    .appbar .recherche-champ { width: 100%; min-width: 0; }
    .appbar .personnification { min-width: 0; }
    .appbar .personnification-select { max-width: 110px; }
}

/* Téléphone : la rangée du haut ne rentre plus au mot près (à 390 px, il manquait 22 px).
   On garde l'icône de marque — qui reste le lien vers l'accueil — et on laisse tomber le
   mot, plutôt que de laisser le navigateur dézoomer toute la page. Ce réglage vivait à
   400 px ; il suit maintenant le palier téléphone, comme le reste de l'entête. */
@media (max-width: 640px) {
    .appbar { padding: 8px 12px; gap: 8px; }
    .appbar .brand-lockup-name { display: none; }
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    /* Utilise l'essentiel de la largeur de l'écran (≈ 95 % sur écran standard, plafonné sur
       très grand écran) au lieu de l'ancien 1320px qui laissait de larges marges vides. */
    max-width: min(2000px, 95vw);

    /* LA FEUILLE. Tout le contenu est posé dessus : c'est ce qui permet au fond d'être bleu
       plein sans qu'aucun écran change une couleur de texte. Les marges la font flotter. */
    margin: 20px auto 24px;
    padding: 28px 28px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

/* L'exception : un écran qui n'a rien à porter (la connexion, une carte de 420 px) flotte
   directement sur le bleu. Son titre et son sous-titre passent alors à l'encre claire. */
.app-main-flottant {
    background: none;
    box-shadow: none;
    border-radius: 0;
    margin-top: 0;
}
.app-main-flottant .page-title    { color: var(--fond-encre); }
.app-main-flottant .page-subtitle { color: var(--fond-encre-2); }

/* Un refus (mauvais mot de passe, porte Entra refusée) s'affiche AU-DESSUS de la carte, donc
   sur le bleu : le rouge translucide y serait illisible. Il reprend un fond de carte opaque. */
.app-main-flottant .page > .form-banner.error {
    background: var(--bg-secondary);
    color: var(--status-danger-texte);
}

/* La marque de la porte : le mini-rayonnage et le nom, centrés au-dessus du titre. */
.brand-logo-lg { height: 56px; width: 56px; }
.porte-marque {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}
.porte-marque-nom {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--fond-encre);
}

/* Sur téléphone, on récupère les marges : elles coûtaient 28 px de chaque côté au
   contenu. Cette règle DOIT rester après `.app-main` ci-dessus — à spécificité égale,
   c'est la dernière qui gagne, et écrite avant elle n'avait jamais rien fait. */
@media (max-width: 640px) {
    .app-main {
        padding: 18px 14px;
        margin: 10px auto 14px;
        border-radius: var(--radius-md);
    }
}

/* La tapisserie est DÉCORATIVE : elle part la première dès que la page doit se lire autrement. */
@media print {
    body      { background: #fff; }
    .app-main { margin: 0; background: #fff; box-shadow: none; border-radius: 0; }
}
@media (prefers-contrast: more) {
    body { background-image: none; }
}

/* ---- Footer ---- */
.footer {
    /* Le pied vit sur le bleu, sous la feuille : mêmes jetons d'encre claire que l'entête. */
    background: none;
    border-top: 1px solid var(--fond-trait);
    font-size: var(--fs-sm);

    --text-primary:   var(--fond-encre);
    --text-secondary: var(--fond-encre-2);
    --text-muted:     var(--fond-encre-3);
    color: var(--text-secondary);
}
.footer-minimal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
}
.footer-copy strong { color: var(--text-primary); font-weight: 600; }
.footer-meta { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
    .footer-minimal { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ============================================================
   Page
   ============================================================ */
.page { display: flex; flex-direction: column; gap: 20px; }

/* L'EN-TÊTE DE PAGE — une seule mise en page. 24 pages écrivaient `page-head`, qui n'avait
   aucune règle (titre, sous-titre et pastilles empilés au hasard), deux autres `page-header`.
   `page-head` est la seule forme : plus aucun écran n'écrit `page-header`, son alias est parti.
   Grille : le titre et son sous-titre à gauche ; la zone d'état ou d'actions (.status-row,
   .page-actions) à droite, alignée sur le bas du bloc. fit-content(50 %) borne cette zone :
   une rangée de pastilles ne peut pas écraser le titre. Sur petit écran, elle passe dessous. */
.page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) fit-content(50%);
    column-gap: 16px;
    align-items: end;
}
.page-head > * { grid-column: 1; }
.page-head > :is(.status-row, .page-actions) {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: end;
    justify-self: end;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 6px 8px;
}
/* Une .status-row posée DANS la zone d'actions (les écrans de réglages) doit pouvoir se
   replier aussi : en ligne insécable, ses pastilles débordaient l'écran de 125 px au téléphone. */
.page-head .page-actions > .status-row { flex-wrap: wrap; row-gap: 6px; }
.page-head > .fiche-nav { margin-bottom: 4px; }
@media (max-width: 640px) {
    .page-head { grid-template-columns: minmax(0, 1fr); }
    .page-head > :is(.status-row, .page-actions) {
        grid-column: 1;
        grid-row: auto;
        justify-self: stretch;
        justify-content: flex-start;
        margin-top: 10px;
    }
}
/* FocusOnNavigate (Routes.razor) pose le focus sur le h1 pour les lecteurs d'écran ;
   ce focus programmatique ne doit pas dessiner un cadre autour du titre. */
h1:focus { outline: none; }
.page-title    { font-weight: 600; font-size: 28px; font-family: inherit; letter-spacing: -0.02em; color: var(--text-primary); }
.page-subtitle { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 2px; }

/* ---- Search ---- */
.search-field { position: relative; min-width: 280px; }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: inline-flex;
    pointer-events: none;
}
.input.search-input { padding-left: 36px; }

.input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    /* IMPORTANT : hériter la police du body (Inter). Le raccourci « font: … inherit » est
       invalide et était ignoré → les <input>/<select> tombaient en Arial et les <textarea>
       en monospace. On déclare donc les propriétés séparément. */
    font-family: inherit;
    font-size: var(--fs-md);
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================
   Sélecteurs de date — STYLE_GUIDE §5.8
   Le calendrier est DESSINÉ par nous (composant SelecteurDate.razor) : la fenêtre
   native ne se thème pas, change d'un navigateur à l'autre et parle la langue du
   système. Les règles « input[type=date] » plus bas ne servent que de filet de
   sécurité pour un champ natif résiduel.
   ============================================================ */
.date-field {
    position: relative;
    display: inline-block;
    min-width: 220px;
}
/* Dans une grille de formulaire, le champ suit la colonne — sinon le min-width
   ci-dessus ferait déborder `.form-grid.tight` (colonnes de 155px). */
.form-field .date-field { display: block; width: 100%; min-width: 0; }

.date-field-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-md);
    line-height: 1.5;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.date-field-trigger:hover:not(:disabled) { border-color: var(--text-secondary); }
.date-field.open .date-field-trigger,
.date-field-trigger:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}
.date-field-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}
.date-field-icon  { color: var(--text-muted); flex-shrink: 0; }
.date-field-value { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.date-field-value.empty { color: var(--text-muted); }
.date-field.open .date-field-icon { color: var(--accent); }

.date-picker {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: var(--z-dropdown);
    width: 280px;
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12),
                0 2px 6px  rgba(0, 0, 0, 0.06);
    animation: date-picker-in 0.14s ease-out;
}
@keyframes date-picker-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Sur téléphone, une fenêtre de 280px accrochée à gauche d'un champ déjà décalé fait
   déborder la page — et le navigateur dézoome alors TOUTE l'interface. On l'accroche
   donc à droite du champ et on la plafonne à la largeur de l'écran. */
@media (max-width: 640px) {
    .date-picker {
        left: auto;
        right: 0;
        width: min(280px, calc(100vw - 28px));
    }
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 2px 10px;
}
.date-picker-title {
    font-weight: 600;
    font-size: var(--fs-md);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    text-transform: capitalize;
}
.date-picker-nav {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition), color var(--transition);
}
.date-picker-nav:hover { background: var(--accent-soft); color: var(--accent); }

.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}
.date-picker-weekdays span {
    text-align: center;
    font-weight: 500;
    font-size: var(--fs-xxs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 0;
}

.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.date-picker-day {
    aspect-ratio: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 500;
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.date-picker-day:hover           { background: var(--accent-soft); color: var(--accent); }
.date-picker-day.outside         { color: var(--text-muted); opacity: 0.55; }
.date-picker-day.today           { border-color: var(--accent); }
.date-picker-day.selected,
.date-picker-day.selected:hover  { background: var(--accent-fill); color: var(--texte-sur-plein); border-color: var(--accent-fill); }
.date-picker-day.disabled,
.date-picker-day:disabled        { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

.date-picker-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}
.date-picker-action {
    background: transparent;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background-color 0.12s ease;
}
.date-picker-action:hover { background: var(--accent-soft); }

.date-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-dropdown) - 1);
    background: transparent;
}

/* Filet de sécurité pour un éventuel champ natif : au moins la fenêtre du système
   suit le thème et l'icône ne reste pas noire sur fond sombre. */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    min-width: 160px;
    font-variant-numeric: tabular-nums;
    color-scheme: light;
}
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.12s ease;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator { opacity: 0.85; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }

/* ============================================================
   Champ fichier — STYLE_GUIDE §5.15
   Même raison d'être que le sélecteur de date plus haut : le bouton natif d'un
   « input[type=file] » ne se thème pas, change de dessin d'un navigateur à
   l'autre et parle la LANGUE DU SYSTÈME — « Choose File » / « No file chosen »
   au milieu d'une interface française. On masque donc le champ natif et on
   habille le <label> qui l'enveloppe : cliquer le label ouvre le sélecteur, sans
   une ligne de JavaScript.
   ============================================================ */
.champ-fichier {
    position: relative; /* contient le champ natif rendu invisible ci-dessous */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
/* Le champ reste focusable et annoncé par un lecteur d'écran : on le rend
   invisible, on ne le retire pas avec « display: none ». */
.champ-fichier input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
}
/* Dessin de `.btn-secondary` — un dépôt de fichier n'est pas l'action principale
   d'un écran, il ne prend donc pas le dégradé. */
.champ-fichier-bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    padding: 8px 16px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}
.champ-fichier:hover .champ-fichier-bouton { border-color: var(--text-secondary); color: var(--text-primary); }
/* Le champ étant invisible, l'anneau de focus doit se poser sur le faux bouton :
   sans ça, un parcours au clavier passe sur un contrôle qui ne se voit pas. */
.champ-fichier input[type="file"]:focus-visible + .champ-fichier-bouton {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.champ-fichier input[type="file"]:disabled + .champ-fichier-bouton {
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: var(--border-subtle);
    background: var(--bg-glass);
}

/* Filet de sécurité pour un champ fichier natif résiduel (même rôle que les
   règles « input[type=date] » plus haut) : au minimum nos couleurs et notre
   police, jamais le gris système. */
input[type="file"] {
    font-family: inherit;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 13px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}
input[type="file"]:hover:not(:disabled)::file-selector-button { border-color: var(--text-secondary); color: var(--text-primary); }
input[type="file"]:disabled::file-selector-button {
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: var(--border-subtle);
    background: var(--bg-glass);
}

/* ============================================================
   Buttons — STYLE_GUIDE §5.15
   Quatre variantes, et rien d'autre : primaire (dégradé), secondaire (contour),
   pastille (petite action en ligne) et icône. Chacune accepte `disabled`.
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: var(--texte-sur-plein);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover:not(:disabled)  { transform: translateY(-1px); box-shadow: 0 6px 14px var(--accent-glow), 0 2px 4px rgba(0, 0, 0, 0.06); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 8px 16px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    /* Jamais `transition: all` (STYLE_GUIDE §1.7) : on nomme les propriétés. */
    transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--text-secondary); color: var(--text-primary); }

/* Déclinaison compacte des deux boutons — l'action posée dans un en-tête de carte
   (« + Ajouter… ») ne doit pas peser plus lourd que le titre qu'elle accompagne. */
.btn-primary.btn-sm,
.btn-secondary.btn-sm { padding: 5px 11px; font-size: 12.5px; }

/* Pastille — petite action en ligne (dans un tableau, une carte, une barre d'outils).
   Remplace l'ancien « btn-mini » maison. */
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    padding: 4px 12px;
    font-family: inherit;
    font-size: var(--fs-xs);
    font-weight: 500;
    /* Hauteur fixée ici : sans ça un <a class="chip"> hérite du line-height 1.6 du
       body et se retrouve plus haut qu'un <button class="chip"> voisin. */
    line-height: 1.25;
    color: var(--text-secondary);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}
.chip:hover:not(:disabled) {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
/* État « activé » d'une pastille bascule (ex. contact principal, filtre en cours). */
.chip.is-on {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Action textuelle — même rôle que `.date-picker-action` du style guide : pas de
   contour, texte d'accent, fond doux au survol. Utilisée dans les tableaux et les
   entêtes de carte, là où un contour ajouterait du bruit. */
.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: transparent;
    padding: 3px 8px;
    margin: -3px 0;
    font-family: inherit;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--accent);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.btn-link:hover:not(:disabled) { background: var(--accent-soft); }

/* Un bouton désactivé doit SE VOIR comme désactivé : sans ça, un « btn-primary »
   inactif gardait sa couleur vive et invitait au clic. `pointer-events: none`
   garantit en plus qu'aucun état de survol ne se déclenche (STYLE_GUIDE §5.15). */
.btn-secondary:disabled,
.chip:disabled,
.btn-link:disabled,
.btn-icon:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
    transform: none !important;
}
/* Le primaire perd son dégradé : un fond neutre dit « indisponible » mieux qu'une
   opacité, qui laisserait deviner un bouton d'action bien vivant. */
.btn-primary:disabled {
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    box-shadow: none;
    opacity: 1;
}
.btn-secondary:disabled {
    color: var(--text-muted);
    border-color: var(--border-subtle);
    background: var(--bg-glass);
}
.chip:disabled {
    color: var(--text-muted);
    border-color: var(--border-subtle);
    background: transparent;
}

/* En-têtes de colonnes cliquables (tri) — ils se lisent comme le libellé lui-même.
   Posés sur les en-têtes de toute grille `.data-table` (DataTable et tables écrites à la main). */
.data-table thead th .th-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}
.data-table thead th .th-sort:hover { color: var(--text-primary); }
.data-table thead th .th-sort:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.data-table thead th:not([aria-sort="none"]) .th-sort { color: var(--text-primary); }
.sort-arrow {
    /* Seule taille sous 11 px permise : un glyphe décoratif (aria-hidden) ; le tri s'annonce
       par aria-sort et se lit au libellé de la colonne. */
    font-size: 10px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.sort-arrow.is-active {
    opacity: 1;
    color: var(--accent);
}

/* ============================================================
   Tags — la petite taille (capitales 10 px) de la famille des pastilles
   Mêmes variantes que .pill (plus bas) : .tag.pill-ok, .tag.pill-danger… Les anciens noms
   (tag-success, warn, error, tag-info) en sont des alias, déclarés avec les variantes.
   ============================================================ */
.tag {
    display: inline-block;
    padding: 3px 8px;
    background: var(--badge-fond, var(--accent-soft));
    color: var(--badge-texte, var(--accent));
    font-weight: 600;
    font-size: var(--fs-xxs);
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

/* ============================================================
   Cards / details
   ============================================================ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
/* En-tête de carte : titre à gauche, action (ex. « + Nouvelle soumission ») à droite,
   avec de l'air autour du bouton pour qu'il ne colle ni au titre ni au corps. */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.card-head .btn-primary,
.card-head .btn-secondary,
.card-head .btn-link { margin-left: auto; }
/* Titre de carte. 69 titres écrivaient `card-title` sans qu'aucune règle n'existe : ils
   tombaient au <h2> du navigateur (~22 px, gras), plus fort que le titre de la page. On les
   aligne sur l'échelle des titres de section (.form-card-head h3, .section-title) : 16 px / 600.
   Hors d'un .card-head (titre seul en haut de carte), il garde un peu d'air sous lui. */
.card-title {
    font-weight: 600;
    font-size: var(--fs-lg);
    font-family: inherit;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}
.card > .card-title,
.card-body > .card-title { margin-bottom: 12px; }

/* Lignes de tableau cliquables (ouvrent le détail) — voir DataTable RowHref. */
.data-table tbody tr.row-link { cursor: pointer; transition: background-color 0.12s ease; }
.data-table tbody tr.row-link:hover { background: var(--bg-glass-hover); }

/* ── Files d'attente (bande de cartes au-dessus d'une grille) ─────────────────
   Partagé par /soumissions (approbation · relance) et /leads (à contacter ·
   à relancer) : ce sont des FILES, pas des chapitres — on les balaye du regard,
   on n'y lit pas ligne à ligne. Empilées pleine largeur, elles poussaient la
   grille de la page hors écran ; en bande, la grille reste visible sans défiler.
   auto-fit plutôt qu'un « repeat(n, …) » figé : quand une seule file a du
   contenu, elle occupe la largeur au lieu de laisser un trou. */
.files-attente {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
    align-items: start;
}

/* Version compacte de la carte : moins d'air qu'une carte de page, parce que
   plusieurs d'entre elles partagent la largeur. */
.file-card { padding: 14px 16px; }

/* La note du bandeau ne tient plus à droite du titre dans une colonne étroite :
   elle passe dessous, en petit. */
.file-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 10px;
}
.file-titre { font-size: 15px; letter-spacing: -0.01em; }
.file-note { font-size: 11.5px; line-height: 1.35; color: var(--text-muted); }

.file-liste { list-style: none; margin: 0; padding: 0; }
/* Deux temps par dossier : QUI sur la première ligne, COMBIEN et QUAND en gris
   sur la seconde. Un filet sépare les dossiers — sans lui, les deux lignes d'un
   même dossier se confondent avec celles du suivant. */
.file-ligne {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.file-ligne:first-child { padding-top: 0; }
.file-ligne:last-child { padding-bottom: 0; border-bottom: 0; }

.file-tete { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-sm); }
/* Le nom du client cède le premier : le numéro et la pastille ne doivent jamais
   être coupés, ce sont eux qui identifient le dossier. */
.file-client {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}
.file-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.file-montant { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* Une pastille de file reste lisible mais tient moins de place que dans une
   grille pleine largeur. */
.file-tete .pill { padding: 1px 8px; font-size: var(--fs-xxs); }

/* ── Funnel de vente (tableau de bord) : cône Lead → Soumission → Commande ────────
   Les paliers sont centrés et se rétrécissent, formant un cône. Chaque barre est
   un trapèze (clip-path) pour que les bords « rentrent » vers l'étage suivant. */
.funnel { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 560px; margin: 0 auto; }
.funnel-stage { display: flex; flex-direction: column; align-items: center; width: 100%; }
.funnel-bar {
    height: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    color: var(--texte-sur-plein);
    text-align: center;
    text-decoration: none;
    min-width: 150px;
    clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
    transition: width 0.3s ease, filter 0.15s ease;
}
a.funnel-bar:hover { filter: brightness(1.06); }
.funnel-bar.stage-lead       { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.funnel-bar.stage-soumission { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.funnel-bar.stage-commande   { background: var(--accent-progression); }
.funnel-count { font-weight: 700; font-size: 22px; line-height: 1.05; font-variant-numeric: tabular-nums; }
/* Pas d'opacité sur le libellé : à 0,92, le blanc tombait à 4,2:1 sur le bleu de « Commande ». */
.funnel-stage-label { font-size: var(--fs-xxs); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.funnel-meta { font-size: 12.5px; color: var(--text-secondary); text-align: center; margin: 3px 0 6px; }
.funnel-meta strong { color: var(--text-primary); }
.funnel-arrow { display: block; color: var(--text-muted); font-size: var(--fs-md); line-height: 1; }

/* ── Import d'un lead depuis « Nouvelle soumission » ─────────────────────────── */
.lead-import {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 14px 16px; margin-bottom: 16px;
    background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.lead-import-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; }
.lead-import-txt strong { font-size: var(--fs-md); color: var(--text-primary); }
.lead-import-txt span { font-size: 12.5px; color: var(--text-secondary); }
.lead-import .input { max-width: 320px; }

/* ── Carte « Coordonnées & besoin » d'un lead (visuel moderne) ───────────────── */
.lead-identite { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.lead-avatar {
    flex: none; width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--accent-gradient); color: var(--texte-sur-plein);
    font-weight: 700; font-size: 18px; letter-spacing: 0.02em;
}
.lead-nom { font-weight: 650; font-size: 17px; letter-spacing: -0.01em; color: var(--text-primary); }
.lead-entreprise { font-size: var(--fs-sm); color: var(--text-secondary); }
.lead-coords { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.lead-coord {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-glass); text-decoration: none; transition: border-color 0.12s ease, background 0.12s ease;
}
a.lead-coord:hover { border-color: var(--accent); background: var(--bg-glass-hover); }
/* Une coordonnée absente se lit « vide » par son trait pointillé et son encre « muted » —
   pas par une opacité, qui faisait tomber le libellé à 2,2:1. */
.lead-coord.is-vide { pointer-events: none; border-style: dashed; background: transparent; }
.lead-coord.is-vide .lead-coord-ico { background: var(--bg-tertiary); color: var(--text-muted); }
.lead-coord.is-vide .lead-coord-val { color: var(--text-muted); }
.lead-coord-ico {
    flex: none; width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent);
}
.lead-coord-txt { display: flex; flex-direction: column; min-width: 0; }
.lead-coord-lbl { font-size: var(--fs-xxs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.lead-coord-val { font-size: 13.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-besoin {
    margin-top: 16px; padding: 14px 16px;
    border-radius: var(--radius-md); border: 1px solid var(--border);
    background: var(--accent-wash, var(--bg-glass));
}
.lead-besoin-lbl { font-size: var(--fs-xxs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-bottom: 5px; }
.lead-besoin-txt { font-size: 14.5px; line-height: 1.55; color: var(--text-primary); }
.lead-besoin-notes { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 8px; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-title { font-weight: 600; font-size: 17px; font-family: inherit; color: var(--text-primary); letter-spacing: -0.01em; }
.empty-state-body  { font-size: 13.5px; line-height: 1.55; max-width: 360px; color: var(--text-muted); margin-bottom: 8px; }

/* ---- Blazor error UI ---- */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-toast);
    padding: 12px 24px;
    /* Opaque (il flotte sur la page) : la teinte de danger posée sur la surface du thème. */
    background: linear-gradient(var(--status-danger-fond), var(--status-danger-fond)), var(--bg-secondary);
    color: var(--status-danger-texte);
    border-top: 1px solid var(--status-danger-bord);
    font-size: var(--fs-sm);
}
#blazor-error-ui .reload { color: inherit; font-weight: 600; text-decoration: underline; margin-left: 6px; }
/* La croix est un <button> (App.razor) : on lui retire l'allure de bouton du navigateur,
   et on lui garde un anneau de focus visible au clavier. */
#blazor-error-ui .dismiss {
    float: right;
    padding: 0 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: inherit;
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    cursor: pointer;
}
#blazor-error-ui .dismiss:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

@media (max-width: 640px) {
    .search-field { min-width: 0; width: 100%; }
}

/* ============================================================
   Onglets, tuiles KPI, grilles de données
   ============================================================ */
.section-title {
    font-weight: 600; font-size: var(--fs-lg); font-family: inherit;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 26px 0 12px;
}

/* ---- Onglets (composant <Onglets>, Components/Shared/Onglets.razor) ----
   Le seul style d'onglets de l'app. Le carnet de commandes garde sa variante animée
   (`.vue-onglet`, Commandes.razor.css), avec le même contrat clavier. */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    /* Espace sous les onglets réduit (au-dessus des barres d'outils) — interface plus compacte. */
    margin: 16px 0 12px;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 10px 14px;
    font-weight: 500; font-size: var(--fs-md); font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
/* Le clavier parcourt les onglets (<Onglets>) : l'onglet qui a le focus doit se voir. */
.tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft), inset 0 0 0 1px var(--accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
/* Variante resserrée, sans filet de base : des onglets posés dans l'en-tête d'une carte
   (le fil d'un dossier), à côté de son titre. */
.tabs.tabs-compact { margin: 0; border-bottom: 0; }
.tabs-compact .tab { padding: 6px 10px; font-size: var(--fs-sm); }
/* Le filet entre deux familles d'onglets (le dossier · la décision · l'atelier · la trace). */
.onglet-filet { flex: none; width: 1px; align-self: stretch; margin: 8px 3px; background: var(--border); }
.tab-count {
    font-size: var(--fs-xxs);
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ---- KPI cards ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}
.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}
.kpi-label { font-weight: 500; font-size: var(--fs-xxs); font-family: inherit; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.kpi-value { font-weight: 600; font-size: 22px; font-family: inherit; letter-spacing: -0.02em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kpi-value.neg { color: var(--status-danger-texte); }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-muted); }
/* Tuile KPI cliquable (ex. « Leads actifs » → /leads). */
a.kpi-card { text-decoration: none; color: inherit; transition: border-color 0.12s ease, background 0.12s ease; }
a.kpi-card:hover { border-color: var(--accent); background: var(--bg-glass-hover); }

.muted { color: var(--text-muted); }

/* ---- La grille : `.data-scroll` (le cadre qui défile) + `.data-table` ---- */
.data-scroll {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;
}
/* Les longues tables utilisent ~toute la hauteur d'écran restante (au lieu d'un plafond fixe à 560px)
   pour voir beaucoup plus de lignes sans rogner l'en-tête de page. Plancher pour les petits écrans. */
.data-scroll.tall { max-height: calc(100vh - 240px); min-height: 360px; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    white-space: nowrap;
}
/* Une table large défile DANS sa carte : le corps de page, lui, ne part jamais de côté. */
.table-scroll-x { overflow-x: auto; }
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-tertiary);
    text-align: left;
    padding: 10px 14px;
    font-weight: 600; font-size: var(--fs-xxs); font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.data-table tbody td {
    padding: 9px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}
.data-table tbody tr:hover { background: var(--bg-glass-hover); }
.data-table tfoot td {
    position: sticky;
    bottom: 0;
    background: var(--bg-tertiary);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-top: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: var(--fs-xs); color: var(--text-secondary); }
/* Un montant négatif en rouge, un écart favorable en vert — en TEXTE, donc les jetons -texte. */
.data-table .neg { color: var(--status-danger-texte); }
.data-table .pos { color: var(--status-success-texte); }

/* ---- DataTable: filter row + empty state ---- */
.data-table-wrap { display: flex; flex-direction: column; gap: 12px; }
.table-filter { min-width: 0; width: 100%; max-width: 380px; }
.table-filter .search-input { padding-right: 70px; }
.table-filter-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.data-table .empty-row { text-align: center; color: var(--text-muted); padding: 22px; }

/* ---- Barre de filtres d'une liste ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-years { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: var(--fs-sm); color: var(--text-muted); }
/* Les pastilles de filtre utilisent `.chip` / `.chip.is-on` (section Buttons) :
   une seule pastille dans toute l'app, celle du style guide. */
.filter-count { margin-left: auto; font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 4px;
}
.form-grid.tight { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.span-2 { grid-column: span 2; }
/* Sur téléphone, la grille n'a plus qu'une colonne : « span 2 » y créait une seconde colonne
   IMPLICITE de ~70 px, et tous les champs voisins s'y entassaient (« Vendeur » coupé dans
   la nouvelle soumission). « 1 / -1 » = toute la largeur, quel que soit le nombre de colonnes. */
@media (max-width: 640px) {
    .form-field.span-2 { grid-column: 1 / -1; }
}
.form-field label { font-weight: 500; font-size: var(--fs-xs); font-family: inherit; color: var(--text-secondary); }
.form-field .req { color: var(--status-danger-texte); }
.form-field .form-label { font-weight: 500; font-size: var(--fs-xs); color: var(--text-secondary); }
.form-field .valeur-lue { margin: 0; font-size: 13px; }
.texte-alerte { color: var(--status-danger-texte); }

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
/* Variante « à gauche » (16 usages, jamais stylée jusqu'ici) : les boutons qui suivent un
   champ ou une note dans une carte étroite — au fil de la lecture, pas au bout de la ligne.
   flex-wrap : sur téléphone, deux boutons trop larges passent l'un sous l'autre. */
.form-actions.gauche { justify-content: flex-start; flex-wrap: wrap; }

.form-card { margin-bottom: 18px; }
.form-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.form-card-head h2, .form-card-head h3 { font-weight: 600; font-size: var(--fs-lg); font-family: inherit; color: var(--text-primary); }
.form-card-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 15px; }
.form-card-close:hover { color: var(--text-primary); }
.form-subhead { font-weight: 600; font-size: var(--fs-xs); font-family: inherit; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin: 18px 0 10px; }

.form-banner {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 14px;
}
.form-banner.success { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.form-banner.error {
    background: var(--status-danger-fond);
    color: var(--status-danger-texte);
    border: 1px solid var(--status-danger-bord);
}
/* Ambre : « attention, ce n'est pas le cas courant » (ex. pointage daté d'un jour passé). */
.form-banner.warn {
    background: var(--status-warning-fond);
    color: var(--status-warning-texte);
    border: 1px solid var(--status-warning);
}
/* Le dossier a été enregistré par quelqu'un d'autre : le message et le seul geste sûr, côte à côte.
   FIXÉ en bas de l'écran : le geste refusé se fait souvent loin du haut de la fiche (le dépôt,
   dans le rail), et un bandeau resté en haut, hors de vue, laisserait croire que c'est enregistré.
   Fond opaque sous la teinte ambre, puisqu'il flotte par-dessus le contenu. */
.form-banner.bandeau-conflit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 32px));
    margin: 0;
    z-index: var(--z-bandeau);
    background: linear-gradient(var(--status-warning-fond), var(--status-warning-fond)), var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}

.form-hint { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: 12px; }

/* ── L'escalier : un formulaire en étapes numérotées, reliées par un trait ────
   (STYLE_GUIDE §5.21) Nouvelle soumission et la forge le portent ; il était copié de l'une
   à l'autre. Préfixé `escalier-` : « num », « rail » et « step » sont déjà pris ailleurs
   (cellules numériques, rail des fiches).
     <div class="escalier">
       <div class="escalier-etape">
         <div class="escalier-rail"><div class="escalier-num">1</div><div class="escalier-trait"></div></div>
         <div class="escalier-contenu"><div class="escalier-titre">…</div><div class="escalier-desc">…</div>…</div>
       </div>
     </div>
   La dernière étape n'a pas de trait. */
.escalier-etape { display: flex; gap: 16px; }
.escalier-rail { display: flex; flex-direction: column; align-items: center; flex: none; }
.escalier-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-fill);
    color: var(--texte-sur-plein);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--fs-sm);
    flex: none;
}
.escalier-trait { flex: 1; width: 2px; background: var(--border); margin: 5px 0; }
.escalier-contenu { flex: 1; min-width: 0; padding-bottom: 24px; }
.escalier-etape:last-child .escalier-contenu { padding-bottom: 0; }
.escalier-titre { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.escalier-desc { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 11px; }

/* ── LES PASTILLES : une seule famille de badges ──────────────────────────────
   Trois tailles, une seule palette :
     .tag   petite, en capitales 10 px (une étiquette dans une ligne de tableau) ;
     .pill  la pastille courante, 12 px (un statut dans une grille, une carte) ;
     .etat  le GROS statut d'une fiche, avec son point (plus bas, section « La fiche »).
   Six variantes sémantiques, qui ne posent que deux variables (--badge-texte, --badge-fond) :
   la taille les lit. Une variante se combine donc avec n'importe quelle taille.
     pill-ok         acquis, fait, accepté            (vert)
     pill-attention  quelqu'un doit agir ou décider   (jaune)
     pill-danger     refusé, en retard, bloqué        (rouge)
     pill-info       en cours, envoyé                 (bleu)
     pill-neutre     sans jugement                    (gris)
     pill-accent     un état final distinct           (violet : converti, fabriqué)
   Sans variante, la pastille prend l'accent de marque. */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: var(--badge-fond, var(--accent-soft));
    color: var(--badge-texte, var(--accent));
    font-weight: 600; font-size: var(--fs-xs); font-family: inherit;
}
/* Les anciens noms restent des ALIAS : ils sont encore écrits dans des écrans (pill-jaune,
   pill-rouge…, tag-success, warn, error, est-jaune…). On écrit les noms sémantiques. */
.pill-ok,
.tag.tag-success,
.etat.est-ok        { --badge-texte: var(--status-success-texte); --badge-fond: var(--status-success-fond); }
.pill-attention,
.pill-warn, .pill-jaune,
.tag.warn,
.etat.est-jaune     { --badge-texte: var(--status-warning-texte); --badge-fond: var(--status-warning-fond); }
.pill-danger,
.pill-rouge,
.tag.error,
.etat.est-rouge     { --badge-texte: var(--status-danger-texte);  --badge-fond: var(--status-danger-fond); }
.pill-info,
.pill-bleu,
.etat.est-bleu      { --badge-texte: var(--status-info-texte);    --badge-fond: var(--status-info-fond); }
.pill-neutre,
.tag.tag-info       { --badge-texte: var(--text-secondary);       --badge-fond: var(--bg-tertiary); }
.pill-accent,
.pill-violet        { --badge-texte: var(--status-accent-texte);  --badge-fond: var(--status-accent-fond); }

.clean-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clean-list-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-secondary); }

/* ── Listes de totaux et blocs de fiche ──────────────────────────────────────
   Ces deux-là étaient recopiés dans le CSS scoped de chaque fiche. Ils montent
   ici parce que la fiche commande est désormais faite de PLUSIEURS composants
   (entête, lignes, cycle de vie…) : une règle scoped à la page ne les atteindrait
   plus. Les autres fiches gardent leur copie locale, qui l'emporte — rien ne
   bouge chez elles. */
.totaux-liste { list-style: none; margin: 0; padding: 0; }
.totaux-liste li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13.5px;
}
.totaux-liste li span { color: var(--text-secondary); }
.totaux-liste li strong { font-variant-numeric: tabular-nums; text-align: right; }
.totaux-liste li.total {
    border-bottom: none;
    border-top: 2px solid var(--accent);
    margin-top: 4px;
    padding-top: 10px;
    font-size: var(--fs-lg);
}
.totaux-liste li.total strong { color: var(--accent); }

.commande-bloc { border-top: 1px solid var(--border); padding-top: 14px; }
.commande-bloc .stitle { font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); }

/* ── Production : barre d'avancement + pointage rapide ──────────────────────── */
.prod-bar {
    display: inline-block;
    width: 90px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--border-subtle);
    overflow: hidden;
    vertical-align: middle;
    flex: none;
}
.prod-bar.lg { width: 160px; height: 10px; }
.prod-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    /* La couleur de marque de l'avancement : la fin claire du dégradé d'accent. */
    background: var(--accent-progression);
    transition: width 0.25s ease;
}

.pointage { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.pointage-btns { display: inline-flex; align-items: center; gap: 4px; }

.pointage-btns .chip { padding: 4px 9px; }

/* ============================================================
   Configuration — barre latérale groupée
   Idiome maison : les écrans de configuration se choisissent dans
   une colonne collante, groupée par domaine — pas une rangée d'onglets qui
   passerait à la ligne quand un écran s'ajoute, ni une longue page à défiler.
   ============================================================ */
.config-layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.config-nav {
    display: grid;
    gap: 18px;
    position: sticky;
    top: calc(var(--appbar-h) + 20px);   /* la barre d'app est collante : s'en écarter */
}
.config-nav-group { display: grid; gap: 2px; }
.config-nav-title {
    font-size: var(--fs-xxs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 10px 6px;
}
.config-nav-item {
    appearance: none;
    /* Flex plutôt que bloc : le libellé à gauche, le compteur à droite quand il y en a
       un (fiche commande). Sans compteur — les écrans de configuration — c'est un
       no-op : le texte reste calé à gauche. */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    padding: 8px 12px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.config-nav-item:hover { color: var(--text-primary); background: var(--bg-glass-hover); }
.config-nav-item.is-active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-glass-hover);
}
/* Un lien vers un autre écran de réglage se présente comme les onglets — même
   colonne, même geste ; seul l'atterrissage diffère. */
a.config-nav-item { display: block; }

/* Le panneau ne doit jamais pousser la grille : les tableaux larges défilent chez eux. */
.config-panel { min-width: 0; }

/* Sous 900 px la barre repasse au-dessus du contenu, en rangée défilante — mieux
   qu'une colonne de 232 px qui mangerait la moitié d'un écran de portable. */
@media (max-width: 900px) {
    .config-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .config-nav {
        position: static;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        gap: 20px;
        overflow-x: auto;
        padding-bottom: 6px;
        border-bottom: 1px solid var(--border);
    }
    .config-nav-group { grid-auto-flow: column; grid-auto-columns: max-content; gap: 4px; align-items: center; }
    .config-nav-title { padding: 0 6px 0 0; }
    .config-nav-item { border-left: none; border-bottom: 2px solid transparent; border-radius: var(--radius-sm); white-space: nowrap; }
    .config-nav-item.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
}

/* Le menu de l'avatar flotte sous la barre bleue mais se lit comme la page : ses jetons
   sont résolus ICI, sur :root (valeurs claires ou sombres selon le thème), et non hérités
   de .appbar, qui réécrit --text-primary et --border en blanc pour sa sous-arborescence. */
:root {
    --menu-fond:   var(--bg-elevated);
    --menu-texte:  var(--text-primary);
    --menu-muet:   var(--text-muted);
    --menu-trait:  var(--border);
    --menu-survol: var(--bg-glass-hover);
    --menu-accent: var(--accent);
}

/* ── Réglages : l'en-tête « Réglages › Groupe », l'état du serveur ── */
/* Entreprise & taxes : le logo des documents — l'aperçu sur fond blanc, comme sur le papier. */
.logo-entreprise { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 8px 0 12px; }
.logo-entreprise-apercu {
    display: flex; align-items: center; justify-content: center; min-width: 220px; min-height: 84px;
    padding: 10px 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.logo-entreprise-apercu img { max-height: 64px; max-width: 260px; }
/* Gris fixe, sans variante sombre, et c'est voulu : l'aperçu reste BLANC dans les deux thèmes
   (c'est le papier). 4,6:1 sur ce blanc. */
.logo-entreprise-vide { color: #6b7683; font-size: 12.5px; border-style: dashed; }
.logo-entreprise-actions { display: flex; align-items: center; gap: 8px; }
.logo-entreprise-actions label { cursor: pointer; }
.logo-entreprise-fichier { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.etat-serveur { display: grid; gap: 8px; }
.etat-serveur .clean-list-row { justify-content: space-between; }
.etat-serveur .clean-list-row strong { color: var(--text-primary); }

/* Interrupteur de section : une case cochée à hauteur de texte (norme maison). */
.config-check { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.config-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── Zone de danger (idiome maison) : l'action irréversible a SA couleur, son
   onglet à part et sa carte teintée — impossible de la confondre avec un réglage. */
.config-nav-danger { color: var(--status-danger-texte); }
.config-nav-danger:hover { color: var(--status-danger-texte); }
.config-nav-danger.is-active { color: var(--status-danger-texte); border-left-color: var(--status-danger); }
@media (max-width: 900px) {
    .config-nav-danger.is-active { border-left-color: transparent; border-bottom-color: var(--status-danger); }
}

.danger-zone {
    border-color: var(--status-danger-bord);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--status-danger) 5%, transparent) 0%, transparent 120px),
        var(--bg-secondary);
}
.danger-zone .form-card-head h2, .danger-zone .form-card-head h3 { display: flex; align-items: center; gap: 8px; color: var(--status-danger-texte); }
.danger-ico { flex-shrink: 0; }

/* ── Boutons danger : DEUX formes canoniques ──────────────────────────────
     `btn-primary btn-danger`   — le geste destructif principal (rempli de rouge) ;
     `btn-secondary btn-danger` — le geste destructif secondaire (contour, texte rouge).
   `btn-danger` seul reste accepté comme ALIAS de la forme pleine, d'où le :not() : sans lui,
   la forme pleine s'appliquait aussi à `btn-secondary btn-danger` (fond rouge sous un texte
   rouge). Le rouge plein est --status-danger-plein (4,8:1 sous du blanc) ; le texte rouge,
   --status-danger-texte (6,5:1 en clair, 6,3:1 en sombre). Les `:not(:disabled)` laissent
   l'état désactivé de .btn-primary/.btn-secondary reprendre la main : un bouton danger
   inactif doit se lire inactif, pas rouge vif. L'alias seul reçoit le gabarit complet ;
   `btn-primary btn-danger` garde celui de .btn-primary (et donc sa variante .btn-sm). */
.btn-danger:not(.btn-primary):not(.btn-secondary) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--texte-sur-plein);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-danger:not(.btn-secondary):not(:disabled) { background: var(--status-danger-plein); }
.btn-danger:not(.btn-secondary):hover:not(:disabled)  { transform: translateY(-1px); box-shadow: 0 6px 14px color-mix(in srgb, var(--status-danger-plein) 32%, transparent), 0 2px 4px rgba(0, 0, 0, 0.06); }
.btn-danger:not(.btn-secondary):active:not(:disabled) { transform: translateY(0); }
.btn-danger:not(.btn-secondary):disabled {
    cursor: not-allowed;
    pointer-events: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    box-shadow: none;
}
.btn-secondary.btn-danger:not(:disabled) { color: var(--status-danger-texte); }
.btn-secondary.btn-danger:hover:not(:disabled) { border-color: var(--status-danger-texte); color: var(--status-danger-texte); }

/* ── Bouton orange : le geste qui fait d'une soumission une COMMANDE ───────
     `btn-primary btn-orange` — même gabarit que .btn-primary, fond orange plein pour qu'on ne le
   confonde pas avec les autres gestes de la fiche (demande des usagers, novembre 2026).
   #c2410c porte du blanc à 5,2:1 (AA) ; l'orange vif de la marque (#f2600c) n'en donne que 3,3:1.
   Désactivé, il reprend l'état inactif de .btn-primary. */
.btn-primary.btn-orange:not(:disabled) { background: #c2410c; }
.btn-primary.btn-orange:hover:not(:disabled) { box-shadow: 0 6px 14px rgba(194, 65, 12, 0.32), 0 2px 4px rgba(0, 0, 0, 0.06); }

/* ============================================================
   Cycle de vie d'une commande — le rail des phases et le fil des jalons
   Idiome maison : une commande ne se lit pas comme un dossier posé à côté d'un
   registre d'événements, elle se lit comme un PARCOURS. Le rail dit où on en est ;
   le fil dit ce qui est arrivé, dans l'ordre. Une demande de changement y prend
   exactement la même forme qu'un envoi en production — c'est la même chose : un
   moment de la vie de la commande.
   ============================================================ */
.cycle-rail {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    list-style: none; margin: 0 0 18px; padding: 0;
}
.cycle-rail li { display: flex; align-items: center; gap: 6px; }
.cycle-rail li::after { content: '›'; color: var(--text-muted); font-size: 15px; line-height: 1; }
.cycle-rail li:last-child::after { content: none; }
.cycle-phase-nom {
    display: inline-block; padding: 5px 12px; white-space: nowrap;
    border: 1px solid var(--border); border-radius: var(--radius-full);
    background: var(--bg-tertiary); color: var(--text-muted);
    font-size: 12.5px; line-height: 1.3;
}
.cycle-phase.is-done .cycle-phase-nom { color: var(--text-secondary); }
.cycle-phase.is-annulee .cycle-phase-nom { color: var(--status-danger-texte); }
.cycle-phase.is-active .cycle-phase-nom {
    background: var(--accent-fill); border-color: transparent;
    color: var(--texte-sur-plein); font-weight: 600;
}

.cycle-fil { list-style: none; margin: 0; padding: 0; }
.cycle-jalon { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
/* Le trait qui relie les jalons : il part SOUS la puce et s'arrête au dernier. */
.cycle-jalon::before {
    content: ''; position: absolute; left: 5px; top: 18px; bottom: 0;
    width: 2px; background: var(--border);
}
.cycle-jalon:last-child { padding-bottom: 0; }
.cycle-jalon:last-child::before { content: none; }
.cycle-puce {
    position: relative; z-index: 1; flex: none;
    width: 12px; height: 12px; margin-top: 4px;
    border: 2px solid var(--border); border-radius: var(--radius-full);
    background: var(--bg-secondary);
}
.cycle-jalon.etat-fait    .cycle-puce { background: var(--status-success); border-color: var(--status-success); }
.cycle-jalon.etat-encours .cycle-puce {
    background: var(--status-warning); border-color: var(--status-warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-warning) 18%, transparent);
}
.cycle-jalon.etat-barre   .cycle-puce { background: var(--status-danger); border-color: var(--status-danger); }

.cycle-corps { flex: 1; min-width: 0; }
.cycle-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; }
/* Ce qui n'est pas encore arrivé se lit en retrait — sinon le fil crie autant pour
   ce qui reste à faire que pour ce qui est fait. */
.cycle-jalon.etat-attendu .cycle-tete strong { color: var(--text-muted); font-weight: 500; }
.cycle-detail {
    margin: 4px 0 0; font-size: var(--fs-sm); line-height: 1.5;
    color: var(--text-secondary); white-space: pre-wrap;
}
.cycle-decision { margin-top: 10px; }

/* ── Les autorisations d'un changement en production ──────────────────────────
   Trois signatures avant qu'on puisse seulement proposer « Accepter ». Le bloc
   est encadré de rouge sans être alarmiste : ce n'est pas une erreur, c'est un
   processus qui coûte cher, et l'encadré dit « arrête-toi et lis ». */
.autorisations {
    border: 1px solid var(--status-danger);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--bg-glass);
}
.autorisations-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }

/* Une autorisation par palier. Le filet de gauche passe au vert dès qu'elle est donnée :
   l'avancement se lit d'un coup d'œil, sans compter les pastilles. */
.autorisation {
    border-left: 3px solid var(--border);
    padding: 8px 0 8px 12px;
}
.autorisation + .autorisation { border-top: 1px solid var(--border-subtle); }
.autorisation.est-donne { border-left-color: var(--status-success); }
.autorisation-tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13.5px; }

.case-ligne {
    display: flex; align-items: center; gap: 8px;
    font-size: 13.5px; font-weight: 400; cursor: pointer;
}

/* ── Grille repliée par projet ────────────────────────────────────────────────
   Une ligne de GROUPE n'est pas une ligne de données : elle rassemble. Elle se
   distingue donc par un fond et un filet à gauche, jamais par du gras seul —
   à côté de vingt rangées, le gras ne se voit plus. */
.data-table tr.row-groupe > td {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    padding: 7px 10px;
}
.data-table tr.row-groupe.est-ouvert > td { border-bottom-color: transparent; }

.groupe-tete { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Un vrai <button> : le chevron se prend au clavier comme à la souris. */
.groupe-bouton {
    display: inline-flex; align-items: center; gap: 8px;
    background: none; border: 0; padding: 4px 2px; margin: -4px 0;
    font: inherit; font-size: var(--fs-sm); color: var(--text-primary); cursor: pointer;
}
.groupe-bouton:hover .groupe-libelle { text-decoration: underline; }
.groupe-caret { width: 12px; font-size: var(--fs-xxs); color: var(--text-muted); }
.groupe-libelle { font-weight: 600; }
.groupe-compte {
    border-radius: var(--radius-full); padding: 2px 8px; font-size: 11.5px; font-weight: 500;
    background: var(--bg-secondary); color: var(--text-muted);
}
.groupe-lien { font-size: var(--fs-xs); }

/* Le résumé part à droite : c'est la colonne que l'œil descend pour comparer. */
.groupe-resume { margin-left: auto; }
.groupe-infos { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.groupe-cumul { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Une ligne dépliée est EN RETRAIT sous son groupe — sans le décalage, le repli
   ne se lit plus et la grille redevient plate. */
.data-table tr.row-groupee > td:first-child { padding-left: 26px; position: relative; }
.data-table tr.row-groupee > td:first-child::before {
    content: ''; position: absolute; left: 12px; top: 0; bottom: 0;
    border-left: 1px solid var(--border);
}

/* L'interrupteur, à côté du filtre. */
.table-groupe-bascule {
    display: inline-flex; align-items: center; gap: 7px;
    margin: 0 0 10px; font-size: 12.5px; color: var(--text-muted); cursor: pointer;
}
.table-groupe-bascule input { cursor: pointer; }

/* Libellés et textes discrets — bornés aux écrans d'accès, pour ne rien changer ailleurs. */
.acces-ecran .field-label {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.acces-ecran .text-muted { color: var(--text-muted); font-size: 12.5px; }
.acces-ecran .champ + .champ { margin-top: 12px; }

/* Boutons : la petite taille des lignes de tableau. Le rouge des gestes destructifs vit
   avec les autres boutons danger (voir « Boutons danger » plus haut). */
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* Pastilles d'état d'un compte (EtatCompte). */
.etat-compte { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* Modale de confirmation — STYLE_GUIDE §5.22. */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center; justify-content: center;
    z-index: var(--z-modal);
    animation: modal-backdrop-in 0.18s ease-out;
}
@keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    width: 460px;
    max-width: calc(100vw - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: modal-card-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-card:focus { outline: none; }
@keyframes modal-card-in {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { margin: 0 0 10px; font-weight: 600; font-size: 17px; line-height: 1.3; font-family: inherit; letter-spacing: -0.01em; color: var(--text-primary); }
.modal-body  { margin: 0 0 22px; font-size: var(--fs-md); line-height: 1.55; color: var(--text-secondary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Tiroir latéral — STYLE_GUIDE §5.23. Pleine largeur sur un téléphone. */
.tiroir-fond {
    position: fixed; inset: 0;
    background: rgba(20, 22, 30, 0.45);
    z-index: var(--z-drawer);
    animation: modal-backdrop-in 0.18s ease-out;
}
.tiroir {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(560px, 100vw);
    display: flex; flex-direction: column;
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), -12px 0 40px rgba(0, 0, 0, 0.12);
    z-index: calc(var(--z-drawer) + 1);
    animation: tiroir-entree 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.tiroir:focus { outline: none; }
@keyframes tiroir-entree { from { transform: translateX(100%); } to { transform: translateX(0); } }
.tiroir-tete {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.tiroir-titre { margin: 0; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--text-primary); }
.tiroir-sous-titre { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-muted); }
.tiroir-fermer {
    border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font-size: var(--fs-lg); line-height: 1;
    padding: 6px; border-radius: var(--radius-sm);
}
.tiroir-fermer:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.tiroir-corps { flex: 1; overflow-y: auto; padding: 18px 24px; }
.tiroir-pied {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
}
@media (prefers-reduced-motion: reduce) {
    .tiroir, .tiroir-fond, .modal-card, .modal-backdrop { animation: none; }
}

/* Choix de rôles dans le tiroir : une case, le nom, et ce que le rôle ouvre. */
.choix-role {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.choix-role + .choix-role { margin-top: 6px; }
.choix-role:hover { border-color: var(--border); }
.choix-role input { margin-top: 3px; accent-color: var(--accent); }
.choix-role-nom { font-weight: 500; font-size: 13.5px; color: var(--text-primary); }
.choix-role-quoi {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
    font-size: 12.5px; color: var(--text-muted);
}

/* Le mot de passe généré, montré une fois (RevelationSecret). */
.revelation-secret { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; scroll-margin-top: 80px; }
.revelation-secret:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.revelation-tete { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.revelation-tete .text-muted { color: var(--text-muted); font-size: var(--fs-xs); }
.revelation-valeur { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.revelation-code {
    display: inline-block;
    padding: 6px 10px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    user-select: all;
    overflow-wrap: anywhere;
}
.revelation-consigne { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }

/* Les onglets de la configuration sont des LIENS (une adresse par onglet) : même allure que
   les anciens boutons. */
a.config-nav-item { display: block; text-decoration: none; }

.data-table tbody tr.ligne-selectionnee td { background: var(--accent-soft); }

.filtres-acces { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.lien-compte { font-size: 13.5px; font-weight: 600; font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* La fiche d'un usager, dans le tiroir : quatre sections dans le même ordre partout. */
.fiche-section + .fiche-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.fiche-titre {
    margin: 0 0 10px;
    font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-muted);
}
.fiche-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; font-size: 13.5px; }
.fiche-dl dt { color: var(--text-muted); }
.fiche-dl dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.fiche-dl code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
.fiche-etat { margin-bottom: 10px; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fiche-actions a.btn-secondary { text-decoration: none; }
.champ-ligne { display: flex; gap: 8px; align-items: center; }
.champ-ligne .input { flex: 1; min-width: 0; }
.fiche-historique { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.fiche-historique li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.fiche-historique .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 640px) {
    .fiche-dl { grid-template-columns: 1fr; gap: 2px; }
    .fiche-dl dd { margin-bottom: 8px; }
}

/* Création : les sortes de compte en cartes cliquables. */
.choix-sorte { display: grid; gap: 8px; }
.choix-sorte-carte {
    display: flex; flex-direction: column; gap: 4px; text-align: left;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit; font-size: 13.5px; color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choix-sorte-carte:hover, .choix-sorte-carte:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.choix-sorte-carte .text-muted { font-size: 12.5px; }

/* La liste des usagers garde le tableau de l'app (centré, sans retour à la ligne), sauf deux
   colonnes : l'identifiant, qu'on lit à gauche, et dont la description tient en deux lignes ;
   les rôles, qui passent à la ligne plutôt que de pousser l'état hors de l'écran. */
.data-table td.cellule-compte { text-align: left; white-space: normal; min-width: 180px; max-width: 320px; }
.data-table td.cellule-compte .description-compte {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
    font-size: 12.5px;
}
.data-table td.cellule-roles { white-space: normal; max-width: 240px; }
.data-table td.cellule-texte { text-align: left; white-space: normal; min-width: 280px; }

/* Les droits d'un rôle, rangés par zone (ListeDroitsParZone). */
.droits-par-zone { display: grid; gap: 14px; }

.zone-droits { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0; }
.zone-droits legend { padding: 0 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }

.droit { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0 5px 12px; cursor: pointer; font-size: var(--fs-sm); color: var(--text-primary); }
.droit code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: var(--fs-xs); }
.droit .tag { margin-left: 4px; }
.droit .text-muted { font-size: var(--fs-xs); }

.droit input { margin-top: 3px; accent-color: var(--accent); }

/* ============================================================
   Composants du kit Proxima repris tels quels du STYLE_GUIDE :
   contrôle segmenté (§5.12), avatar (§5.29), progression et spinner (§5.34).
   ============================================================ */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.segmented-option {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font: 500 13px 'Inter', system-ui, sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.segmented-option svg { flex-shrink: 0; }
.segmented-option:hover:not(.selected) { color: var(--text-primary); background: var(--bg-glass-hover); }
.segmented-option.selected {
    background: var(--bg-elevated);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.segmented-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented-compact .segmented-option { padding: 4px 10px; font-size: var(--fs-xs); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font: 600 12px 'Inter', system-ui, sans-serif;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    overflow: hidden;
    border: 2px solid var(--bg-elevated);
    user-select: none;
}
.avatar-xs { width: 22px; height: 22px; font-size: var(--fs-xxs); border-width: 1.5px; }
.avatar-sm { width: 30px; height: 30px; font-size: var(--fs-xxs); }

/* Teinte stable par personne (§5.29) : posée en --teinte, même saturation pour toute la famille. */
.avatar[style*="--teinte"] { background: hsl(var(--teinte) 70% 92%); color: hsl(var(--teinte) 62% 30%); }
[data-theme="dark"] .avatar[style*="--teinte"] { background: hsl(var(--teinte) 40% 24%); color: hsl(var(--teinte) 80% 82%); }

.progress {
    position: relative;
    display: block;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.spinner {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 2px solid var(--accent-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinner-rotate 0.9s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
.btn-primary .spinner { border-color: color-mix(in srgb, var(--texte-sur-plein) 40%, transparent); border-top-color: var(--texte-sur-plein); }
@keyframes spinner-rotate { to { transform: rotate(360deg); } }

/* ============================================================
   GRILLE MODERNE — la peau commune de toutes les listes de l'application
   ------------------------------------------------------------
   Une seule grille, posée sur `.data-scroll` + `.data-table` : les grilles du composant
   DataTable (soumissions, commandes, clients…), les tables écrites à la main des fiches
   et les grilles éditables du catalogue et de la configuration héritent toutes de ces
   règles. Elles viennent APRÈS les anciennes : la cascade les fait gagner sans toucher
   chaque écran.
   ============================================================ */
.data-scroll {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.data-table thead th {
    background: var(--bg-tertiary);
    padding: 11px 14px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -1px 0 var(--border);
}
.data-table tbody td { padding: 10px 14px; vertical-align: middle; }
/* Rangées zébrées très légères : l'œil suit la ligne sur un écran large sans règle.
   Posées sur la RANGÉE avec une spécificité nulle (:where) : toute rangée qui porte son
   propre fond (sélectionnée, retenue, en édition, groupe) le garde, pair ou impair. */
:where(.data-table tbody tr:nth-child(even)) { background: var(--bg-glass); }
.data-table tbody tr:hover { background: var(--accent-soft); }
.data-table tbody tr:last-child > td { border-bottom: 0; }
/* Ligne cliquable : un liseré d'accent à gauche dit « ceci s'ouvre ». */
.data-table tbody tr.row-link > td:first-child { box-shadow: inset 3px 0 0 transparent; transition: box-shadow 0.12s ease; }
.data-table tbody tr.row-link:hover > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* La barre d'outils du composant DataTable : filtre à gauche, état à droite. */
.data-table-wrap .grille-barre, .grille .grille-barre { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grille { display: flex; flex-direction: column; gap: 12px; }
.grille-filtre { flex: 0 1 340px; min-width: 200px; }
.grille-compte {
    font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums;
    padding: 4px 10px; border-radius: var(--radius-full); background: var(--bg-tertiary);
}

/* ── Grilles ÉDITABLES : la cellule EST le champ ─────────────────────────────
   Un champ encadré dans chaque cellule faisait un formulaire, pas une grille. Le champ
   n'a plus de cadre au repos ; il se dessine au survol et s'allume au focus, comme un
   tableur. Vaut pour `.edit-table` (catalogue, configuration, contacts) et `.grille-table`. */
.data-table.edit-table tbody td,
.data-table.grille-table tbody td { padding: 3px 4px; }
.data-table.edit-table .input,
.data-table.edit-table select.input,
.grille-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    box-shadow: none;
    padding: 7px 10px;
    font: inherit;
    color: var(--text-primary);
    transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
.data-table.edit-table .input:hover,
.grille-input:hover { border-color: var(--border); background: var(--bg-secondary); }
.data-table.edit-table .input:focus,
.grille-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.grille-input::placeholder { color: var(--text-muted); font-style: italic; }
.grille-table .grille-num {
    width: 1%; text-align: right; color: var(--text-muted);
    font-variant-numeric: tabular-nums; font-size: var(--fs-xs); padding-left: 14px !important; padding-right: 6px !important;
}
.grille-table .grille-cellule { width: 100%; }
.grille-table .grille-actions { width: 1%; white-space: nowrap; text-align: right; padding-right: 10px !important; }
.grille-table .grille-actions .btn-icon { opacity: 0; transition: opacity 0.12s ease; }
.grille-table tr:hover .grille-actions .btn-icon,
.grille-table tr:focus-within .grille-actions .btn-icon { opacity: 1; }
.grille-table .grille-actions .btn-icon:disabled { opacity: 0 !important; }
.grille-table tr.grille-doublon > td { background: var(--status-warning-fond); }
.grille-table tr.grille-doublon .grille-num { color: var(--status-warning-texte); font-weight: 600; }
.grille-ajout {
    display: block; width: 100%; text-align: left;
    padding: 10px 14px; border: 0; border-top: 1px dashed var(--border);
    background: transparent; color: var(--accent); font: inherit; font-weight: 500; cursor: pointer;
}
.grille-ajout:hover { background: var(--accent-soft); }
.grille-ajout.grille-ajout-haut { border-top: 0; border-bottom: 1px dashed var(--border); }
.grille-barre .table-filter .search-input { padding-right: 12px; }
.grille-barre .table-groupe-bascule { margin: 0; }

/* ── Les titres de colonnes restent TOUJOURS visibles ────────────────────────
   PIÈGE : l'entête `position: sticky` colle au cadre qui DÉFILE le plus proche. Le cadre
   d'une grille (`overflow: auto`, pour le défilement de côté) en est un — mais sans hauteur
   maximale il ne défilait jamais en hauteur : c'était la PAGE qui défilait, et les titres
   partaient avec elle dès que la grille dépassait l'écran (cent lignes par page). Le cadre
   est donc plafonné à la hauteur de l'écran : une longue grille défile DANS son cadre, ses
   titres (et son pied de totaux) restent en place ; une courte garde exactement son allure. */
.data-scroll,
.edit-scroll,
.table-scroll-x {
    max-height: max(360px, calc(100dvh - 180px));
    overflow: auto;
}
@media print {
    .data-scroll, .edit-scroll, .table-scroll-x { max-height: none; overflow: visible; }
}

/* ── Pied de grille et pagination (DataTable) ────────────────────────────────
   Rétablis après le lot 8 : la grille pagine maintenant à 100 lignes (lot 6),
   ces classes ne sont donc plus mortes. Mêmes jetons que le reste de la grille. */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.table-footer-info { font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pagination { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pagination-btn:hover:not(:disabled):not(.active) {
    border-color: var(--border);
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}
.pagination-btn.active {
    background: var(--accent-fill);
    border-color: var(--accent-fill);
    color: var(--texte-sur-plein);
    cursor: default;
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-ellipsis { color: var(--text-muted); padding: 0 6px; user-select: none; }

/* ── Les filtres rapides d'une grille ─────────────────────────────────────────
   Une rangée de puces sous la barre d'outils (DataTable) et sur le plancher (Production) :
   des groupes nommés (« Statut »), un trait entre deux groupes, un compteur dans chaque puce
   et une teinte d'alerte pour ce qui doit se voir avant qu'on le cherche (en retard, bloqué,
   expiré). Les puces sont celles du style guide (`.chip` / `.chip.is-on`). */
.grille-filtres-rapides { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.filter-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-group .filter-label {
    font-size: var(--fs-xxs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-muted); margin-right: 2px;
}
.filter-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 6px; }
/* Deux groupes voisins se séparent d'un trait, sans qu'on ait à le poser à la main. */
.grille-filtres-rapides .filter-group + .filter-group { padding-left: 12px; border-left: 1px solid var(--border); }
.grille-filtres-rapides .btn-link { margin-left: 2px; }

.chip-count {
    margin-left: 5px; padding: 0 5px; border-radius: var(--radius-full);
    background: var(--bg-glass-hover); font-size: var(--fs-xxs); font-variant-numeric: tabular-nums;
}
.chip.is-on .chip-count { background: var(--accent-soft); }
.chip.chip-alerte:not(.is-on) { color: var(--status-danger-texte); border-color: var(--status-danger-bord); }

/* ============================================================
   LA FICHE — l'idiome « page objet » des grands ERP, partagé par la soumission et la
   commande : un fil d'Ariane ; un ENTÊTE (identité, UN état, les gestes) qui porte le
   CHEMIN DE VIE en chevrons ; les FAITS CLÉS en une rangée ; le PROCHAIN GESTE en un
   bandeau ; puis le détail en ONGLETS à gauche et un RAIL à droite (totaux, gestes
   contextuels, liens du dossier). Tout se dit avec les jetons ; les teintes d'état
   reprennent celles des pastilles.
   ============================================================ */
.fiche { gap: 14px; }

/* ── Fil d'Ariane + retour à la liste (composant <FilAriane>) ─────────────────
   Le fil dit où l'on est ; le bouton à droite ramène à la liste d'où l'on vient,
   d'un seul clic, sans chercher le premier maillon du fil. Une liste <ol> : les chevrons
   sont des ::before, que les lecteurs d'écran ne lisent pas comme du texte. Partout, pas
   seulement sur les fiches : le compte, le répertoire, les préférences le portent aussi. */
.fiche-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fiche-nav .btn-sm { white-space: nowrap; }
.fil-ariane ol {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    list-style: none; margin: 0; padding: 0;
    font-size: 12.5px; color: var(--text-muted);
}
.fil-ariane li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.fil-ariane li + li::before { content: '›'; color: var(--border-strong); font-size: var(--fs-md); line-height: 1; }
.fil-ariane a { color: var(--text-muted); text-decoration: none; }
.fil-ariane a:hover { color: var(--accent); }
.fil-ariane [aria-current] { color: var(--text-secondary); }

/* ── Entête ───────────────────────────────────────────────────────────────── */
/* PAS d'overflow:hidden ici : le menu « ⋯ » (.menu-liste) flotte SOUS l'entête, en position
   absolue, et un overflow caché le coupait à la hauteur de la carte — on ne voyait que ses
   premiers gestes. Les coins arrondis se gardent en arrondissant le chemin de vie lui-même. */
.fiche-entete { padding: 0; overflow: visible; }
.fiche-entete > .chemin:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
/* La TEINTE DU TYPE : un lead, une soumission, une commande se reconnaissent avant d'être lus.
   Un fond à peine teinté et un filet à gauche — jamais assez pour concurrencer la pastille
   d'état, qui reste la seule couleur à lire. Lead = ambre (le prospect), soumission = bleu
   (l'offre), commande = vert (le ferme). Le chemin de vie garde son fond blanc. */
.fiche-entete.type-lead       { --teinte-fiche: var(--fiche-lead); }
.fiche-entete.type-soumission { --teinte-fiche: var(--fiche-soumission); }
.fiche-entete.type-commande   { --teinte-fiche: var(--fiche-commande); }
.fiche-entete[class*="type-"] {
    background: color-mix(in srgb, var(--teinte-fiche) var(--fiche-dose), var(--bg-secondary));
    border-color: color-mix(in srgb, var(--teinte-fiche) 30%, var(--border));
    box-shadow: inset 4px 0 0 var(--teinte-fiche);
}
.entete-haut {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    padding: 18px 22px 16px;
}
.entete-identite { flex: 1 1 420px; min-width: 0; }
.entete-titre { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.entete-titre .page-title { font-size: 26px; }
.entete-sous {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 6px 0 0; font-size: 13.5px; color: var(--text-secondary);
}
.entete-sous .sep { color: var(--border); }
.entete-sous strong { color: var(--text-primary); font-weight: 600; }
.entete-sous .btn-link { padding: 0; font-weight: 600; }

/* L'état : UNE pastille, avec son point — la seule chose à lire si on ne lit rien d'autre. */
.etat {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 11px; border-radius: var(--radius-full);
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
    /* Le GROS membre de la famille des pastilles : mêmes variantes (pill-ok, pill-danger…, ou
       les alias est-ok, est-jaune, est-rouge, est-bleu déclarés avec elles). Neutre par défaut. */
    background: var(--badge-fond, var(--bg-tertiary)); color: var(--badge-texte, var(--text-secondary));
}
.etat::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Les gestes : imprimer, LE geste principal, puis « ⋯ ». */
/* flex: 0 1 auto + max-width, PAS flex: none : figé à sa largeur d'une ligne (366 px), le
   groupe débordait l'écran de 23 px à 390 px et poussait « ⋯ » hors de portée. Il peut
   maintenant se replier sur deux rangées quand il n'a plus la place. */
.entete-gestes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 0 1 auto; max-width: 100%; }
.entete-gestes .btn-primary, .entete-gestes .btn-secondary { white-space: nowrap; }
.btn-kebab { padding: 8px 11px; font-size: var(--fs-lg); line-height: 1; letter-spacing: 0.1em; }

.menu-gestes { position: relative; }
.menu-voile { position: fixed; inset: 0; z-index: var(--z-dropdown); }
.menu-liste {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: calc(var(--z-dropdown) + 1);
    min-width: 250px; padding: 6px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; gap: 2px;
}
.menu-liste a, .menu-liste button {
    display: block; width: 100%; text-align: left;
    padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--text-primary);
    font: inherit; font-size: 13.5px; text-decoration: none; cursor: pointer;
}
.menu-liste a:hover, .menu-liste button:hover:not(:disabled) { background: var(--bg-glass-hover); }
/* Les flèches promènent le focus d'un geste à l'autre (MenuGestes) : le geste visé se voit comme au survol. */
.menu-liste a:focus-visible, .menu-liste button:focus-visible { outline: none; background: var(--bg-glass-hover); box-shadow: inset 0 0 0 1px var(--accent); }
.menu-liste button:disabled { color: var(--text-muted); cursor: not-allowed; }
.menu-trait { height: 1px; margin: 4px 2px; background: var(--border); }

/* ── Le chemin de vie (le « path » de Dynamics / Salesforce) ─────────────────
   Des chevrons qui se suivent ; la couleur dit l'état : vert acquis, bleu
   aujourd'hui, jaune en attente de quelqu'un, rouge barré, gris à venir, et
   une étape sautée se lit barrée avec sa raison. */
.chemin {
    list-style: none; margin: 0; padding: 0;
    display: flex; overflow: hidden;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.etape {
    position: relative; flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
    padding: 10px 14px 10px 30px;
    font-size: 12.5px; color: var(--text-muted);
    /* Des fonds OPAQUES, mélangés au fond de la carte : le chevron (::after) hérite du fond
       de son étape et doit recouvrir la suivante sans laisser voir un losange. */
    background: var(--bg-secondary);
}
.etape:first-child { padding-left: 22px; }
.etape::after {
    content: ''; position: absolute; top: 50%; right: -11px; z-index: 1;
    width: 22px; height: 22px; transform: translateY(-50%) rotate(45deg);
    border-top: 1px solid var(--border); border-right: 1px solid var(--border);
    background: inherit;
}
.etape:last-child::after { content: none; }
.etape-nom { font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etape-detail { font-size: 11.5px; line-height: 1.35; }

.etape.est-fait { background: color-mix(in srgb, var(--status-success) 11%, var(--bg-secondary)); }
.etape.est-fait .etape-nom { color: var(--status-success-texte); }
.etape.est-fait .etape-nom::before { content: '✓ '; }
.etape.est-courante { background: var(--accent-fill); color: color-mix(in srgb, var(--texte-sur-plein) 85%, transparent); }
.etape.est-courante .etape-nom, .etape.est-courante .etape-detail { color: var(--texte-sur-plein); }
.etape.est-attente { background: color-mix(in srgb, var(--status-warning) 16%, var(--bg-secondary)); }
.etape.est-attente .etape-nom, .etape.est-attente .etape-detail { color: var(--status-warning-texte); }
.etape.est-barre { background: color-mix(in srgb, var(--status-danger) 10%, var(--bg-secondary)); }
.etape.est-barre .etape-nom, .etape.est-barre .etape-detail { color: var(--status-danger-texte); }
.etape.est-sautee .etape-nom { text-decoration: line-through; text-decoration-color: var(--text-muted); color: var(--text-muted); font-weight: 500; }
.etape.est-close { opacity: 0.55; }

@media (max-width: 900px) {
    .chemin { flex-direction: column; }
    .etape, .etape:first-child { padding: 8px 16px; }
    .etape::after { content: none; }
    .etape + .etape { border-top: 1px solid var(--border-subtle); }
}

/* ── Les faits clés ──────────────────────────────────────────────────────── */
.faits { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0; }
.faits .kpi-card { padding: 11px 14px; gap: 2px; }
.faits .kpi-value { font-size: 19px; letter-spacing: -0.01em; display: flex; align-items: center; min-height: 28px; }
.faits .kpi-value.accent { color: var(--accent); }
.faits .kpi-value .pill { font-size: 12.5px; }
.faits .kpi-sub { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1130px) { .faits { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .faits { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Le prochain geste : un bandeau, un message, un bouton ─────────────────── */
.geste {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--bg-secondary);
}
.geste-ico {
    flex: none; width: 30px; height: 30px; border-radius: var(--radius-sm);
    display: grid; place-items: center; font-size: var(--fs-md); font-weight: 700;
    background: var(--bg-secondary); border: 1px solid var(--border);
}
.geste-texte { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.45; }
.geste-texte strong { display: block; font-size: 13.5px; color: var(--text-primary); }
.geste .btn-secondary { flex: none; }
.geste.est-gris  { background: var(--bg-tertiary); }
.geste.est-jaune { background: var(--status-warning-fond); border-color: var(--status-warning-bord); }
.geste.est-rouge { background: var(--status-danger-fond);  border-color: var(--status-danger-bord); }
.geste.est-bleu  { background: var(--accent-soft);         border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.geste.est-ok    { background: var(--status-success-fond); border-color: var(--status-success-bord); }
@media (max-width: 640px) { .geste { flex-wrap: wrap; } .geste-texte { flex-basis: 100%; } }

/* ── Le corps : onglets à gauche, rail à droite ───────────────────────────── */
.fiche-corps {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px; align-items: start;
}
@media (max-width: 1130px) { .fiche-corps { grid-template-columns: minmax(0, 1fr); } }

.carte-onglets { padding: 0; }
.onglets-fiche { margin: 0; padding: 4px 10px 0; }
.onglets-fiche .tab { font-size: 13.5px; }
.tab-point { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.tab-point.est-bloquant  { background: var(--status-danger); }
.tab-point.est-attention { background: var(--status-warning); }
.tab-point.est-conseil   { background: var(--accent); }
.onglet-corps { padding: 14px 18px 18px; }
.onglet-corps tfoot td { background: var(--bg-glass); border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }

/* ── Le rail ─────────────────────────────────────────────────────────────── */
.fiche-rail { display: flex; flex-direction: column; gap: 12px; }

/* Le blocage d'une commande (rail « Dossier ») : ce qu'on attend, de qui, depuis quand.
   Jaune comme toute attente de quelqu'un — c'est la seule chose que le jaune veut dire. */
.blocage-bloc { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.blocage-bloc.est-pose    { background: var(--status-warning-fond); border-color: var(--status-warning-bord); }
.blocage-bloc.est-annulee { background: var(--status-danger-fond);  border-color: var(--status-danger-bord); }
.blocage-bloc.est-livree  { background: var(--status-success-fond); border-color: var(--status-success-bord); }
.blocage-tete { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.blocage-note { margin: 8px 0 0; font-size: var(--fs-sm); line-height: 1.45; color: var(--text-primary); }
.blocage-bloc .form-actions { margin-top: 8px; }
.rail-carte { padding: 14px 16px; scroll-margin-top: calc(var(--appbar-h, 96px) + 12px); }
.rail-carte.est-refus { border-color: var(--status-danger-bord); }
.rail-titre {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--text-primary);
}
.rail-details { margin-top: 10px; border-top: 1px solid var(--border-subtle); padding-top: 8px; }
.rail-details summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); list-style: none; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.rail-details summary::-webkit-details-marker { display: none; }
.rail-details summary::before { content: '▸'; color: var(--text-muted); font-size: var(--fs-xxs); }
.rail-details[open] summary::before { content: '▾'; }
.rail-details summary .text-muted { font-weight: 400; }
.rail-details > :not(summary) { margin-top: 8px; }
.rail-details .totaux-liste li { font-size: 12.5px; }

.totaux-liste { list-style: none; margin: 0; padding: 0; }
.totaux-liste li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-sm);
}
.totaux-liste li span { color: var(--text-secondary); }
.totaux-liste li strong { font-variant-numeric: tabular-nums; text-align: right; }
.totaux-liste li.total {
    border-bottom: none; border-top: 2px solid var(--accent);
    margin-top: 4px; padding-top: 9px; font-size: 15px;
}
.totaux-liste li.total strong { color: var(--accent); }
.totaux-liste li.total span { color: var(--text-primary); }

/* Les liens du dossier : une icône, une étiquette, la valeur. */
.liens { list-style: none; margin: 0; padding: 0; }
.liens li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-sm); }
.liens li:last-child { border-bottom: none; }
.lien-ico {
    flex: none; width: 28px; height: 28px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); display: grid; place-items: center; font-size: var(--fs-sm);
}
.lien-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lien-etiquette { font-size: 11.5px; color: var(--text-muted); }
.lien-corps a { color: var(--text-primary); font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lien-corps a:hover { color: var(--accent); }
.lien-corps strong { font-weight: 500; }


/* ═══════════════════════════════════════════════════════════════════════════════
   ─── Accessibilité ───
   Une seule section, en fin de fichier, pour tout ce qui sert le clavier, le lecteur
   d'écran, le doigt et l'œil fatigué : elle se relit d'un bloc et se fusionne sans
   toucher au reste. Le plancher de 11 px (aucun texte plus petit, sauf la flèche de tri) est
   tenu là où chaque composant est décrit, avec l'échelle --fs-*.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Texte lu par le lecteur d'écran, invisible à l'œil (la date choisie d'un SelecteurDate,
   par exemple). clip-path ET clip : le second pour les moteurs qui ignorent le premier. */
.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;
}

/* La première cellule d'une ligne cliquable de DataTable : un vrai lien ou un vrai bouton,
   pour que Tab atteigne la ligne et qu'Entrée l'ouvre. À l'œil, rien ne change — le texte
   de la cellule, avec l'anneau de focus du guide (§8) quand on y arrive au clavier. */
.lien-ligne {
    appearance: none;
    margin: 0; padding: 0;
    border: 0; background: none;
    font: inherit; color: inherit; text-align: inherit; text-decoration: none;
    cursor: pointer;
}
.lien-ligne:hover { color: var(--accent); }
.lien-ligne:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-radius: var(--radius-sm);
}

/* ─── Les écrans du plancher (/production, /profilage : <div class="page plancher">) ───
   Lus à un ou deux mètres, touchés au doigt — souvent ganté. Cibles d'au moins 44 px ; les
   puces denses des barres de filtres, 40 px avec un écart (WCAG 2.5.8) ; aucun texte sous
   12 px. Le détail propre à la table de production vit dans Production.razor.css. */
.plancher .chip { min-height: 40px; padding: 6px 14px; font-size: var(--fs-sm); }
.plancher .btn-primary,
.plancher .btn-secondary,
.plancher .page-head .btn-link,
.plancher .date-field-trigger { min-height: 44px; }
.plancher .pointage-btns .chip { min-width: 44px; min-height: 44px; font-size: var(--fs-lg); }
.plancher .data-table thead th,
.plancher .status-row,
.plancher .kpi-label,
.plancher .filter-group .filter-label,
.plancher .chip-count { font-size: var(--fs-xs); }

/* Reflow (WCAG 1.4.10) : sur un téléphone, une pastille longue (« Mode démo — identité
   choisie, aucune authentification », « Régime rigide — commande en production ») passe à la
   ligne au lieu de pousser la page de côté. Au-delà de 640 px, les pastilles restent d'un bloc. */
@media (max-width: 640px) {
    .status-row { flex-wrap: wrap; }
    .status-row .tag,
    .status-row .pill { white-space: normal; }
}

/* Mouvement réduit : la personne a demandé à son système moins d'animation. Tout s'arrête
   presque net — 0,01 ms plutôt que « none », pour que les écouteurs transitionend /
   animationend continuent d'être appelés. Le seul !important assumé ici : il doit
   l'emporter sur chaque composant, scopé ou non (STYLE_GUIDE §8). */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   SIGNALEMENTS — le bouton « Signaler » de la barre, ses deux formulaires, « Mes signalements »
   et la console. Voir docs/signalements.md. Les écrans réutilisent le vocabulaire de CamRack
   (.card, .escalier, .form-field, .kpi-card, .data-table, .chip, .pill, <FilAriane>, <Bandeau>) ;
   ne vit ici que ce qui leur est propre, écrit avec les jetons (statuts, --fs-*, --menu-*).
   ============================================================ */

/* Le bouton : une icône ronde de la barre, à côté de la cloche et du même habit. Son menu flotte
   sous la barre bleue mais se lit comme la page : il porte les jetons --menu-* (résolus sur :root),
   pas ceux que .appbar réécrit en blanc. */
.sg-signaler-ancre { position: relative; display: inline-flex; }
.sg-signaler { position: relative; list-style: none; user-select: none; }
.sg-signaler::-webkit-details-marker { display: none; }
.sg-signaler::marker { content: ""; }
.sg-signaler-ancre[open] > .sg-signaler { background: var(--bg-glass-hover); color: var(--text-primary); }
.sg-pastille { position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px; padding: 0 3px;
    border-radius: var(--radius-sm); background: var(--status-danger-plein); color: var(--texte-sur-plein);
    font-size: var(--fs-xxs); font-weight: 700; line-height: 17px; text-align: center; }
.sg-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown); width: 360px; max-width: calc(100vw - 24px);
    padding: 10px; display: grid; gap: 8px; text-align: left; background: var(--menu-fond); color: var(--menu-texte);
    border: 1px solid var(--menu-trait); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.sg-menu-titre { padding: 4px 6px 2px; font-size: var(--fs-xxs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--menu-muet); }
.sg-choix { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--menu-trait);
    border-radius: var(--radius-sm); color: var(--menu-texte); text-decoration: none; }
.sg-choix:hover, .sg-choix:focus-visible { border-color: var(--menu-accent); background: var(--menu-survol); outline: none; }
.sg-choix > span:last-child { display: grid; gap: 2px; }
.sg-choix-ico { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; }
.sg-choix-ico.bug { background: var(--status-danger-fond); color: var(--status-danger-texte); }
.sg-choix-ico.idee { background: var(--status-warning-fond); color: var(--status-warning-texte); }
.sg-choix-t { font-weight: 600; font-size: var(--fs-md); line-height: 1.35; }
.sg-choix-d { font-size: var(--fs-xs); color: var(--menu-muet); line-height: 1.4; }
.sg-menu-console { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: var(--radius-sm); background: var(--menu-survol); color: var(--menu-accent); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.sg-menu-console:hover { text-decoration: underline; }
.sg-menu-console b { font-size: var(--fs-xs); color: var(--status-danger-texte); }
.sg-menu-pied { display: flex; justify-content: space-between; gap: 12px; padding: 2px 6px 2px; font-size: var(--fs-xs); line-height: 1.45; color: var(--menu-muet); }
.sg-menu-pied a { color: var(--menu-accent); font-weight: 600; white-space: nowrap; }

/* Les formulaires : l'escalier de CamRack à gauche, ce qui l'accompagne à droite. */
.sg-deux { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .sg-deux { grid-template-columns: 1fr !important; } }
.sg-cote { display: grid; gap: 14px; }
.sg-carte { min-width: 0; }
.sg-carte h2, .sg-carte h3 { margin: 0 0 4px; font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); }
.sg-carte .sous { margin: 0 0 12px; font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.45; }
.sg-dl { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: var(--fs-sm); margin: 0; }
.sg-dl dt { color: var(--text-muted); }
.sg-dl dd { margin: 0; color: var(--text-primary); font-weight: 500; overflow-wrap: anywhere; }
.sg-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: var(--fs-xs); }
.sg-libelle { font-weight: 600; font-size: var(--fs-xxs); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.escalier .escalier-contenu { padding-bottom: 28px; }
.escalier .escalier-titre { font-size: var(--fs-lg); }
.sg-champ { margin-bottom: 14px; }
.sg-champ > .sg-champ-libelle { font-weight: 500; font-size: var(--fs-xs); color: var(--text-secondary); }
.sg-champ textarea.input { resize: vertical; }
.sg-grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sg-grille-3 { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 14px; }
@media (max-width: 640px) { .sg-grille-2, .sg-grille-3 { grid-template-columns: 1fr; } }

/* Les choix : de vrais boutons radio, sous l'habit des .chip de CamRack. */
.sg-choix-ligne { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.sg-pastille-choix { position: relative; padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-full);
    background: var(--bg-glass); color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.sg-pastille-choix input { position: absolute; opacity: 0; pointer-events: none; }
.sg-pastille-choix:hover { border-color: var(--accent); color: var(--text-primary); }
.sg-pastille-choix:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sg-pastille-choix:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.sg-origine { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* La zone de dépôt des pièces : pointillés --border-strong, comme les autres dépôts. */
.sg-depot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 12px; padding: 16px;
    border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--bg-glass); text-align: center; cursor: pointer; }
.sg-depot:hover, .sg-depot:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.sg-depot input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sg-depot-titre { font-weight: 600; font-size: var(--fs-md); color: var(--text-primary); }
.sg-depot-aide { font-size: var(--fs-xs); color: var(--text-muted); }

.sg-type { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; }
.sg-type.bug { color: var(--status-danger-texte); }
.sg-type.idee { color: var(--status-warning-texte); }
.sg-grav { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.sg-grav.fort { color: var(--status-danger-texte); }

/* La console : les chiffres sont des .kpi-card ; les deux premiers filtrent. */
a.sg-kpi.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sg-kpi-alerte { border-color: var(--status-warning-bord); }
.kpi-value.sg-ton-accent { color: var(--accent); }
.kpi-value.sg-ton-erreur { color: var(--status-danger-texte); }
.kpi-value.sg-ton-attention { color: var(--status-warning-texte); }
.kpi-value.sg-ton-ok { color: var(--status-success-texte); }
.sg-filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sg-filtres .search-field { min-width: 320px; }
.chip.sg-filtre b { font-variant-numeric: tabular-nums; color: var(--text-primary); }
.chip.sg-filtre.is-on b { color: var(--accent); }

.data-table.sg-table { white-space: normal; }
.data-table.sg-table tbody td { vertical-align: middle; }
.data-table.sg-table tbody tr:hover { background: var(--bg-glass-hover); }
.sg-table tr.est-nouveau td:first-child { box-shadow: inset 3px 0 0 var(--accent-fill); }
.sg-table tr.est-choisi { background: var(--accent-soft); }
.sg-table .ref { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.sg-table .tt a { color: inherit; text-decoration: none; }
.sg-table .tt a:hover b { color: var(--accent); }
.sg-table .tt b { display: block; font-weight: 600; color: var(--text-primary); }
.sg-table .tt small { color: var(--text-muted); font-size: var(--fs-xs); }
.sg-table .nowrap { white-space: nowrap; }
.sg-defile { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }

/* Le fil d'un dossier. Les notes internes : fond jaune pointillé — on ne doute jamais de ce que
   le demandeur lira (le jaune : quelqu'un de l'équipe doit en tenir compte). */
.sg-chrono { list-style: none; margin: 0 0 8px; padding: 0; }
.sg-chrono li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; position: relative; padding-bottom: 16px; }
.sg-chrono li::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.sg-chrono li:last-child::after { display: none; }
.sg-chrono .p { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-tertiary); font-size: var(--fs-xxs); color: var(--text-secondary); }
.sg-chrono .p.on { background: var(--accent-fill); color: var(--texte-sur-plein); }
.sg-chrono .q { font-size: var(--fs-sm); line-height: 1.45; min-width: 0; }
.sg-chrono .q small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }
.sg-bulle { margin-top: 6px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-tertiary); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.sg-bulle.interne { background: var(--status-warning-fond); border: 1px dashed var(--status-warning-bord); }

.sg-garde { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--accent-soft);
    border: 1px solid var(--border); font-size: var(--fs-xs); line-height: 1.5; color: var(--text-secondary); }
.sg-garde b { color: var(--text-primary); }

.sg-parcours { display: flex; margin: 10px 0 16px; }
.sg-parcours .e { flex: 1; text-align: center; font-size: var(--fs-xs); color: var(--text-muted); position: relative; padding-top: 22px; min-width: 0; }
.sg-parcours .e::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px;
    border-radius: 50%; background: var(--bg-tertiary); border: 2px solid var(--border); z-index: 1; }
.sg-parcours .e::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: var(--border); }
.sg-parcours .e:first-child::after { display: none; }
.sg-parcours .e.fait { color: var(--text-secondary); }
.sg-parcours .e.fait::before { background: var(--accent-fill); border-color: var(--accent-fill); }
.sg-parcours .e.fait::after { background: var(--accent-fill); }
.sg-parcours .e.ici { color: var(--accent); font-weight: 600; }
.sg-parcours .e.ici::before { background: var(--bg-secondary); border-color: var(--accent-fill); box-shadow: 0 0 0 4px var(--accent-soft); }
.sg-texte { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--text-primary); }
.sg-gestes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* La capture annotée, les pièces jointes, la jauge, « Déjà signalé ? », la relecture. */
.sg-capture { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-tertiary); }
.sg-capture-toile { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.sg-outils { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--bg-secondary); align-items: center; flex-wrap: wrap; }
.sg-outils .esp { flex: 1; }
.sg-outil { padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--bg-glass);
    color: var(--text-secondary); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.sg-outil:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.sg-outil.is-on { border-color: var(--status-danger-bord); background: var(--status-danger-fond); color: var(--status-danger-texte); }
.sg-fichiers-liste { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--text-secondary); }
.sg-fichiers-liste li::before { content: "📎 "; }
.sg-pieces { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin: 12px 0 16px; }
.sg-piece { display: grid; gap: 4px; max-width: 100%; font-size: var(--fs-xs); color: var(--text-secondary); text-decoration: none; }
.sg-piece img { max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.sg-piece.fichier { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--accent); font-weight: 600; }
#sg-brouillon[hidden], .sg-carte[hidden], .sg-capture[hidden] { display: none; }

.sg-qualite-barre { height: 8px; border-radius: var(--radius-full); background: var(--bg-tertiary); overflow: hidden; margin: 6px 0 10px; }
.sg-qualite-barre span { display: block; height: 100%; background: linear-gradient(90deg, var(--status-warning), var(--status-success)); transition: width 0.3s; }
.sg-qualite-note { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.sg-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: var(--fs-xs); }
.sg-check li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; color: var(--text-primary); }
.sg-check li::before { content: "✓"; flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
    font-size: var(--fs-xxs); font-weight: 700; background: var(--status-success-fond); color: var(--status-success-texte); }
.sg-check li.non::before { content: "!"; background: var(--status-warning-fond); color: var(--status-warning-texte); }
.sg-check li.non.facultatif::before { content: "+"; background: var(--bg-tertiary); color: var(--text-muted); }
.sg-check li.non { color: var(--text-secondary); }

.sg-sim { display: grid; gap: 8px; }
.sg-sim-l { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: var(--fs-sm); color: var(--text-primary); text-decoration: none; }
.sg-sim-l:hover { border-color: var(--accent); }
.sg-sim-l .t { flex: 1; min-width: 0; }
.sg-sim-l .t b { display: block; font-weight: 600; }
.sg-sim-l .t small { color: var(--text-muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.sg-plus1 { padding: 3px 10px; border: 1px solid var(--accent); border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent);
    font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }

.sg-relire { margin: auto; inset: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 24px; border: 1px solid var(--border);
    border-radius: var(--radius-lg); background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-lg); }
.sg-relire::backdrop { background: rgba(6, 13, 43, 0.55); }
.sg-relire-dl { grid-template-columns: 180px 1fr; gap: 10px 14px; }
.sg-relire-dl dd { white-space: pre-wrap; }
.sg-relire-image { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.sg-table .pill { white-space: nowrap; }
