/* =========================================================================
   theme.css — Kit de style « Suite QVCT » (design soft UI Centauri, palette Serene Blue)

   SOURCE : Demo_QVCT/css/styles.css, extrait tel que RENDU (valeurs mesurées dans
   le navigateur, pas seulement lues dans le code). Aucune valeur n'a été inventée.
   Guide complet : STYLE-GUIDE.md · Catalogue visuel : style-preview.html

   COMMENT S'EN SERVIR
   1. <link rel="stylesheet" href="theme.css"> — et rien d'autre pour l'apparence.
   2. Choisir les classes selon le RÔLE de l'élément (tableau du STYLE-GUIDE).
   3. Ne jamais écrire de couleur, police, arrondi ou ombre dans une page : si un
      besoin manque, on l'ajoute ICI, sous un nom de rôle, pas localement.

   ORGANISATION
   1. Palette brute        — les valeurs. Jamais utilisées directement par un composant.
   2. Variables de RÔLE    — une variable par rôle (page, carte, champ, bouton…), même
                             quand deux rôles ont aujourd'hui la même couleur : changer un
                             rôle ne change pas l'autre.
   3. Base + coque         — page, barre latérale, bandeau, pied de page.
   4. Composants           — boutons, badges, cartes, champs, tableaux, menus, tiroirs…
   5. Compositions         — assemblages récurrents du modèle (carte d'action, verbatim…).
   6. Adaptatif / mouvement réduit.

   COMPORTEMENTS : theme.js (JavaScript classique, sans dépendance) remplace tout <select>, <input type="date |
   datetime-local | time | month | week | number | range | color | file"> par un composant maison. Jamais de rendu natif.
   Cases à cocher et boutons radio : habillés en CSS seul (voir .check).

   DÉPENDANCES (non embarquées) : police Inter 400/500/600/700 (Google Fonts, voir
   STYLE-GUIDE.md §Polices) ; icônes = SVG en ligne (trait 1.6–2, currentColor).
   ========================================================================= */

:root {
  /* ======================= 1. PALETTE BRUTE ======================= */
  --palette-dusk-blue: #274c77;
  --palette-steel-blue: #6096ba;
  --palette-icy-blue: #a3cef1;
  --palette-grey-olive: #8b8c89;

  --palette-ink: #16232f;
  --palette-slate: #55636d;
  --palette-slate-dim: #5e6a74;   /* 4,67:1 sur #e3edf5 — ne pas éclaircir (lisibilité) */
  --palette-white: #ffffff;
  --palette-mist: #f4f8fb;
  --palette-sky-wash: #e3edf5;
  --palette-line: hsl(206 32% 85%);
  --palette-cyan-ink: #2f6690;

  --palette-ok: #1e7a42;
  --palette-warn: #a6690a;
  --palette-danger: #c0392b;

  --palette-chart-orange: #f26419;
  --palette-chart-yellow: #f6ae2d;
  --palette-chart-green: #55a630;
  --palette-chart-magenta: #d90368;
  --palette-chart-purple: #7209b7;
  --palette-chart-turquoise: #06d6a0;

  --palette-shadow-dark: #c1c9d8;
  --palette-shadow-light: #ffffff;

  /* ======================= 2. VARIABLES DE RÔLE ======================= */

  /* ---- Texte ---- */
  --text-primary: var(--palette-ink);          /* texte courant, titres */
  --text-secondary: var(--palette-slate);      /* descriptions, valeurs secondaires */
  --text-tertiary: var(--palette-slate-dim);   /* surtitres, légendes, mentions, en-têtes de tableau */
  --text-accent: var(--palette-cyan-ink);      /* élément actif, action « lien », détail mis en avant */
  --text-brand: var(--palette-dusk-blue);      /* nom de marque */
  --text-on-accent: #ffffff;                   /* texte sur fond --accent */
  --text-on-dark: #ffffff;                     /* texte du toast */
  --text-toast-action: var(--palette-icy-blue); /* action du toast (« Annuler ») : bleu clair lisible sur le fond sombre (≈ 9:1) */

  /* ---- Accent (action principale) ---- */
  --accent: var(--palette-dusk-blue);
  --accent-soft: color-mix(in oklab, var(--palette-icy-blue) 42%, white);
  --accent-2: var(--palette-steel-blue);       /* courbe de tendance secondaire */
  --focus-ring: var(--palette-cyan-ink);       /* anneau de focus clavier (2px) */
  --focus-halo: var(--accent-soft);            /* halo de focus d'un champ (3px) */

  /* ---- Statuts ---- */
  --status-ok: var(--palette-ok);
  --status-ok-soft: color-mix(in oklab, #55a630 16%, white);
  --status-warn: var(--palette-warn);
  --status-warn-soft: color-mix(in oklab, #f6ae2d 20%, white);
  --status-danger: var(--palette-danger);
  --status-danger-soft: color-mix(in oklab, #d90368 12%, white);

  /* ---- Surfaces (un rôle = une variable) ---- */
  --surface-page: var(--palette-white);              /* fond de la page (body) */
  --surface-shell: transparent;                      /* coque .app-shell : AUCUN fond propre */
  --surface-card: var(--palette-mist);               /* carte standard, tableau, encart, filtres, pied de page */
  --surface-card-footer: var(--palette-mist);        /* barre de pied de page */
  --surface-well: var(--palette-sky-wash);           /* zone « creusée » : chiffre clé, graphique, état vide */
  --surface-control: var(--palette-sky-wash);        /* champ, liste déroulante, déclencheur */
  --surface-raised: var(--palette-white);            /* commande en relief : puce, bouton icône, onglet actif */
  --surface-sidebar: var(--palette-white);           /* barre latérale (bureau) */
  --surface-sidebar-mobile: var(--palette-sky-wash); /* barre latérale ouverte (mobile ≤1080px) */
  --surface-workspace-card: var(--palette-white);    /* carte « espace de travail » de la barre */
  --surface-nav-hover: var(--palette-white);         /* ligne de menu survolée */
  --surface-nav-active: var(--palette-white);        /* ligne de menu active (creusée) */
  --surface-popover: var(--palette-white);           /* popover de filtres */
  --surface-menu: var(--palette-white);              /* menu déroulant */
  --surface-menu-option-hover: var(--palette-sky-wash); /* option de menu survolée */
  --surface-drawer: var(--palette-white);            /* tiroir latéral et fenêtre modale */
  --surface-table-head: var(--palette-sky-wash);     /* en-tête de tableau */
  --surface-row-hover: var(--palette-sky-wash);      /* ligne de tableau cliquable survolée */
  --surface-track: var(--palette-sky-wash);          /* piste de barre de progression */
  --surface-tab-track: var(--palette-sky-wash);      /* rail des onglets */
  --surface-tab-active: var(--palette-white);        /* onglet actif */
  --surface-avatar-photo: var(--palette-sky-wash);   /* fond derrière une photo d'avatar */
  --surface-topbar: color-mix(in oklab, var(--palette-white) 88%, transparent);
  --surface-toast: var(--palette-ink);
  --surface-scrim: rgba(22, 35, 47, 0.32);           /* voile derrière tiroir / modale */
  --surface-scrim-nav: rgba(22, 35, 47, 0.35);       /* voile derrière le menu mobile */

  /* ---- Traits fins (aucune bordure de composant : seulement des filets) ---- */
  --hairline: var(--palette-line);            /* filet entre lignes, séparateur de pied de page */
  --chart-grid-line: var(--palette-line);     /* quadrillage de graphique */
  --scrollbar-thumb: var(--palette-line);

  /* ---- Boutons ---- */
  --btn-primary-bg: var(--accent);
  --btn-primary-bg-image: linear-gradient(180deg, color-mix(in oklab, var(--accent) 88%, white), transparent 65%);
  --btn-primary-fg: #ffffff;
  --btn-secondary-bg: var(--accent-soft);
  --btn-secondary-bg-hover: color-mix(in oklab, var(--palette-icy-blue) 66%, white);
  --btn-secondary-fg: var(--palette-cyan-ink);
  --btn-tertiary-bg: var(--palette-sky-wash);
  --btn-tertiary-fg: var(--palette-ink);
  --btn-icon-bg: var(--palette-white);
  --btn-icon-fg: var(--palette-ink);
  --btn-collapse-bg: var(--palette-sky-wash);
  --btn-collapse-fg: var(--palette-slate-dim);
  --btn-nav-toggle-bg: var(--palette-white);
  --btn-min-height: 40px;
  --btn-disabled-opacity: 0.5;

  /* ---- Puces de filtre ---- */
  --chip-bg: var(--palette-white);
  --chip-fg: var(--palette-slate);
  --chip-active-bg: var(--accent);
  --chip-active-fg: #ffffff;
  --chip-disabled-opacity: 0.55;
  --filter-trigger-bg: var(--palette-white);
  --filter-trigger-active-bg: var(--accent-soft);

  /* ---- Sélecteur de date (composant ajouté ; aucune couleur nouvelle) ---- */
  --datepicker-toggle-fg: var(--palette-slate-dim);
  --datepicker-day-hover-bg: var(--palette-sky-wash);
  --datepicker-outside-fg: var(--palette-slate-dim);
  --datepicker-today-ring: var(--accent);
  --datepicker-selected-bg: var(--accent);
  --datepicker-selected-fg: #ffffff;
  --datepicker-week-bg: var(--accent-soft);
  --datepicker-week-fg: var(--palette-cyan-ink);
  --check-bg: var(--palette-sky-wash);           /* case à cocher (liste multiple) */
  --check-active-bg: var(--accent);
  --check-active-fg: #ffffff;
  --check-disabled-opacity: 0.65;                /* plus haut que les boutons : la case creusée reste lisible */

  /* ---- Champ numérique, curseur, couleur, fichier (composants ajoutés ; aucune couleur nouvelle) ---- */
  --numberfield-step-bg: var(--palette-white);
  --numberfield-step-fg: var(--palette-ink);
  --slider-track-bg: var(--palette-sky-wash);
  --slider-fill: var(--accent);
  --slider-thumb-bg: var(--palette-white);
  --swatch-ring: inset 0 0 0 1.5px rgba(22, 35, 47, 0.18);      /* liseré d'une pastille de couleur */
  --colorpicker-thumb-ring: var(--palette-white);
  --colorpicker-thumb-shadow: 0 1px 5px rgba(22, 35, 47, 0.45);
  --colorpicker-black: #000000;                                  /* le modèle de couleur lui-même : noir et blanc */
  --colorpicker-white: #ffffff;                                  /* du dégradé saturation / luminosité */
  --file-item-bg: var(--palette-white);
  --file-item-fg: var(--palette-ink);

  /* ---- Badges, pastilles, variations ---- */
  --badge-bg: var(--palette-sky-wash);
  --badge-fg: var(--palette-slate);
  --badge-subtle-fg: var(--palette-slate-dim);
  --badge-accent-bg: var(--accent-soft);
  --badge-accent-fg: var(--palette-cyan-ink);
  --badge-ok-bg: var(--status-ok-soft);
  --badge-ok-fg: color-mix(in oklab, var(--status-ok) 78%, var(--text-primary));
  --badge-warn-bg: var(--status-warn-soft);
  --badge-warn-fg: color-mix(in oklab, var(--status-warn) 80%, var(--text-primary));
  --badge-danger-bg: var(--status-danger-soft);
  --badge-danger-fg: color-mix(in oklab, var(--status-danger) 76%, var(--text-primary));
  --badge-ai-bg: linear-gradient(120deg, color-mix(in oklab, var(--palette-chart-purple) 16%, white), var(--accent-soft));
  --badge-ai-ring: color-mix(in oklab, var(--palette-chart-purple) 20%, var(--hairline));
  --score-ok-bg: var(--status-ok-soft);
  --score-ok-fg: color-mix(in oklab, var(--status-ok) 80%, var(--text-primary));
  --score-warn-bg: var(--status-warn-soft);
  --score-warn-fg: color-mix(in oklab, var(--status-warn) 80%, var(--text-primary));
  --score-danger-bg: var(--status-danger-soft);
  --score-danger-fg: color-mix(in oklab, var(--status-danger) 80%, var(--text-primary));
  --delta-up-fg: color-mix(in oklab, var(--status-ok) 75%, var(--text-primary));
  --delta-down-fg: color-mix(in oklab, var(--status-danger) 72%, var(--text-primary));
  --delta-flat-fg: var(--palette-slate-dim);
  --sentiment-positive: var(--palette-chart-green);
  --sentiment-negative: var(--palette-chart-magenta);
  --sentiment-neutral: var(--palette-grey-olive);

  /* ---- Barres de progression (palette de graphique, PAS les couleurs de statut) ---- */
  --progress-fill: var(--accent);
  --progress-fill-ok: var(--palette-chart-green);
  --progress-fill-warn: var(--palette-chart-yellow);
  --progress-fill-danger: var(--palette-chart-magenta);

  /* ---- Graphiques : une couleur par série (ordre du modèle) ---- */
  --chart-1: var(--palette-chart-turquoise);
  --chart-2: var(--palette-chart-orange);
  --chart-3: var(--palette-chart-magenta);
  --chart-4: var(--palette-chart-green);
  --chart-5: var(--palette-chart-purple);
  --chart-6: var(--palette-chart-yellow);

  /* ---- Canevas de flux (postes reliés par des flèches, voir .flow-canvas) ---- */
  --flow-grid-dot: color-mix(in oklab, var(--palette-line) 70%, var(--palette-slate-dim)); /* trame pointillée du canevas */
  --flow-link: var(--palette-steel-blue);      /* flèche entre deux postes */
  --flow-link-hover: var(--status-danger);     /* flèche survolée = « cliquer pour supprimer » */
  --flow-link-leader: var(--palette-slate-dim); /* trait pointillé flèche → bulle de nom déplacée */

  /* ---- Tableau figé, glisser-déposer (voir .table-wrap.is-frozen, .drop-target) ---- */
  --frozen-edge-shadow: rgba(22, 35, 47, 0.14);                          /* ombre au bord des colonnes figées */
  --surface-drop-over: color-mix(in oklab, var(--accent-soft) 60%, var(--palette-mist)); /* carte survolée pendant un glisser */

  /* ---- Constellation de l'OG image Centauri (animation de lancement, voir .splash-stage) ----
     Valeurs mesurées au pixel dans Site_Vitrine/og-image.png, pas inventées. */
  --constellation-dot: #c4c4c4;                /* gros point de la constellation */
  --constellation-line: #f2f5f6;               /* trait entre deux points et petit point clair */
  --fade-white: 0.4s;                          /* fondu au blanc : entrée / sortie des écrans de chargement (lancement → accueil, vue → vue) */
  --brand-stage-w: min(900px, 78vw, calc(72vh * 1200 / 470)); /* largeur de la scène constellation (cadre 1200 × 470) = image de fond du hub */

  /* ---- Ombres (effet « soft UI » : deux ombres, une sombre, une claire) ---- */
  --shadow-dark: var(--palette-shadow-dark);
  --shadow-light: var(--palette-shadow-light);
  --shadow-raised: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);                 /* barre latérale */
  --shadow-control: 2px 2px 5px var(--shadow-dark), -2px -2px 5px var(--shadow-light);                /* commande au repos */
  --shadow-control-hover: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);          /* commande survolée */
  --shadow-overlay: 7px 7px 14px color-mix(in oklab, var(--shadow-dark) 85%, #a9b4c6), -7px -7px 14px var(--shadow-light); /* popover, menu */
  --shadow-inset: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);      /* creusé : champ, chiffre clé */
  --shadow-flat: none;                                                                                 /* carte standard */
  --shadow-drawer: -20px 0 44px -20px rgba(22, 35, 47, 0.35);
  --shadow-toast: 0 12px 28px -8px rgba(22, 35, 47, 0.4);
  --shadow-btn-primary: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(47, 102, 144, 0.25), 0 4px 8px -2px rgba(47, 102, 144, 0.3);
  --ring-glass: inset 0 0 0 1.5px rgba(255, 255, 255, 0.65);   /* liseré clair d'une pastille (logo) */
  --ring-glass-strong: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55);

  /* ---- Arrondis, par rôle ---- */
  --radius-panel: 24px;          /* barre latérale, popover, fenêtre modale */
  --radius-card: 18px;           /* carte standard, chiffre clé, tableau, encart, pied de page */
  --radius-card-compact: 11px;   /* carte compacte, cadre de graphique, menu déroulant */
  --radius-button: 12px;         /* bouton standard */
  --radius-button-sm: 10px;      /* petit bouton, bouton icône */
  --radius-button-icon-sm: 8px;  /* bouton icône compact, bouton replier */
  --radius-control: 10px;        /* champ, liste, déclencheur, recherche */
  --radius-nav-item: 12px;       /* ligne de menu, rail d'onglets */
  --radius-tab: 9px;             /* onglet, déclencheur de filtre */
  --radius-menu-option: 8px;     /* option de menu déroulant */
  --radius-toast: 14px;
  --radius-pill: 999px;          /* badge, puce, pastille */
  --radius-round: 50%;           /* avatar, pastille de logo, point */

  /* ---- Typographie ---- */
  --font-body: Aptos, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: var(--font-body);
  --font-size-body: 14.5px;
  --line-height-body: 1.55;

  /* ---- Mise en page ---- */
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 62px;
  --rail-item: 38px;
  --topbar-h: 58px;
  --gutter: 14px;                /* marge de la coque et écart barre latérale / contenu */
  --grid-gap: 18px;              /* écart entre cartes d'une grille */
  --card-padding: 20px;
  --card-compact-padding: 16px;
  --content-max: 2200px;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ======================= 3. BASE ======================= */

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Écran QHD / très large : on zoome toute la page (texte, cartes, espacements
   ensemble) plutôt que de laisser une mise en page standard flotter. */
@media (min-width: 2000px) {
  body { zoom: 1.15; }
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 500; letter-spacing: -0.01em; color: var(--text-primary); }
h1 { font-family: var(--font-heading); font-size: clamp(1.75rem, 2.2vw, 2rem); }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 0.98rem; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
button { font-family: inherit; }

/* Focus clavier homogène pour tout contrôle. */
:where(button, a[href], input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 6px;
}
/* La zone de contenu reçoit le focus à chaque changement de page : pas d'anneau
   quand l'arrivée n'est pas au clavier. */
.content:focus:not(:focus-visible) { outline: none; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; border: 2px solid var(--surface-page); }

/* ======================= 3b. COQUE D'APPLICATION ======================= */
/* Barre latérale « flottante » fixe + contenu. La coque n'a AUCUN fond : le blanc de
   la page suffit. Le bleuté (--surface-well) est réservé aux composants. */

.app-shell { display: flex; align-items: flex-start; gap: var(--gutter); min-height: 100vh; padding: var(--gutter); background: var(--surface-shell); }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  padding: 16px 14px 14px;
  display: flex; flex-direction: column; gap: 16px;
  position: fixed; top: var(--gutter); left: var(--gutter); z-index: 40;
  height: calc(100vh - (var(--gutter) * 2)); overflow: hidden;
  background: var(--surface-sidebar); border-radius: var(--radius-panel); box-shadow: var(--shadow-raised);
  transition: width 0.22s var(--ease-soft), padding 0.22s var(--ease-soft);
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; max-width: 200px; opacity: 1; overflow: hidden; transition: max-width 0.22s var(--ease-soft), opacity 0.15s ease 0.08s; }
.brand-name { font-family: var(--font-body); font-size: 0.94rem; font-weight: 600; color: var(--text-brand); white-space: nowrap; }
.brand-sub { font-size: 0.66rem; color: var(--text-tertiary); white-space: nowrap; }
.btn-sidebar-collapse {
  width: 26px; height: 26px; border-radius: var(--radius-button-icon-sm); flex-shrink: 0; border: none; cursor: pointer;
  background: var(--btn-collapse-bg); color: var(--btn-collapse-fg); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-inset); transition: transform 0.22s var(--ease-soft), color 0.15s ease;
}
.btn-sidebar-collapse:hover { color: var(--text-accent); }
.btn-sidebar-collapse svg { width: 13px; height: 13px; transition: transform 0.22s var(--ease-soft); }
.app-shell.sidebar-collapsed .btn-sidebar-collapse svg { transform: rotate(180deg); }
.btn-expand-sidebar {
  display: none; width: 100%; height: 30px; border-radius: 9px; border: none; cursor: pointer;
  background: var(--btn-collapse-bg); color: var(--btn-collapse-fg); align-items: center; justify-content: center;
  box-shadow: var(--shadow-inset); margin-top: -4px;
}
.btn-expand-sidebar svg { width: 13px; height: 13px; }

.workspace-card {
  border-radius: var(--radius-card); padding: 11px 13px 11px 11px;
  background: var(--surface-workspace-card); box-shadow: var(--shadow-control);
  display: flex; align-items: center; gap: 9px; overflow: hidden;
  transition: padding 0.22s var(--ease-soft), gap 0.22s var(--ease-soft), background 0.22s var(--ease-soft), box-shadow 0.22s var(--ease-soft);
}
.workspace-card > div, .sidebar-foot > div {
  min-width: 0; max-width: 200px; opacity: 1; overflow: hidden;
  transition: max-width 0.22s var(--ease-soft), opacity 0.15s ease 0.08s;
}
.workspace-card .company-mark {
  width: 26px; height: 26px; border-radius: var(--radius-round); flex-shrink: 0; overflow: hidden;
  background: var(--accent-soft); color: var(--text-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.72rem;
  box-shadow: var(--ring-glass);
}
.workspace-card .company-mark img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: var(--radius-round); }
.workspace-card b { display: block; font-size: 0.8rem; font-weight: 600; }
.workspace-card small { display: block; font-size: 0.68rem; color: var(--text-secondary); margin-top: 1px; }

.sidebar-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 16px;
  margin: 0 -14px; padding: 0 14px;
}
.nav-label {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); margin: 2px 6px 6px;
  max-width: 200px; opacity: 1; overflow: hidden;
  transition: max-width 0.22s var(--ease-soft), opacity 0.15s ease 0.08s, margin 0.22s var(--ease-soft);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-nav-item);
  background: transparent; color: var(--text-primary);
  cursor: pointer; text-align: left; border: none; width: 100%; overflow: hidden; min-width: 0;
  transition: box-shadow 0.2s var(--ease-soft), background 0.15s ease, color 0.15s ease,
    width 0.22s var(--ease-soft), padding 0.22s var(--ease-soft), gap 0.22s var(--ease-soft);
}
.nav-item:hover { background: var(--surface-nav-hover); box-shadow: var(--shadow-control); }
.nav-item .nav-ic { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-tertiary); display: inline-flex; }
.nav-item .nav-ic svg { width: 100%; height: 100%; }
/* Libellé sur UNE ligne, tronqué par « … » (jamais replié). */
.nav-item .nav-txt {
  flex: 1; font-size: 0.85rem; font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  max-width: 200px; opacity: 1; transition: max-width 0.22s var(--ease-soft), opacity 0.15s ease 0.08s;
}
.nav-item.is-active {
  background: var(--surface-nav-active); box-shadow: var(--shadow-inset); color: var(--text-accent); font-weight: 600;
}
.nav-item.is-active .nav-ic { color: var(--accent); }

/* Pied de barre latérale : toujours ancré en bas, jamais dans la zone qui défile. */
.sidebar-foot { display: flex; align-items: center; gap: 9px; margin-top: auto; flex-shrink: 0; }
.sidebar-foot b { display: block; font-size: 0.76rem; font-weight: 600; }
.sidebar-foot small { display: block; font-size: 0.66rem; color: var(--text-tertiary); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--radius-round); flex-shrink: 0;
  background: var(--accent); color: var(--text-on-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; box-shadow: var(--shadow-control);
  overflow: hidden;
}
.avatar-photo { width: 40px; height: 40px; background: var(--surface-avatar-photo); }
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (min-width: 2000px) {
  /* Compense le zoom 1.15 du body pour un élément position:fixed. Doit rester
     APRÈS la règle .sidebar de base (même spécificité : c'est l'ordre qui tranche). */
  .sidebar {
    top: calc(var(--gutter) / 1.15); left: calc(var(--gutter) / 1.15);
    height: calc((100vh - (var(--gutter) * 2)) / 1.15);
  }
}

@media (min-width: 1081px) {
  /* La barre latérale est hors flux (position: fixed) : .main-col lui réserve sa place.
     Deux gouttières (marge de la coque + écart barre/contenu) = 2 × --gutter.
     Dans le modèle, la 2e gouttière venait d'un <div class="sidebar-scrim"> vide qui
     déclenchait le gap du flex ; ici elle est explicite, donc le rendu (contenu à
     x = 294px à 1440px de large) ne dépend plus de la présence de cet élément. */
  .app-shell { gap: 0; }
  .main-col { margin-left: calc(var(--sidebar-w) + var(--gutter) * 2); transition: margin-left 0.22s var(--ease-soft); }
  .app-shell.sidebar-collapsed .main-col { margin-left: calc(var(--sidebar-w-collapsed) + var(--gutter) * 2); }
  .app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); padding-left: 12px; padding-right: 12px; }
  .app-shell.sidebar-collapsed .brand { display: none; }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .nav-item .nav-txt,
  .app-shell.sidebar-collapsed .workspace-card > div,
  .app-shell.sidebar-collapsed .sidebar-foot > div {
    max-width: 0; opacity: 0; margin: 0; pointer-events: none;
    transition: max-width 0.18s var(--ease-soft), opacity 0.1s ease;
  }
  .app-shell.sidebar-collapsed .workspace-card,
  .app-shell.sidebar-collapsed .nav-item,
  .app-shell.sidebar-collapsed .sidebar-foot {
    width: var(--rail-item); height: var(--rail-item);
    margin-left: auto; margin-right: auto;
    padding: 0; gap: 0; justify-content: center;
  }
  .app-shell.sidebar-collapsed .workspace-card { background: none; box-shadow: none; border-radius: var(--radius-nav-item); }
  .app-shell.sidebar-collapsed .company-mark,
  .app-shell.sidebar-collapsed .avatar { width: 32px; height: 32px; font-size: 0.7rem; }
  .app-shell.sidebar-collapsed .btn-expand-sidebar {
    display: flex; width: var(--rail-item); margin-left: auto; margin-right: auto;
  }
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gutter); }
/* Voile derrière le menu mobile : n'existe qu'en dessous de 1080px (voir bloc adaptatif). */
.sidebar-scrim { display: none; }

/* Bandeau « à plat » : seule la barre latérale flotte. */
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 0 6px;
  background: var(--surface-topbar);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.topbar > .topbar-left { max-width: var(--content-max); width: 100%; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-crumb { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.topbar-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.topbar-title { font-size: 0.92rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 620px) {
  .topbar-crumb .topbar-eyebrow { display: none; }
}
.btn-nav-toggle {
  display: none; width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--btn-nav-toggle-bg); box-shadow: var(--shadow-control); align-items: center; justify-content: center;
  border: none; cursor: pointer; color: var(--text-primary);
}

.content { flex: 1; }
.content-wrap { max-width: var(--content-max); margin: 0 auto; }

.site-footer {
  padding: 13px 22px; background: var(--surface-card-footer); border-radius: var(--radius-card); box-shadow: var(--shadow-flat);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.site-footer span { font-size: 0.76rem; color: var(--text-tertiary); }
.site-footer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.powered-by {
  display: flex; align-items: center; gap: 6px; margin-left: 6px; padding-left: 14px;
  border-left: 1px solid var(--hairline);
}
.powered-by span { font-size: 0.7rem; color: var(--text-tertiary); }
.powered-by img { height: 16px; width: auto; display: block; }
.powered-by b { font-size: 0.76rem; font-weight: 700; color: var(--text-brand); }

.skip {
  position: fixed; top: -60px; left: 12px; z-index: 100;
  background: var(--accent); color: var(--text-on-accent); padding: 10px 16px; border-radius: 10px;
  font-size: 0.85rem; transition: top 0.15s ease;
}
.skip:focus { top: 12px; }

/* ======================= 4. COMPOSANTS ======================= */

/* ---------- Boutons ----------
   Rang 1 = engagement (.btn-primary) · rang 2 = exploration (.btn-secondary) ·
   rang 3 = service, neutre (.btn-tertiary : Annuler, Fermer, Réinitialiser). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 0.85rem; font-weight: 500;
  min-height: var(--btn-min-height); padding: 9px 18px; border-radius: var(--radius-button); border: none; cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.3s var(--ease-soft), transform 0.15s var(--ease-soft);
  white-space: nowrap;
}
.btn:active { transition-duration: 0.05s; box-shadow: var(--shadow-inset) !important; transform: none !important; }
.btn:disabled { opacity: var(--btn-disabled-opacity); cursor: not-allowed; }
.btn-primary {
  background-color: var(--btn-primary-bg);
  background-image: var(--btn-primary-bg-image);
  color: var(--btn-primary-fg);
  box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-secondary {
  background-color: var(--btn-secondary-bg); color: var(--btn-secondary-fg); font-weight: 600;
  box-shadow: var(--shadow-control);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--btn-secondary-bg-hover);
  box-shadow: var(--shadow-control-hover);
}
.btn-tertiary { background-color: var(--btn-tertiary-bg); color: var(--btn-tertiary-fg); box-shadow: var(--shadow-control); }
.btn-tertiary:hover:not(:disabled) { box-shadow: var(--shadow-control-hover); }
/* NB (fidélité au modèle) : .btn-sm et .btn-icon* héritent du min-height de .btn
   (--btn-min-height) — ils rendent donc 40px de haut, comme dans la démo. */
.btn-sm { padding: 7px 12px; font-size: 0.78rem; border-radius: var(--radius-button-sm); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-button-sm); background: var(--btn-icon-bg); box-shadow: var(--shadow-control); color: var(--btn-icon-fg); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon-sm { width: 26px; height: 26px; border-radius: var(--radius-button-icon-sm); }
.btn-icon-sm svg { width: 13px; height: 13px; }

/* Action « lien » : texte accentué sans fond (Réinitialiser, Affiner par…).
   Avec une icône chevron : ajouter .with-icon. */
.link-action { background: none; border: none; font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--text-accent); cursor: pointer; padding: 6px 2px; }
.link-action.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.link-action svg { width: 12px; height: 12px; transition: transform 0.2s var(--ease-soft); }

/* ---------- Badges, pastilles, variations ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 0.72rem; font-weight: 600; color: var(--badge-fg); background: var(--badge-bg);
  box-shadow: var(--shadow-inset); white-space: nowrap;
}
.badge-accent { color: var(--badge-accent-fg); background: var(--badge-accent-bg); box-shadow: none; }
.badge-warn { color: var(--badge-warn-fg); background: var(--badge-warn-bg); box-shadow: none; }
.badge-ok { color: var(--badge-ok-fg); background: var(--badge-ok-bg); box-shadow: none; }
.badge-danger { color: var(--badge-danger-fg); background: var(--badge-danger-bg); box-shadow: none; }
.badge-subtle { color: var(--badge-subtle-fg); }
.badge-anon { color: var(--badge-subtle-fg); background: none; box-shadow: none; font-style: italic; font-weight: 500; }
.badge-ai {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap;
  color: var(--text-accent);
  background: var(--badge-ai-bg);
  box-shadow: inset 0 0 0 1px var(--badge-ai-ring);
}
.badge-ai svg { width: 12px; height: 12px; flex-shrink: 0; }
.ai-note { font-size: 0.72rem; color: var(--text-tertiary); font-style: italic; margin-top: 4px; }

.score-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 700;
}
.score-pill.ok { background: var(--score-ok-bg); color: var(--score-ok-fg); }
.score-pill.warn { background: var(--score-warn-bg); color: var(--score-warn-fg); }
.score-pill.danger { background: var(--score-danger-bg); color: var(--score-danger-fg); }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 0.72rem; font-weight: 700; }
.delta.up { color: var(--delta-up-fg); }
.delta.down { color: var(--delta-down-fg); }
.delta.flat { color: var(--delta-flat-fg); }

.sentiment-dot { width: 8px; height: 8px; border-radius: var(--radius-round); flex-shrink: 0; }
.sentiment-dot.is-positive { background: var(--sentiment-positive); }
.sentiment-dot.is-negative { background: var(--sentiment-negative); }
.sentiment-dot.is-neutral { background: var(--sentiment-neutral); }

/* ---------- Cartes ----------
   Carte standard = --surface-card (#f4f8fb), à plat, SANS ombre.
   Zone creusée   = --surface-well (#e3edf5) + ombre inset : ce qu'on vient LIRE
                    (chiffre clé, graphique) — jamais un fond de carte ordinaire. */
.card {
  position: relative; background: var(--surface-card); border-radius: var(--radius-card);
  box-shadow: var(--shadow-flat); padding: var(--card-padding);
}
.card-compact { padding: var(--card-compact-padding); border-radius: var(--radius-card-compact); box-shadow: var(--shadow-flat); }
.card-well { background: var(--surface-well); box-shadow: var(--shadow-inset); }
.card-label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 10px; }
.card-flag { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.card-flag-actions { display: flex; align-items: center; gap: 10px; }

/* Chiffre clé (indicateur de synthèse) : carte creusée. */
.kpi-card {
  display: flex; flex-direction: column; gap: 8px; justify-content: space-between; min-height: 0; padding: 18px 20px;
  background: var(--surface-well); border-radius: var(--radius-card); box-shadow: var(--shadow-inset);
}
.kpi-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); line-height: 1.3; display: block; min-height: 2.4em; }
.kpi-value { display: flex; align-items: baseline; gap: 6px; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
.kpi-value small { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); }
.kpi-card .kpi-value { font-size: 2rem; margin: 4px 0 6px; }
.kpi-card .kpi-value small { font-size: 1rem; }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0; }
.kpi-ref { font-size: 0.76rem; color: var(--text-tertiary); text-align: right; }
.kpi-row.no-delta { justify-content: flex-start; }
.kpi-row.no-delta .kpi-ref { text-align: left; }
.kpi-row .badge { white-space: normal; text-align: left; }   /* tuile étroite (téléphone) : la pastille passe à la ligne au lieu de déborder */
@media (max-width: 560px) {
  .kpi-card { padding: 16px; }
  .kpi-card .kpi-value { font-size: 1.7rem; }
  .kpi-row { row-gap: 2px; }
  .kpi-ref { text-align: left; }
}

/* Encart d'information (fond carte, à plat). */
.callout {
  border-radius: var(--radius-card); padding: 13px 17px; background: var(--surface-card);
  box-shadow: var(--shadow-flat); font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5;
}
.callout strong { color: var(--text-primary); }
.callout.callout-warn { background: var(--status-warn-soft); }

.disclosure { margin: 14px 0; border-radius: var(--radius-card); background: var(--surface-card); box-shadow: var(--shadow-flat); padding: 2px 16px; }
.disclosure summary {
  cursor: pointer; padding: 11px 0; font-size: 0.82rem; font-weight: 600; color: var(--text-accent);
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.disclosure summary::-webkit-details-marker { display: none; }
/* Chevron enrouler/dérouler : même tracé que le chevron des listes déroulantes, couleur du résumé. */
.disclosure summary::after {
  content: ""; flex: 0 0 auto; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.22s var(--ease-soft);
}
.disclosure[open] > summary::after { transform: rotate(180deg); }
.disclosure p { padding-bottom: 13px; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

.empty-state {
  padding: 30px 18px; text-align: center; color: var(--text-secondary); font-size: 0.84rem;
  border-radius: var(--radius-card); background: var(--surface-well); box-shadow: var(--shadow-inset);
}
.empty-state h3 { margin-bottom: 6px; color: var(--text-primary); }
.empty-state p { font-size: 0.82rem; color: var(--text-secondary); }

.card-note { border-radius: var(--radius-card-compact); padding: 10px 12px; background: var(--surface-well); font-size: 0.78rem; color: var(--text-secondary); }
.card-note b { color: var(--text-primary); }

/* ---------- Texte ---------- */
.text-fine { font-size: 0.76rem; color: var(--text-tertiary); }
.text-unavailable { font-size: 0.78rem; color: var(--text-tertiary); font-style: italic; padding: 10px 0; }
.text-intro { font-size: 0.86rem; color: var(--text-secondary); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 34px 0 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head small { font-size: 0.76rem; color: var(--text-secondary); }
.section-head:first-child { margin-top: 0; }
.section-head-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin-bottom: 18px; }  /* le modèle les aligne toujours à droite */

/* ---------- Grilles ---------- */
.grid { display: grid; gap: var(--grid-gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.kpi-grid { margin-bottom: 30px; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Les quatre chiffres clés restent en 2×2 jusqu'au mobile. */
@media (max-width: 1200px) { .kpi-grid.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) { .grid-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Puces de filtre, liste déroulante, sélecteur ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; min-width: 0; }
.toolbar > .chips { min-width: 0; }
.toolbar .spacer { flex: 1; }
.toolbar h2 { margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 7px 13px; border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 500; color: var(--chip-fg); background: var(--chip-bg);
  box-shadow: var(--shadow-control); cursor: pointer; border: none; font-family: inherit;
}
.chip:disabled { cursor: not-allowed; opacity: var(--chip-disabled-opacity); box-shadow: var(--shadow-inset); }
.chip .chip-count { font-size: 0.7rem; font-weight: 700; opacity: 0.7; }
.chip.is-active { background: var(--chip-active-bg); color: var(--chip-active-fg); box-shadow: var(--shadow-control); font-weight: 600; }
.chip:hover:not(.is-active) { box-shadow: var(--shadow-control-hover); }

.fb-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.fb-field { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
/* Liste déroulante — JAMAIS le <select> natif. On écrit un <select> ordinaire ; theme.js le remplace par
   ce composant (le <select> reste masqué dans le DOM : valeur, name, required, change). Même principe
   que le sélecteur de langue du site vitrine : la largeur suit le CONTENU.
   · déclencheur : largeur de l'option la plus longue (ne bouge pas selon le choix), ellipse si le conteneur est plus étroit ;
   · menu : largeur de son contenu (jamais plus étroit que le déclencheur), s'aligne à droite s'il dépasse de l'écran,
     s'ouvre vers le haut s'il manque de la place dessous ;
   · dans un champ de formulaire (.field) ou un popover (.fp-field) : même hauteur qu'un champ de saisie, largeur selon le contenu ;
     pleine largeur seulement si on ajoute la classe dropdown-block au <select> ;
   · <select multiple> : cases à cocher, le menu reste ouvert, le déclencheur résume le choix.
   La pastille de couleur devant chaque option est optionnelle (attribut data-swatch="chart-1" sur l'<option>). */
.dropdown { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.dropdown .dropdown-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; box-shadow: none; }
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 8px; font-family: inherit; text-align: left;
  font-size: 0.8rem; color: var(--text-primary); padding: 8px 12px; border-radius: var(--radius-control); border: none;
  background: var(--surface-control); box-shadow: var(--shadow-inset); cursor: pointer; max-width: 100%;
}
.dropdown-trigger:disabled { opacity: var(--btn-disabled-opacity); cursor: not-allowed; }
.dropdown-label { display: grid; flex: 1 1 auto; min-width: 0; }
.dropdown-label > * { grid-area: 1 / 1; white-space: nowrap; }
.dropdown-value { overflow: hidden; text-overflow: ellipsis; }
.dropdown-ghost { visibility: hidden; height: 0; overflow: hidden; pointer-events: none; }
.dropdown-trigger.is-placeholder .dropdown-value { color: var(--text-tertiary); }
.dropdown-trigger svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--text-tertiary); transition: transform 0.15s var(--ease-soft); }
.dropdown.is-open .dropdown-trigger svg { transform: rotate(180deg); }
.dropdown-trigger i, .dropdown-option i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: max-content; min-width: 100%;
  max-width: min(360px, calc(100vw - 24px)); max-height: 260px; overflow-y: auto;
  background: var(--surface-menu); border-radius: var(--radius-card-compact); box-shadow: var(--shadow-overlay);
  padding: 6px; margin: 0; list-style: none; animation: fade 0.15s ease;
}
.dropdown.is-up .dropdown-menu { top: auto; bottom: calc(100% + 6px); }
.dropdown.is-end .dropdown-menu { left: auto; right: 0; }
.dropdown.is-fixed .dropdown-menu, .datepicker.is-fixed .datepicker-panel { position: fixed; right: auto; bottom: auto; }
.dropdown-option {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; font-family: inherit; white-space: nowrap;
  font-size: 0.82rem; color: var(--text-primary); padding: 9px 10px; border-radius: var(--radius-menu-option); border: none;
  background: none; cursor: pointer;
}
.dropdown-option:hover, .dropdown-option.is-focus { background: var(--surface-menu-option-hover); }
.dropdown-option.is-active { background: var(--accent-soft); color: var(--text-accent); font-weight: 600; }
.dropdown-option:disabled { opacity: 0.5; cursor: default; }
/* Formulaire et popover : cotes d'un champ de saisie, mais LARGEUR SELON LE CONTENU (le conteneur .field est une colonne
   flex qui étire ses enfants : align-self ramène la liste à la taille de son contenu). */
.field .dropdown, .fp-field .dropdown { align-self: flex-start; }
.field .dropdown-trigger, .fp-field .dropdown-trigger { font-size: 0.86rem; padding: 10px 12px; }
.fp-field .dropdown-trigger { padding: 9px 12px; }
/* Pleine largeur (option) : classe .dropdown-block sur le <select>. */
.dropdown.dropdown-block, .field .dropdown.dropdown-block { display: block; align-self: stretch; }
.dropdown.dropdown-block .dropdown-trigger { width: 100%; }

/* Liste à sélection multiple : case à cocher devant chaque option. */
.dropdown-check {
  width: 16px; height: 16px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; background: var(--check-bg); box-shadow: var(--shadow-inset); color: transparent;
}
.dropdown-check svg { width: 10px; height: 10px; }
.dropdown-option.is-active .dropdown-check { background: var(--check-active-bg); color: var(--check-active-fg); box-shadow: none; }
.dropdown.is-multiple .dropdown-option.is-active { background: none; color: var(--text-primary); font-weight: 600; }
.dropdown.is-multiple .dropdown-option.is-active:hover, .dropdown.is-multiple .dropdown-option.is-active.is-focus { background: var(--surface-menu-option-hover); }

/* Sélecteur de date — JAMAIS le calendrier natif. On écrit un <input type="date"> ordinaire ; theme.js le
   remplace par un champ creusé (saisie jj/mm/aaaa possible) + un calendrier dans le style du kit.
   Le <input type="date"> reste masqué dans le DOM et garde la valeur ISO (aaaa-mm-jj), name, required, min, max.
   Composant ajouté au kit à la demande : il n'existe pas dans la démo d'origine ; il n'emploie que des
   variables de rôle existantes (jour sélectionné = puce active, survol = option de menu, panneau = popover). */
.datepicker { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.datepicker .datepicker-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; box-shadow: none; }
.datepicker-input {
  font-family: inherit; font-size: 0.86rem; color: var(--text-primary); width: 11.5em; max-width: 100%;
  padding: 10px 12px; border-radius: var(--radius-control); border: none; background: var(--surface-control); box-shadow: var(--shadow-inset);
}
.datepicker .datepicker-input { padding-right: 40px; width: 11.5em; }
.datepicker.is-datetime .datepicker-input { width: 15em; }
.datepicker.is-time .datepicker-input { width: 8em; }
.datepicker.is-month .datepicker-input { width: 9em; }
.datepicker.is-week .datepicker-input { width: 12.5em; }
.datepicker.datepicker-block, .field .datepicker.datepicker-block { display: block; align-self: stretch; }
.datepicker.datepicker-block .datepicker-input { width: 100%; }
.datepicker-input:focus { outline: none; box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo); }
.datepicker-input:disabled { color: var(--text-tertiary); }
.datepicker-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center; border: none; background: none;
  border-radius: var(--radius-button-sm); color: var(--datepicker-toggle-fg); cursor: pointer;
}
.datepicker-toggle:hover, .datepicker.is-open .datepicker-toggle { color: var(--text-accent); }
.datepicker-toggle:disabled { cursor: not-allowed; opacity: var(--btn-disabled-opacity); }
.datepicker-toggle svg { width: 16px; height: 16px; }
.field .datepicker { align-self: flex-start; }
.datepicker-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: 296px; max-width: calc(100vw - 24px); padding: 14px;
  background: var(--surface-popover); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay);
  animation: fade 0.15s ease;
}
.datepicker-panel:focus { outline: none; }
.datepicker.is-up .datepicker-panel { top: auto; bottom: calc(100% + 6px); }
.datepicker.is-end .datepicker-panel { left: auto; right: 0; }
.datepicker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.datepicker-title {
  flex: 1; min-width: 0; padding: 6px 8px; border: none; background: none; border-radius: var(--radius-control);
  font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text-primary); text-transform: capitalize; cursor: pointer;
}
.datepicker-title:hover { background: var(--surface-menu-option-hover); }
.datepicker-nav {
  width: 30px; height: 30px; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-button-sm); background: var(--btn-icon-bg); color: var(--btn-icon-fg);
  box-shadow: var(--shadow-control); cursor: pointer;
}
.datepicker-nav:hover { box-shadow: var(--shadow-control-hover); }
.datepicker-nav:active { box-shadow: var(--shadow-inset); }
.datepicker-nav svg { width: 14px; height: 14px; }
.datepicker-weekdays, .datepicker-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.datepicker-weekdays span { text-align: center; padding: 4px 0; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.datepicker-day, .datepicker-month {
  padding: 0; border: none; background: none; border-radius: var(--radius-control); cursor: pointer;
  font-family: inherit; font-size: 0.82rem; color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.datepicker-day { height: 34px; }
.datepicker-month { height: 38px; text-transform: capitalize; }
.datepicker-day:hover, .datepicker-month:hover { background: var(--datepicker-day-hover-bg); }
.datepicker-day.is-outside { color: var(--datepicker-outside-fg); }
.datepicker-day.is-today, .datepicker-month.is-today { box-shadow: inset 0 0 0 1.5px var(--datepicker-today-ring); }
.datepicker-day.is-selected, .datepicker-month.is-selected {
  background: var(--datepicker-selected-bg); color: var(--datepicker-selected-fg); font-weight: 600; box-shadow: var(--shadow-control);
}
.datepicker-day:disabled { opacity: 0.35; cursor: not-allowed; background: none; box-shadow: none; }
.datepicker-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.datepicker-title.is-static { cursor: default; text-align: center; }
.datepicker-title.is-static:hover { background: none; }
.datepicker-day.is-week { background: var(--datepicker-week-bg); color: var(--datepicker-week-fg); font-weight: 600; border-radius: 0; }
.datepicker-day.is-week-start { border-radius: var(--radius-control) 0 0 var(--radius-control); }
.datepicker-day.is-week-end { border-radius: 0 var(--radius-control) var(--radius-control) 0; }
.datepicker.is-week .datepicker-days { column-gap: 0; }
.datepicker-panel.is-time { width: 224px; }
.datepicker-timecol { min-width: 0; }
.datepicker-time { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.datepicker-days + .datepicker-time { margin-top: 10px; padding-top: 8px; box-shadow: inset 0 1px 0 var(--hairline); }
.datepicker-timehead { display: block; text-align: center; padding: 2px 0 6px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.datepicker-timelist { position: relative; display: flex; flex-direction: column; gap: 2px; max-height: 184px; overflow-y: auto; padding: 2px; }
.datepicker-days + .datepicker-time .datepicker-timelist { max-height: 124px; }
.datepicker-timeitem {
  flex-shrink: 0; height: 30px; padding: 0; border: none; background: none; border-radius: var(--radius-control); cursor: pointer;
  font-family: inherit; font-size: 0.82rem; color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.datepicker-timeitem:hover { background: var(--datepicker-day-hover-bg); }
.datepicker-timeitem.is-selected { background: var(--datepicker-selected-bg); color: var(--datepicker-selected-fg); font-weight: 600; box-shadow: var(--shadow-control); }
.datepicker-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 6px; box-shadow: inset 0 1px 0 var(--hairline); }

/* Champ numérique — JAMAIS le <input type="number"> natif. theme.js le remplace : champ creusé (on peut taper ;
   la virgule décimale est acceptée) + boutons − / + en relief. ↑ ↓ changent d'un pas, Maj ou Page ↑ / ↓ de dix pas ;
   maintenir un bouton répète. min, max, step (y compris « any »), required, disabled, readonly respectés. La valeur
   envoyée reste un nombre avec un point décimal. Largeur selon le nombre de caractères attendus. */
.numberfield {
  position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle;
  padding: 4px 4px 4px 12px; border-radius: var(--radius-control); background: var(--surface-control); box-shadow: var(--shadow-inset);
}
.numberfield:focus-within { box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo); }
.numberfield .numberfield-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; box-shadow: none; }
.numberfield .numberfield-input {
  flex: 1 1 auto; min-width: 0; width: calc(var(--nf-chars, 6) * 1ch); padding: 0; border: none; border-radius: 0; background: none; box-shadow: none;
  font-family: inherit; font-size: 0.86rem; color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.numberfield .numberfield-input:focus, .numberfield .numberfield-input:focus-visible { outline: none; box-shadow: none; }
.numberfield .numberfield-input:disabled { color: var(--text-tertiary); }
.numberfield-steps { display: flex; gap: 3px; flex-shrink: 0; }
.numberfield-step {
  width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer;
  border-radius: var(--radius-button-sm); background: var(--numberfield-step-bg); color: var(--numberfield-step-fg); box-shadow: var(--shadow-control);
}
.numberfield-step:hover:not(:disabled) { box-shadow: var(--shadow-control-hover); }
.numberfield-step:active:not(:disabled) { box-shadow: var(--shadow-inset); }
.numberfield-step:disabled { opacity: var(--btn-disabled-opacity); cursor: not-allowed; }
.numberfield-step svg { width: 14px; height: 14px; }
.field .numberfield { align-self: flex-start; }

/* Curseur — JAMAIS le <input type="range"> natif. Piste creusée, remplissage bleu foncé, poignée blanche en relief,
   valeur affichée à droite (unité : attribut data-unit, ex. data-unit="%"). Glisser ou cliquer sur la piste ;
   ← → ↑ ↓ changent d'un pas, Page ↑ / ↓ de dix pas, Début / Fin = bornes. « input » pendant le glissement, « change » au relâchement. */
.slider { position: relative; display: inline-flex; align-items: center; gap: 12px; width: 260px; max-width: 100%; min-height: 36px; vertical-align: middle; }
.slider .slider-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; box-shadow: none; }
.slider-track {
  position: relative; flex: 1 1 auto; height: 7px; margin: 0 10px; border-radius: var(--radius-pill);
  background: var(--slider-track-bg); box-shadow: var(--shadow-inset); cursor: pointer; touch-action: none;
}
.slider-track::before { content: ""; position: absolute; inset: -12px -10px; } /* zone de prise plus large que la piste */
.slider-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--slider-fill); pointer-events: none; }
.slider-thumb {
  position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: var(--radius-round);
  background: var(--slider-thumb-bg); box-shadow: var(--shadow-control); cursor: grab;
}
.slider-thumb:hover { box-shadow: var(--shadow-control-hover); }
.slider.is-dragging .slider-thumb { box-shadow: var(--shadow-inset); cursor: grabbing; }
.slider-value { flex-shrink: 0; min-width: 3ch; text-align: right; font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.slider.is-disabled { opacity: var(--btn-disabled-opacity); pointer-events: none; }
.slider.slider-block { display: flex; width: 100%; }
.field .slider { align-self: flex-start; }
.field .slider.slider-block { align-self: stretch; }

/* Sélecteur de couleur — JAMAIS le <input type="color"> natif. Champ hexadécimal (on peut taper #rgb ou #rrggbb) avec
   pastille ; le panneau propose une zone saturation / luminosité, une barre de teinte et les couleurs de la palette du
   kit (lues dans les variables --palette-*). Les dégradés du sélecteur sont le modèle de couleur lui-même (teinte,
   noir, blanc) : ce sont les seules couleurs « en dur » du fichier, et elles ne décorent rien. */
.colorfield { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.colorfield .colorfield-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; box-shadow: none; }
.colorfield .colorfield-input {
  width: 9.5em; max-width: 100%; padding: 10px 12px 10px 44px; border: none; border-radius: var(--radius-control);
  background: var(--surface-control); box-shadow: var(--shadow-inset); font-family: inherit; font-size: 0.86rem; color: var(--text-primary);
  font-variant-numeric: tabular-nums; text-transform: uppercase;
}
.colorfield .colorfield-input:focus { outline: none; box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo); }
.colorfield .colorfield-input:disabled { color: var(--text-tertiary); }
.colorfield-swatch {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; padding: 0; border: none;
  border-radius: 8px; box-shadow: var(--swatch-ring); cursor: pointer;
}
.colorfield-swatch:disabled { cursor: not-allowed; opacity: var(--btn-disabled-opacity); }
.field .colorfield { align-self: flex-start; }
.colorpicker-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: 248px; max-width: calc(100vw - 24px); padding: 14px;
  background: var(--surface-popover); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); animation: fade 0.15s ease;
}
.colorpicker-panel:focus { outline: none; }
.colorfield.is-up .colorpicker-panel { top: auto; bottom: calc(100% + 6px); }
.colorfield.is-end .colorpicker-panel { left: auto; right: 0; }
.colorfield.is-fixed .colorpicker-panel { position: fixed; right: auto; bottom: auto; }
.colorpicker-sv {
  position: relative; height: 148px; border-radius: var(--radius-card-compact); cursor: crosshair; touch-action: none;
  background-color: hsl(var(--cp-hue, 0) 100% 50%);
  background-image: linear-gradient(to top, var(--colorpicker-black), transparent), linear-gradient(to right, var(--colorpicker-white), transparent);
}
.colorpicker-hue {
  position: relative; height: 12px; margin: 14px 4px 14px; border-radius: var(--radius-pill); cursor: pointer; touch-action: none;
  background: linear-gradient(to right, hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%));
}
.colorpicker-hue::before { content: ""; position: absolute; inset: -8px -4px; }
.colorpicker-thumb {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: var(--radius-round); pointer-events: none;
  box-shadow: 0 0 0 2.5px var(--colorpicker-thumb-ring), var(--colorpicker-thumb-shadow);
}
.colorpicker-hue .colorpicker-thumb { top: 50%; }
.colorpicker-presets { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.colorpicker-preset { aspect-ratio: 1; padding: 0; border: none; border-radius: 8px; box-shadow: var(--swatch-ring); cursor: pointer; }
.colorpicker-preset:hover { box-shadow: var(--swatch-ring), 0 0 0 2px var(--datepicker-day-hover-bg); }
.colorpicker-preset.is-selected { box-shadow: var(--swatch-ring), 0 0 0 2px var(--colorpicker-thumb-ring), 0 0 0 4px var(--accent); }

/* Champ fichier — JAMAIS le <input type="file"> natif. Bouton secondaire + glisser-déposer dans une zone creusée ;
   les fichiers choisis sont listés (nom, taille, retirer). multiple, accept, required, disabled respectés. Limite : la
   fenêtre de sélection de fichiers elle-même est celle du système (aucun navigateur ne permet de la remplacer). */
.filefield {
  position: relative; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 100%; min-width: 0;
  padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-control); box-shadow: var(--shadow-inset);
  vertical-align: middle;
}
.filefield.is-dragover { box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo); }
.filefield .filefield-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; box-shadow: none; }
.filefield-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filefield-trigger svg { width: 16px; height: 16px; flex-shrink: 0; }
.filefield-hint { font-size: 0.76rem; color: var(--text-tertiary); }
.filefield-list { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; margin: 0; padding: 0; list-style: none; }
.filefield-list:empty { display: none; }
.filefield-item {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 5px 4px 12px;
  border-radius: var(--radius-pill); background: var(--file-item-bg); color: var(--file-item-fg); box-shadow: var(--shadow-control);
}
.filefield-name { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; font-weight: 500; }
.filefield-size { flex-shrink: 0; font-size: 0.72rem; color: var(--text-tertiary); white-space: nowrap; }
.filefield-remove {
  width: 22px; height: 22px; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer;
  border-radius: var(--radius-round); background: none; color: var(--text-tertiary);
}
.filefield-remove:hover { background: var(--surface-menu-option-hover); color: var(--text-accent); }
.filefield-remove svg { width: 12px; height: 12px; }
.filefield.is-disabled { opacity: var(--btn-disabled-opacity); }
.field .filefield { align-self: flex-start; }

/* Déclencheur de filtre (icône) + popover */
.filter-trigger {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-tab); border: none; cursor: pointer;
  background: var(--filter-trigger-bg); box-shadow: var(--shadow-control); color: var(--text-primary);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  transition: box-shadow 0.2s var(--ease-soft);
}
.filter-trigger:hover { box-shadow: var(--shadow-control-hover); }
.filter-trigger svg { width: 14px; height: 14px; }
.filter-trigger.has-active { background: var(--filter-trigger-active-bg); color: var(--text-accent); }
.filter-trigger.has-active::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--filter-trigger-bg);
}
.filter-popover {
  position: fixed; z-index: 85; width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface-popover); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
  animation: fade 0.15s ease;
}
.filter-popover .fp-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
.filter-popover .fp-field { display: flex; flex-direction: column; gap: 5px; }
.filter-popover .fp-field label { font-size: 0.74rem; font-weight: 600; color: var(--text-secondary); }
.filter-popover .fp-scope { font-size: 0.74rem; color: var(--text-tertiary); line-height: 1.45; padding-top: 10px; box-shadow: inset 0 1px 0 var(--hairline); }
.filter-popover .fp-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.filter-popover .link-action { padding: 6px 4px; }
.filter-popover .fp-close { flex-shrink: 0; }

/* Recherche + bloc de filtres */
.search-input {
  font-family: inherit; font-size: 0.86rem; color: var(--text-primary); flex: 1 1 240px; max-width: 360px;
  padding: 9px 14px; border-radius: var(--radius-control); border: none; background: var(--surface-control); box-shadow: var(--shadow-inset);
}
.search-input:focus { outline: none; box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo); }
.filter-block { background: var(--surface-card); border-radius: var(--radius-card); box-shadow: var(--shadow-flat); padding: 14px 16px; margin-bottom: 16px; }
.fbk-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fbk-row + .fbk-row { margin-top: 12px; }
.fbk-group { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; flex: 1 1 100%; min-width: 0; }
.fbk-group > .fb-label { padding-top: 9px; flex-shrink: 0; min-width: 78px; }
.fbk-group > .chips { flex: 1 1 320px; min-width: 0; }
.fbk-more { margin-top: 12px; padding-top: 12px; box-shadow: inset 0 1px 0 var(--hairline); display: none; }
.filter-block.is-open .fbk-more { display: block; }
.fbk-more .fbk-group + .fbk-group { margin-top: 12px; }
.filter-block.is-open .link-action svg { transform: rotate(180deg); }
.fbk-count { font-size: 0.82rem; color: var(--text-secondary); }
.fbk-count b { color: var(--text-primary); font-weight: 600; }
.fbk-spacer { flex: 1; }
@media (max-width: 620px) {
  .fbk-group > .fb-label { min-width: 0; padding-top: 0; width: 100%; }
  /* Sous 620px : les puces défilent horizontalement (dégradé de bord = « la liste continue »). */
  .fbk-group > .chips, .toolbar > .chips {
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity;
    padding: 2px 2px 6px; margin: -2px -2px -6px; scrollbar-width: none;
  }
  .fbk-group > .chips::-webkit-scrollbar, .toolbar > .chips::-webkit-scrollbar { display: none; }
  .fbk-group > .chips > .chip, .toolbar > .chips > .chip { flex-shrink: 0; scroll-snap-align: start; }
  .fbk-group > .chips, .toolbar > .chips {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
  }
}

/* ---------- Onglets ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-tab-track); border-radius: var(--radius-nav-item); box-shadow: var(--shadow-inset); margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: none; background: transparent; padding: 7px 13px; border-radius: var(--radius-tab); font-family: inherit; font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.tab.is-active { background: var(--surface-tab-active); color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow-control); }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 10px 0; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; min-width: 0; }
.field input, .field textarea {
  font-family: inherit; font-size: 0.86rem; color: var(--text-primary); width: 100%;
  padding: 10px 12px; border-radius: var(--radius-control); border: none;
  background: var(--surface-control); box-shadow: var(--shadow-inset);
}
.field input:disabled { color: var(--text-tertiary); }
.field textarea { resize: vertical; min-height: 56px; }
.field input:focus, .field textarea:focus {
  outline: none; box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo);
}
/* Défini dans le modèle mais jamais affiché par lui (validation native du navigateur). */
.field-error { font-size: 0.7rem; color: var(--status-danger); min-height: 14px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }

/* Cases à cocher et boutons radio — habillés sans script (l'élément natif reste l'élément réel : clavier, formulaire,
   lecteurs d'écran). À placer dans un <label class="check">, JAMAIS dans un .field. Groupe : .check-group. */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 18px; height: 18px; margin: 0; padding: 0; border: none;
  display: inline-grid; place-content: center; vertical-align: middle; cursor: pointer;
  background: var(--check-bg); color: var(--check-active-fg); box-shadow: var(--shadow-inset);
}
input[type="checkbox"] { border-radius: 6px; }
input[type="radio"] { border-radius: var(--radius-round); }
input[type="checkbox"]::after, input[type="radio"]::after { content: ""; background: currentColor; transform: scale(0); transition: transform 0.12s ease; }
input[type="checkbox"]::after { width: 10px; height: 10px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); }
input[type="radio"]::after { width: 8px; height: 8px; border-radius: var(--radius-round); }
input[type="checkbox"]:checked, input[type="radio"]:checked, input[type="checkbox"]:indeterminate { background: var(--check-active-bg); box-shadow: none; }
input[type="checkbox"]:checked::after, input[type="radio"]:checked::after { transform: scale(1); }
input[type="checkbox"]:indeterminate::after { width: 10px; height: 2px; border-radius: 2px; clip-path: none; transform: scale(1); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: var(--check-disabled-opacity); cursor: not-allowed; }
label.check { display: inline-flex; align-items: center; gap: 9px; font-size: 0.86rem; line-height: 1.3; color: var(--text-primary); cursor: pointer; }
label.check:has(input:disabled) { color: var(--text-tertiary); cursor: not-allowed; }
.check-group { display: flex; flex-direction: column; gap: 8px; }
.check-group.is-inline { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }

/* ---------- Tableaux ---------- */
.table-wrap { border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-flat); background: var(--surface-card); }
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.data-table thead th {
  text-align: left; padding: 11px 16px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-tertiary); background: var(--surface-table-head); white-space: nowrap;
}
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; font: inherit; text-transform: inherit;
  letter-spacing: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer;
}
.th-sort:hover { color: var(--text-primary); }
.th-sort.is-active { color: var(--text-accent); }
.th-sort-arrow { width: 10px; height: 10px; flex-shrink: 0; opacity: 0.4; transition: transform 0.15s var(--ease-soft), opacity 0.15s ease; }
.th-sort-arrow-neutral { width: 11px; height: 15px; }
.th-sort:hover .th-sort-arrow { opacity: 0.7; }
.th-sort-arrow.is-asc, .th-sort-arrow.is-desc { opacity: 1; color: var(--text-accent); }
.th-sort-arrow.is-desc { transform: rotate(180deg); }
table.data-table tbody td { padding: 12px 16px; vertical-align: middle; box-shadow: inset 0 1px 0 var(--hairline); }
table.data-table tbody tr:first-child td { box-shadow: none; }
table.data-table tbody tr.is-clickable { cursor: pointer; transition: background 0.15s ease; }
table.data-table tbody tr.is-clickable:hover { background: var(--surface-row-hover); }
table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table td.center, table.data-table th.center { text-align: center; }
table.data-table th.num { text-align: right; }
table.data-table .cell-strong { font-weight: 600; }
table.data-table td small { display: block; margin-top: 2px; font-size: 0.72rem; color: var(--text-tertiary); line-height: 1.35; font-weight: 400; }
.table-hint { display: none; padding: 8px 16px; font-size: 0.74rem; color: var(--text-tertiary); background: var(--surface-well); }
@media (max-width: 900px) { .table-hint { display: block; } }

/* ---------- Tableau figé (grands tableaux de saisie) ----------
   Ajouté pour Balance Suite (Demo_équilibrage) : absent du modèle QVCT.
   .table-wrap.is-frozen          l'enveloppe défile elle-même (horizontal ET vertical, hauteur plafonnée)
     table.data-table.is-frozen   en-tête collant en haut ; largeur selon le contenu (jamais de « … »)
       .is-frozen-col             colonne figée à gauche — `left` posé par le script (largeur réelle des
                                  colonnes précédentes, mesurée après mise en page) ; .is-frozen-edge = dernière
       .col-gutter + .row-add     gouttière de gauche : bouton « + » révélé au survol de la ligne
       tr.is-separator            ligne de séparation (libellé en capitales, fond creusé)
   .table-scrollbar-top > div     barre de défilement horizontale dupliquée AU-DESSUS du tableau (largeur
                                  du div intérieur = largeur du tableau, défilement synchronisé par script)
   .action-menu > .dropdown-option  petit menu flottant (position fixe, posé par script) — mêmes options
                                  que la liste déroulante du kit. */
.table-wrap.is-frozen { overflow: auto; max-height: clamp(260px, calc(100vh - 320px), 900px); }
table.data-table.is-frozen { width: max-content; min-width: 100%; }
table.data-table.is-frozen thead th { position: sticky; top: 0; z-index: 2; }
table.data-table.is-frozen .is-frozen-col { position: sticky; z-index: 1; background: var(--surface-card); }
table.data-table.is-frozen thead .is-frozen-col { z-index: 3; background: var(--surface-table-head); }
table.data-table.is-frozen tbody .is-frozen-edge { box-shadow: inset 0 1px 0 var(--hairline), 8px 0 8px -8px var(--frozen-edge-shadow); }
table.data-table.is-frozen tbody tr:first-child .is-frozen-edge { box-shadow: 8px 0 8px -8px var(--frozen-edge-shadow); }
table.data-table.is-frozen thead .is-frozen-edge { box-shadow: 8px 0 8px -8px var(--frozen-edge-shadow); }
table.data-table.is-frozen tbody tr:hover > td { background: var(--surface-row-hover); }
table.data-table td.col-gutter, table.data-table th.col-gutter { width: 1%; padding: 6px 4px 6px 10px; }
.row-add {
  width: 22px; height: 22px; border-radius: var(--radius-round); border: none; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-raised); color: var(--text-tertiary); box-shadow: var(--shadow-control);
  opacity: 0; transition: opacity 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.row-add svg { width: 12px; height: 12px; }
tr:hover .row-add, .row-add:focus-visible, .row-add.is-open { opacity: 1; }
.row-add:hover, .row-add.is-open { color: var(--text-accent); box-shadow: var(--shadow-control-hover); }
table.data-table tr.is-separator > td, table.data-table.is-frozen tr.is-separator > td.is-frozen-col { background: var(--surface-well); padding-top: 7px; padding-bottom: 7px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.table-scrollbar-top { overflow-x: auto; overflow-y: hidden; height: 14px; margin-bottom: 4px; }
.table-scrollbar-top > div { height: 1px; }
.action-menu {
  position: fixed; z-index: 80; min-width: 210px; display: flex; flex-direction: column; gap: 2px;
  padding: 6px; border-radius: var(--radius-card-compact); background: var(--surface-menu); box-shadow: var(--shadow-overlay);
}
.action-menu .dropdown-option { border: none; background: none; text-align: left; font: inherit; font-size: 0.82rem; color: var(--text-primary); cursor: pointer; width: 100%; }

/* ---------- Glisser-déposer ----------
   Ajouté pour Balance Suite : une ligne (ou une carte) qu'on glisse, une carte qui la reçoit.
   .is-draggable       élément déplaçable (curseur main) ; .is-dragging pendant le glisser (atténué)
   .drop-target        carte qui accepte un dépôt ; .is-drop-over quand l'élément glissé la survole
                       (anneau 2 px + fond bleuté — jamais de bordure pointillée, le kit n'a pas de bordures). */
.is-draggable { cursor: grab; }
.is-draggable:active { cursor: grabbing; }
.is-dragging { opacity: 0.45; }
.drop-target { transition: box-shadow 0.15s ease, background 0.15s ease; }
.drop-target.is-drop-over { background: var(--surface-drop-over); box-shadow: 0 0 0 2px var(--focus-ring); }

/* ---------- Progression, barres, graphiques ---------- */
.progress { height: 7px; border-radius: var(--radius-pill); background: var(--surface-track); box-shadow: var(--shadow-inset); overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: var(--progress-fill); border-radius: inherit; }
.progress.ok > i { background: var(--progress-fill-ok); }
.progress.warn > i { background: var(--progress-fill-warn); }
.progress.danger > i { background: var(--progress-fill-danger); }

.chart-frame { background: var(--surface-well); box-shadow: var(--shadow-inset); border-radius: var(--radius-card-compact); padding: 14px 16px; }
.trendchart { width: 100%; height: auto; display: block; }
.trendchart .grid-line { stroke: var(--chart-grid-line); stroke-width: 1; }
.trendchart .axis-label { font-size: 9px; fill: var(--text-tertiary); font-family: var(--font-body); }
.trendchart .line-path { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.trendchart .area-path { fill: url(#trendFill); opacity: 0.35; }
.trendchart .pt { fill: var(--surface-raised); stroke: var(--accent); stroke-width: 2; }
.trendchart .pt-label { font-size: 10px; fill: var(--text-secondary); font-weight: 600; }
.trendchart .target-line { stroke: var(--text-tertiary); stroke-width: 1.2; stroke-dasharray: 3 4; }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 140px; }
.bars.bars-compact { height: 96px; justify-content: flex-start; }
.bars.bars-compact .bar-col { max-width: 92px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; border-radius: 7px 7px 3px 3px; position: relative; min-height: 3px; }
.bars .bar-value { font-size: 0.66rem; font-weight: 700; color: var(--text-secondary); }
.bars .bar-label { font-size: 0.64rem; color: var(--text-tertiary); text-align: center; line-height: 1.2; min-height: 2.4em; display: flex; align-items: flex-start; justify-content: center; }

.dim-bars { display: flex; flex-direction: column; gap: 10px; }
.dim-bar-row { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; }
.dim-bar-row .dbr-label { font-size: 0.78rem; color: var(--text-secondary); }
.dim-bar-row .dbr-track { height: 9px; border-radius: var(--radius-pill); background: var(--surface-track); box-shadow: var(--shadow-inset); overflow: hidden; position: relative; }
.dim-bar-row .dbr-fill { display: block; height: 100%; border-radius: inherit; }
.dim-bar-row .dbr-val { font-size: 0.76rem; font-weight: 700; text-align: right; }
.dim-bar-row .dbr-track .dbr-target-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-tertiary); opacity: 0.6; }
@media (max-width: 560px) { .dim-bar-row { grid-template-columns: 96px 1fr 34px; } }

.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin: 6px 0 10px; }
.chart-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-secondary); }
.chart-legend .legend-item i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.chart-legend.is-start { justify-content: flex-start; margin: 10px 0 0; }

/* ---------- Anneau (donut / camembert) ---------- */
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.donutchart { width: 100%; max-width: 200px; height: auto; display: block; flex-shrink: 0; margin: 0 auto; }
.donutchart .donut-track { fill: none; stroke: var(--chart-grid-line); stroke-width: 11; }
.donutchart .donut-seg { fill: none; stroke-width: 11; stroke-linecap: butt; transform: rotate(-90deg); transform-origin: 50% 50%; }
.donutchart .donut-total { font-size: 18px; font-weight: 700; fill: var(--text-primary); font-family: var(--font-body); }
.donutchart .donut-caption { font-size: 10px; fill: var(--text-tertiary); font-family: var(--font-body); }
.donutchart .donut-seg.is-progress { stroke-linecap: round; }

/* ---------- Radar (profil multi-dimensions) ---------- */
.radarchart { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto; overflow: visible; color: var(--accent); }
.radarchart .radar-ring { fill: none; stroke: var(--chart-grid-line); stroke-width: 1; }
.radarchart .radar-spoke { stroke: var(--chart-grid-line); stroke-width: 1; }
.radarchart .radar-area { fill: currentColor; fill-opacity: 0.18; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.radarchart .radar-target { fill: none; stroke: var(--text-tertiary); stroke-width: 1.3; stroke-dasharray: 3 4; stroke-linejoin: round; }
.radarchart .radar-pt { fill: var(--surface-raised); stroke: currentColor; stroke-width: 2; }
.radarchart .radar-label { font-size: 10px; fill: var(--text-secondary); font-family: var(--font-body); font-weight: 600; }
.radarchart .radar-area.is-secondary { fill: var(--chart-2); fill-opacity: 0.16; stroke: var(--chart-2); stroke-width: 2; stroke-linejoin: round; }
.radarchart .radar-pt.is-secondary { stroke: var(--chart-2); }

/* ---------- Barres horizontales (classement) ---------- */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; }
.hbar-row .hbar-label { font-size: 0.78rem; color: var(--text-secondary); text-align: right; }
.hbar-row .hbar-track { height: 16px; border-radius: 5px; background: var(--surface-well); box-shadow: var(--shadow-inset); overflow: hidden; }
.hbar-row .hbar-fill { display: block; height: 100%; border-radius: 5px 0 0 5px; }
.hbar-row .hbar-val { font-size: 0.76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .hbar-row { grid-template-columns: 88px 1fr 34px; } }

/* Variante divergente : positif/négatif depuis un axe zéro central (couleurs de statut, pas de série) */
.hbars.is-diverging .hbar-track { position: relative; overflow: visible; }
.hbars.is-diverging .hbar-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--chart-grid-line); }
.hbars.is-diverging .hbar-fill { position: absolute; top: 0; height: 100%; border-radius: 0; }
.hbars.is-diverging .hbar-fill.is-pos { left: 50%; border-radius: 0 5px 5px 0; }
.hbars.is-diverging .hbar-fill.is-neg { right: 50%; border-radius: 5px 0 0 5px; }
.hbars.is-diverging .hbar-val.is-pos { color: var(--score-ok-fg); }
.hbars.is-diverging .hbar-val.is-neg { color: var(--score-danger-fg); }

/* ---------- Barres groupées (comparaison de séries) ---------- */
.bars.is-grouped .bar-col { gap: 6px; }
.bar-cluster { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 100%; }
.bar-cluster .bar { flex: 1; min-width: 0; }

/* ---------- Barres empilées (composition à 100 %) ---------- */
.stackedbar { display: flex; flex-direction: column; gap: 12px; }
.stackedbar-row { display: flex; flex-direction: column; gap: 6px; }
.stackedbar-row .sb-label { font-size: 0.78rem; color: var(--text-secondary); }
.stackedbar-track { display: flex; height: 20px; border-radius: 6px; overflow: hidden; background: var(--surface-well); box-shadow: var(--shadow-inset); }
.stackedbar-track .sb-seg { height: 100%; }

/* ---------- Jauge (indicateur vs objectif) ---------- */
.gaugechart { width: 100%; max-width: 210px; height: auto; display: block; margin: 0 auto; }
.gaugechart .gauge-track { fill: none; stroke: var(--chart-grid-line); stroke-width: 13; stroke-linecap: round; }
.gaugechart .gauge-fill { fill: none; stroke: var(--accent); stroke-width: 13; stroke-linecap: round; }
.gaugechart .gauge-target { stroke: var(--text-tertiary); stroke-width: 2.4; }
.gaugechart .gauge-value { font-size: 18px; font-weight: 700; fill: var(--text-primary); font-family: var(--font-body); }
.gaugechart .gauge-caption { font-size: 10px; fill: var(--text-tertiary); font-family: var(--font-body); }
.gaugechart .gauge-bound { font-size: 9px; fill: var(--text-tertiary); font-family: var(--font-body); }
.gaugechart.is-compact { max-width: 126px; }
.gaugechart.is-compact .gauge-track, .gaugechart.is-compact .gauge-fill { stroke-width: 7.8; }
.gauge-row { display: flex; gap: 8px; justify-content: space-around; flex-wrap: wrap; }
.gaugechart .gauge-fill.is-ok { stroke: var(--status-ok); }
.gaugechart .gauge-fill.is-warn { stroke: var(--status-warn); }
.gaugechart .gauge-fill.is-danger { stroke: var(--status-danger); }

/* ---------- Nuage de points (corrélation) ---------- */
.scatterchart { width: 100%; height: auto; display: block; }
.scatterchart .grid-line { stroke: var(--chart-grid-line); stroke-width: 1; }
.scatterchart .axis-label { font-size: 9px; fill: var(--text-tertiary); font-family: var(--font-body); }
.scatterchart .axis-title { font-size: 10px; fill: var(--text-tertiary); font-family: var(--font-body); font-weight: 600; }
.scatterchart .scatter-pt { fill: var(--chart-2); fill-opacity: 0.72; stroke: var(--surface-raised); stroke-width: 1; }
.scatterchart .scatter-pt.is-highlight { fill: var(--accent); fill-opacity: 1; stroke-width: 1.5; }
.scatterchart .quadrant-line { stroke: var(--chart-grid-line); stroke-width: 1; stroke-dasharray: 3 4; }
.scatterchart .quadrant-label { font-size: 9px; fill: var(--text-tertiary); font-family: var(--font-body); font-style: italic; }

/* ---------- Mini-courbe embarquée (sparkline) ---------- */
.sparkline { width: 100%; max-width: 160px; height: 32px; display: block; }
.sparkline .spark-path { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sparkline .spark-pt { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* Objectif sous la mini-courbe : même pointillé que .trendchart .target-line. */
.sparkline .spark-target { fill: none; stroke: var(--text-tertiary); stroke-width: 1.2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }

/* ---------- Heatmap (matrice colorée) ---------- */
table.heatmap { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: 0.78rem; }
table.heatmap th { font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); padding: 4px 6px; text-align: center; }
table.heatmap th.hm-rowhead { text-align: right; font-weight: 600; text-transform: none; letter-spacing: normal; font-size: 0.78rem; color: var(--text-secondary); padding-right: 10px; }
table.heatmap td.hm-cell {
  text-align: center; padding: 10px 6px; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-primary); min-width: 46px;
  box-shadow: 0 1px 3px rgba(22, 35, 47, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
table.heatmap td.hm-1 { background: color-mix(in oklab, var(--accent) 14%, var(--surface-well)); }
table.heatmap td.hm-2 { background: color-mix(in oklab, var(--accent) 36%, var(--surface-well)); }
table.heatmap td.hm-3 { background: color-mix(in oklab, var(--accent) 60%, var(--surface-well)); color: var(--text-on-dark); }
table.heatmap td.hm-4 { background: color-mix(in oklab, var(--accent) 84%, var(--surface-well)); color: var(--text-on-dark); }
table.heatmap td.hm-ok { background: color-mix(in oklab, var(--progress-fill-ok) 42%, transparent); }
table.heatmap td.hm-warn { background: color-mix(in oklab, var(--progress-fill-warn) 48%, transparent); }
table.heatmap td.hm-danger { background: color-mix(in oklab, var(--progress-fill-danger) 32%, transparent); }

/* ---------- Info-bulle et survol des graphiques ----------
   Comportement : theme.js §7 (attribut data-tip). Ici : l'apparence de l'info-bulle et l'effet de survol
   de chaque type de graphique. Blanc en relief = ce qui flotte (règle du kit). */
.chart-tooltip {
  position: fixed; left: 0; top: 0; z-index: 110; pointer-events: none;
  min-width: 132px; max-width: 280px; padding: 9px 13px 10px;
  border-radius: var(--radius-card-compact); background: var(--surface-raised); box-shadow: var(--shadow-overlay);
  font-size: 0.76rem; color: var(--text-secondary);
  opacity: 0; transform: translateY(5px); transition: opacity 0.12s ease, transform 0.16s var(--ease-soft);
}
.chart-tooltip.is-visible { opacity: 1; transform: none; }
.chart-tooltip .ct-title { display: block; margin-bottom: 5px; font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.chart-tooltip .ct-row { display: flex; align-items: center; gap: 8px; line-height: 1.65; }
.chart-tooltip .ct-swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.chart-tooltip .ct-value { margin-left: auto; padding-left: 16px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Barres : la colonne / la ligne survolée ressort, les autres s'estompent */
.bars .bar, .hbar-row .hbar-fill, .dim-bar-row .dbr-fill, .stackedbar-track .sb-seg { transition: filter 0.15s ease, opacity 0.15s ease, transform 0.18s var(--ease-soft); }
.bars .bar { transform-origin: bottom; }
.hbar-row, .dim-bar-row { transition: opacity 0.15s ease; }
.bars .bar-col[data-tip]:hover .bar { filter: brightness(1.08) saturate(1.12); transform: scaleY(1.04); }
.bars:has(.bar-col[data-tip]:hover) .bar-col:not(:hover) .bar { opacity: 0.5; }
.hbar-row[data-tip]:hover .hbar-fill, .dim-bar-row[data-tip]:hover .dbr-fill { filter: brightness(1.08) saturate(1.12); }
.hbars:has(.hbar-row[data-tip]:hover) .hbar-row:not(:hover),
.dim-bars:has(.dim-bar-row[data-tip]:hover) .dim-bar-row:not(:hover) { opacity: 0.5; }
.stackedbar-track .sb-seg[data-tip]:hover { filter: brightness(1.1) saturate(1.12); }
.stackedbar-track:has(.sb-seg[data-tip]:hover) .sb-seg:not(:hover) { opacity: 0.5; }

/* Anneau : le segment survolé s'épaissit, les autres s'estompent */
.donutchart .donut-seg { transition: stroke-width 0.18s var(--ease-soft), opacity 0.18s ease; }
.donutchart .donut-seg[data-tip]:hover { stroke-width: 15; }
.donutchart:has(.donut-seg[data-tip]:hover) .donut-seg:not(:hover) { opacity: 0.5; }

/* Jauge */
.gaugechart .gauge-fill { transition: stroke-width 0.18s var(--ease-soft); }
.gaugechart .gauge-fill[data-tip]:hover { stroke-width: 16; }
.gaugechart.is-compact .gauge-fill[data-tip]:hover { stroke-width: 10; }

/* Radar : l'aire survolée s'intensifie, le sommet survolé grossit */
.radarchart .radar-area { transition: fill-opacity 0.18s ease; }
.radarchart .radar-area[data-tip]:hover { fill-opacity: 0.34; }
.radarchart .radar-pt { transition: r 0.15s var(--ease-soft); }
.radarchart .radar-pt[data-tip]:hover { r: 5; }

/* Nuage de points */
.scatterchart .scatter-pt { transition: r 0.15s var(--ease-soft), fill-opacity 0.15s ease; }
.scatterchart .scatter-pt[data-tip]:hover { r: 7; fill-opacity: 1; }

/* Courbe : repère vertical + points de la série et de l'objectif au survol d'une échéance */
.trendchart .tc-hit { fill: transparent; }
.trendchart .tc-cross { stroke: var(--text-tertiary); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0; transition: opacity 0.15s ease; }
.trendchart .tc-tgt { fill: var(--surface-raised); stroke: var(--text-tertiary); stroke-width: 2; opacity: 0; transition: opacity 0.15s ease; }
.trendchart .tc-mark .pt { transition: r 0.15s var(--ease-soft); }
.trendchart .tc-mark:hover .tc-cross, .trendchart .tc-mark:hover .tc-tgt { opacity: 1; }
.trendchart .tc-mark:hover .pt { r: 5; }

/* Mini-courbe : point d'échéance au survol */
.sparkline .spark-hit { fill: transparent; }
.sparkline .spark-hover-pt { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity 0.12s ease; }
.sparkline .spark-mark:hover .spark-hover-pt { opacity: 1; }

/* Heatmap : la cellule survolée se soulève */
table.heatmap td.hm-cell { transition: transform 0.15s var(--ease-soft), filter 0.15s ease, box-shadow 0.15s ease; }
table.heatmap td.hm-cell[data-tip]:hover {
  transform: scale(1.07); filter: brightness(1.04); position: relative; z-index: 1;
  box-shadow: 0 4px 10px rgba(22, 35, 47, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* ---------- Canevas de flux (postes reliés par des flèches) ----------
   Ajouté pour le cockpit de pilotage (Demo_Cockpit) : absent du modèle QVCT.
   Rôles : le canevas est une zone à LIRE (creusée, comme un graphique) ; un poste
   se déplace et s'ouvre (blanc en relief, comme une puce) ; une bulle de nom vide
   est une zone à SAISIR (creusée). Structure :
     .flow-canvas            zone creusée, trame pointillée ; déplacer le fond = se déplacer
       .flow-world           couche transformée (translate + scale) posée par le script
         svg.flow-links      .flow-link-hit (zone de clic large) + .flow-link (trait visible)
         .flow-link-remove   « × » au milieu d'une flèche
         .flow-link-label    bulle de nom (.is-empty = « + Nom »)
         .flow-node          poste (position absolue left/top posée par le script)
       .flow-hint            consigne flottante (mode « relier »)
       .flow-zoom            boutons .btn.btn-icon empilés en bas à droite
   Les positions (left, top, width, height, transform) sont des VALEURS DE DONNÉES
   posées en ligne par le script ; aucune couleur, ombre ou arrondi en ligne. */
.flow-canvas {
  position: relative; overflow: hidden; border-radius: var(--radius-card);
  height: clamp(320px, calc(100vh - 230px), 860px);
  background-color: var(--surface-well); box-shadow: var(--shadow-inset);
  background-image: radial-gradient(circle, var(--flow-grid-dot) 1px, transparent 1.4px);
  background-size: 20px 20px;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.flow-canvas.is-panning { cursor: grabbing; }
.flow-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.flow-node {
  position: absolute; display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px 8px; border-radius: var(--radius-card-compact);
  background: var(--surface-raised); box-shadow: var(--shadow-control); color: var(--text-primary);
  cursor: grab; transition: box-shadow 0.15s ease;
}
.flow-node:hover { box-shadow: var(--shadow-control-hover); }
.flow-node.is-dragging { cursor: grabbing; box-shadow: var(--shadow-overlay); z-index: 3; }
.flow-node.is-linking { box-shadow: var(--shadow-control), 0 0 0 2px var(--focus-ring); }
.flow-node:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.flow-node-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.flow-node-title { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-node-head .badge { flex-shrink: 0; }
.flow-node-value { display: flex; align-items: baseline; gap: 5px; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.flow-node-value small { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
.flow-node-value .is-missing { color: var(--text-tertiary); }
.flow-node .sparkline { height: 28px; }
/* Poignée « relier » : pastille ronde à cheval sur le bord droit du poste. */
.flow-node-port {
  position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: var(--radius-round); border: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--btn-secondary-bg); color: var(--btn-secondary-fg); box-shadow: var(--shadow-control);
  transition: box-shadow 0.15s ease, background 0.15s ease;
}
.flow-node-port svg { width: 13px; height: 13px; }
.flow-node-port:hover { box-shadow: var(--shadow-control-hover); background: var(--btn-secondary-bg-hover); }
.flow-node.is-linking .flow-node-port { background: var(--accent); color: var(--text-on-accent); }

.flow-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.flow-link { fill: none; stroke: var(--flow-link); stroke-width: 2; stroke-linecap: round; pointer-events: none; transition: stroke 0.15s ease; }
.flow-link-head { fill: var(--flow-link); }
.flow-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.flow-link-hit:hover + .flow-link { stroke: var(--flow-link-hover); }
.flow-link-leader { stroke: var(--flow-link-leader); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }

.flow-link-remove {
  position: absolute; transform: translate(-50%, -50%);
  width: 20px; height: 20px; border-radius: var(--radius-round); border: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--surface-raised); color: var(--text-tertiary); box-shadow: var(--shadow-control);
  transition: color 0.15s ease, box-shadow 0.15s ease;
}
.flow-link-remove svg { width: 10px; height: 10px; }
.flow-link-remove:hover { color: var(--status-danger); box-shadow: var(--shadow-control-hover); }

.flow-link-label {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; cursor: grab;
  font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--surface-raised); color: var(--text-secondary); box-shadow: var(--shadow-control);
}
.flow-link-label.is-empty { background: var(--surface-control); color: var(--text-tertiary); box-shadow: var(--shadow-inset); font-weight: 500; }
.flow-link-label:hover { box-shadow: var(--shadow-control-hover); }
.flow-link-label.is-empty:hover { color: var(--text-accent); box-shadow: var(--shadow-inset); }

.flow-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: calc(100% - 24px);
  font-size: 0.78rem; padding: 7px 14px; border-radius: var(--radius-pill);
  background: var(--surface-popover); color: var(--text-primary); box-shadow: var(--shadow-overlay);
}
.flow-zoom { position: absolute; right: 12px; bottom: 12px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }

/* Entrée animée (premier affichage) : postes qui montent, flèches qui se tracent. */
.flow-world.is-entering .flow-node { animation: flow-node-in 0.5s var(--ease-soft) both; animation-delay: calc(var(--enter-i, 0) * 90ms); }
.flow-world.is-entering .flow-link { stroke-dasharray: 1; stroke-dashoffset: 1; animation: flow-link-in 0.6s ease forwards; animation-delay: calc(0.35s + var(--enter-i, 0) * 110ms); }
@keyframes flow-node-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes flow-link-in { to { stroke-dashoffset: 0; } }

/* ---------- Écran de connexion ----------
   Ajouté pour Balance Suite : page d'entrée avant la coque (choix du rôle, mot de passe éventuel).
   .signin-screen > .signin-card   carte blanche en relief centrée sur la page
     .signin-brand / h1 / .text-intro
     .signin-roles > button.signin-role   un rôle = une ligne cliquable (avatar + nom + description + chevron) ;
                                          un champ .field et un .btn-primary peuvent suivre pour un mot de passe. */
.signin-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--surface-page); }
.signin-card { width: min(460px, 100%); background: var(--surface-raised); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); padding: 28px 26px 24px; }
.signin-brand { display: block; font-size: 0.94rem; font-weight: 600; color: var(--text-brand); margin-bottom: 14px; }
.signin-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.signin-roles { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.signin-role {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: none; cursor: pointer;
  padding: 12px 14px; border-radius: var(--radius-card-compact); background: var(--surface-card); color: var(--text-primary);
  font: inherit; transition: box-shadow 0.15s ease, background 0.15s ease;
}
.signin-role:hover { background: var(--surface-raised); box-shadow: var(--shadow-control-hover); }
.signin-role > span:not(.avatar) { flex: 1; min-width: 0; }
.signin-role b { display: block; font-size: 0.9rem; font-weight: 600; }
.signin-role small { display: block; font-size: 0.76rem; color: var(--text-secondary); line-height: 1.4; }
.signin-role > svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }

/* ---------- Écran de démarrage et de chargement ----------
   Ajouté pour le hub Tauri (2026-09-24) : ce que montre une appli pendant qu'elle se prépare.
   .splash-screen                  plein écran blanc, contenu centré, au-dessus de tout (z-index 100)
     .splash-video                 vidéo d'ouverture (une seule fois, au lancement) — sans contrôles
     .splash-logo > img            logo de l'appli (écran de chargement court, ou repli si la vidéo manque)
     .splash-label                 libellé discret sous le logo (« Retour au hub… »)
     .progress.splash-progress > i barre qui se remplit en --splash-duration (1 s par défaut)
     .btn.btn-tertiary.splash-skip « Passer » en bas à droite (vidéo seulement)
   .splash-screen.is-leaving       fondu de sortie (0,3 s), puis le script le retire.
   img.splash-flyer                copie du logo qui vole entre le logo en haut à gauche d'une vue et le logo de
                                   l'écran de chargement (position/échelle animées par le script) ; .is-in-flight
                                   masque l'original pendant le vol. */
.splash-screen {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px 16px; background: var(--surface-page); transition: opacity 0.3s ease;
}
.splash-screen.is-leaving { opacity: 0; pointer-events: none; }
.splash-video { display: block; width: min(720px, 100%); max-height: 70vh; object-fit: contain; border-radius: var(--radius-panel); }
.splash-logo { display: flex; align-items: center; justify-content: center; animation: splash-logo-in 0.45s var(--ease-soft) both; }
.splash-logo img { display: block; height: 72px; width: auto; }
.splash-label { font-size: 0.8rem; color: var(--text-tertiary); }
.progress.splash-progress { width: min(220px, 60vw); }
.splash-progress > i { width: 0; animation: splash-fill var(--splash-duration, 1s) var(--ease-soft) forwards; }
.splash-skip { position: absolute; right: 20px; bottom: 20px; }
.splash-flyer { position: fixed; left: 0; top: 0; z-index: 101; display: block; width: 100px; height: 100px; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.is-in-flight { visibility: hidden; }
@keyframes splash-logo-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes splash-fill { to { width: 100%; } }
/* Écran de chargement ouvert par-dessus une vue (passage d'un outil à l'autre, retour au hub) : entrée en fondu 0,18 s. */
.splash-screen.is-transition { animation: fade var(--fade-white) ease both; }

/* ---------- Animation « constellation » : lancement et écran de chargement ----------
   Ajoutée pour Centauri (2026-09-25). Lancement : 2 s, une fois. Chargement (.is-transition) : même scène,
   plus rapide, entre deux vues ; le centaure et l'étoile y arrivent en vol (.splash-flyer) puis restent fixes.
   .splash-screen.is-launch                 même écran blanc, sans marge : la scène est centrée
     svg.splash-stage (viewBox 0 23 1200 470) repère de l'OG image, cadré sur le logo et la constellation (sans le
                                            slogan), largeur --brand-stage-w (pas toute la fenêtre)
       line.cst-line[pathLength="1"]        trait qui se dessine (--cst-delay, --cst-dur : valeurs de temps posées par le script)
       circle.cst-dot / .cst-dot.is-soft    point qui apparaît (gros point gris / petit point clair)
       image.cst-centaur                    calque centaure : fondu + légère montée
       image.cst-name + clipPath rect.cst-wipe  nom dévoilé de gauche à droite
       image.cst-star                       étoile : scintille (rotation + rebond)
       .cst-centaur.is-static / .cst-star.is-static  sans entrée propre (arrivés en vol)
     .splash-caption > .splash-label        légende sous la scène (destination, nom et version)
   .splash-screen.is-waiting                scène invisible et figée pendant le fondu au blanc d'entrée (--fade-white)
   .splash-screen.is-clearing               fondu au blanc de la scène (0,3 s) avant que l'écran ne s'efface
   Tout passage se fait par le blanc : vue quittée → blanc → scène → blanc → vue d'arrivée. */
.splash-screen.is-launch { padding: 0; gap: 0; transition-duration: var(--fade-white); }
.splash-stage { position: absolute; inset: 0; margin: auto; width: var(--brand-stage-w); height: calc(var(--brand-stage-w) * 470 / 1200); display: block; transition: opacity 0.3s ease; }
.splash-screen.is-clearing .splash-stage, .splash-screen.is-clearing .splash-caption { opacity: 0; }
.splash-screen.is-waiting .splash-stage, .splash-screen.is-waiting .splash-caption { opacity: 0; transition: none; }
.splash-screen.is-waiting .splash-stage * { animation-play-state: paused; }
.splash-caption { position: absolute; left: 16px; right: 16px; bottom: max(24px, calc(50vh - var(--brand-stage-w) * 235 / 1200 - 72px)); display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; transition: opacity 0.3s ease; }
.cst-line {
  fill: none; stroke: var(--constellation-line); stroke-width: 2; stroke-dasharray: 1 1; stroke-dashoffset: 1;
  animation: cst-draw var(--cst-dur, 0.14s) linear var(--cst-delay, 0s) forwards;
}
.cst-dot {
  fill: var(--constellation-dot); transform-box: fill-box; transform-origin: center; transform: scale(0);
  animation: cst-pop 0.32s var(--ease-soft) var(--cst-delay, 0s) forwards;
}
.cst-dot.is-soft { fill: var(--constellation-line); }
.cst-centaur { opacity: 0; transform-box: view-box; transform-origin: 215px 450px; animation: cst-rise 0.65s var(--ease-soft) forwards; }
.cst-name { opacity: 0; animation: fade 0.4s ease 0.16s forwards; }
.cst-wipe { transform-box: fill-box; transform-origin: left center; transform: scaleX(0); animation: cst-wipe 0.82s var(--ease-soft) 0.16s forwards; }
.cst-star { opacity: 0; transform-box: view-box; transform-origin: 415px 127px; animation: cst-twinkle 0.6s var(--ease-soft) 1.35s forwards; }
.cst-centaur.is-static, .cst-star.is-static { opacity: 1; animation: none; }
@keyframes cst-draw { to { stroke-dashoffset: 0; } }
@keyframes cst-pop { 0% { transform: scale(0); } 65% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes cst-rise { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes cst-wipe { to { transform: scaleX(1); } }
@keyframes cst-twinkle {
  0% { opacity: 0; transform: scale(0.2) rotate(-120deg); }
  60% { opacity: 1; transform: scale(1.35) rotate(10deg); }
  100% { opacity: 1; transform: none; }
}

/* ---------- Hub d'application (accueil plein écran) ----------
   Ajouté pour Centauri (2026-09-25) : page d'accueil d'une appli de bureau qui regroupe ses outils.
   .hub-screen                   pleine fenêtre, sans barre latérale ; .is-arriving = état juste après le lancement
     img.app-backdrop            photo de fond, toute la fenêtre (cover), telle quelle (aucun voile) ; elle est déjà
                                 en place sous l'écran de chargement, qui s'efface au blanc pour la découvrir
     header.hub-head             .hub-brand (logo + .brand-text) à gauche ; à droite .hub-head-end :
                                 .hub-client (logo + nom du client, habillage) puis .hub-user (avatar + nom)
     main.hub-main               .hub-date, h1.hub-greeting (> .hub-greeting-name), .text-intro, .grid.hub-tools
       .card.action-card.hub-tool  un outil : .hub-tool-icon + .action-top + h3 + .text-intro + bouton
     footer.site-footer          nom et version de l'appli */
.hub-screen { position: relative; isolation: isolate; min-height: 100vh; display: flex; flex-direction: column; gap: var(--gutter); padding: var(--gutter); }
.app-backdrop {
  position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
}
.hub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 6px; }
.hub-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hub-brand > img { display: block; width: 40px; height: 40px; flex-shrink: 0; }
.hub-user, .hub-client {
  display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; min-width: 0;
  background: var(--surface-raised); border-radius: var(--radius-pill); box-shadow: var(--shadow-control);
}
.hub-user .avatar { width: 34px; height: 34px; font-size: 0.72rem; }
.hub-user b, .hub-client b { display: block; font-size: 0.82rem; font-weight: 600; }
.hub-user small, .hub-client small { display: block; font-size: 0.68rem; color: var(--text-tertiary); }
.hub-client { padding-left: 10px; }
.hub-client > img { display: block; height: 34px; width: auto; max-width: 120px; object-fit: contain; }
.hub-head-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.hub-main { flex: 1; width: min(980px, 100%); margin: 0 auto; display: flex; flex-direction: column; justify-content: center; padding: 28px 0; }
.hub-date { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); margin: 0 0 6px; }
h1.hub-greeting { font-size: clamp(2rem, 3.6vw, 2.75rem); font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.hub-greeting-name { color: var(--text-brand); }
.hub-tools { margin-top: 26px; }
.hub-tool-icon {
  width: 42px; height: 42px; border-radius: var(--radius-button); display: flex; align-items: center; justify-content: center;
  background: var(--surface-well); box-shadow: var(--shadow-inset); color: var(--text-accent);
}
.hub-tool-icon svg { width: 22px; height: 22px; }
.hub-head, .hub-main, .hub-screen > .site-footer { transition: opacity 0.5s var(--ease-soft) 0.3s, transform 0.5s var(--ease-soft) 0.3s; }
.hub-main { transition-delay: 0.42s; }
.hub-screen.is-arriving .hub-head,
.hub-screen.is-arriving .hub-main,
.hub-screen.is-arriving > .site-footer { opacity: 0; transform: translateY(12px); transition: none; }
@media (max-width: 700px) { .hub-user small, .hub-client small { display: none; } }

/* ---------- Tiroir latéral et fenêtre modale ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 70; background: var(--surface-scrim);
  display: flex; justify-content: flex-end; animation: fade 0.15s ease;
}
.drawer-overlay.is-centered { justify-content: center; align-items: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  width: 100%; max-width: 560px; height: 100vh; overflow-y: auto;
  background: var(--surface-drawer); box-shadow: var(--shadow-drawer);
  animation: slidein 0.22s var(--ease-soft); padding: 22px 22px 40px;
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer:focus { outline: none; }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  position: sticky; top: -22px; z-index: 2; margin: -22px -22px 16px; padding: 22px 22px 12px;
  background: linear-gradient(var(--surface-drawer) 76%, transparent);
}
body.drawer-open { overflow: hidden; }
.drawer-head h2 { margin-bottom: 4px; }
.drawer-head p { font-size: 0.8rem; color: var(--text-secondary); }
.drawer-close { flex-shrink: 0; }
.drawer-section { margin-top: 18px; }
.drawer-section:first-of-type { margin-top: 0; }
/* Fenêtre modale centrée : mêmes classes .drawer*, recadrées. */
.drawer.is-modal {
  max-width: 640px; height: auto; max-height: 90vh; border-radius: var(--radius-panel);
  animation: fade 0.18s ease; padding-bottom: 22px; overflow-x: hidden;
}
.drawer.is-modal .drawer-head { border-radius: var(--radius-panel) var(--radius-panel) 0 0; margin-bottom: 10px; padding-bottom: 8px; }
.drawer.is-modal .drawer-head p { margin-top: 2px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: 420px; padding: 13px 20px; border-radius: var(--radius-toast);
  background: var(--surface-toast); color: var(--text-on-dark); font-size: 0.83rem;
  box-shadow: var(--shadow-toast); z-index: 95;
  animation: toast-in 0.25s var(--ease-soft);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* Action dans le toast (ajout 2026-09-30, Centauri) : un seul bouton-lien après le texte, pour revenir sur ce qui
   vient d'être fait (« Élément archivé — Annuler »). Jamais une action nouvelle ni destructive. */
.toast-action {
  margin-left: 12px; padding: 3px 8px; border: none; border-radius: var(--radius-control);
  background: none; color: var(--text-toast-action); font: inherit; font-weight: 700; cursor: pointer;
}
.toast-action:hover { background: color-mix(in oklab, var(--text-on-dark) 12%, transparent); }
.toast-action:focus-visible { outline-color: var(--text-toast-action); }

/* ======================= 5. COMPOSITIONS DU MODÈLE ======================= */
/* Assemblages récurrents de la démo. Ils n'ajoutent que de la mise en page ;
   les couleurs, polices et arrondis viennent des composants ci-dessus. */

.list { display: flex; flex-direction: column; gap: 10px; }

/* Carte de témoignage */
.quote-card { display: flex; flex-direction: column; gap: 8px; }
.quote-card .quote-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quote-card .quote { font-size: 0.88rem; line-height: 1.5; color: var(--text-primary); }
.vote-count { font-size: 0.76rem; color: var(--text-tertiary); }

/* Ligne de liste séparée par un filet */
.list-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0; box-shadow: inset 0 1px 0 var(--hairline); }
.list-row:first-child { box-shadow: none; }
.list-row > div:first-child { flex: 1; min-width: 220px; }
.list-row h3 { font-size: 0.88rem; margin-bottom: 4px; }
.list-row p { font-size: 0.78rem; color: var(--text-secondary); }
.deadline-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; font-size: 0.84rem; box-shadow: inset 0 1px 0 var(--hairline); }
.deadline-row:first-child { box-shadow: none; padding-top: 2px; }
.deadline-row:last-child { padding-bottom: 2px; }

/* Constat (carte compacte avec fait / périmètre / piste) */
.insight-card { display: flex; flex-direction: column; gap: 6px; }
.insight-fact { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.insight-meta { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; }
.insight-meta b { color: var(--text-primary); }
.insight-card .btn { align-self: flex-start; margin-top: 2px; }

/* Carte d'action */
.action-card { display: flex; flex-direction: column; gap: 10px; }
.action-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.action-top .at-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.action-line { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.78rem; color: var(--text-secondary); }
.action-line b { font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.03em; margin-right: 5px; }
.action-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; margin: 4px 0; }
.action-meta-grid > div { font-size: 0.78rem; }
.action-meta-grid small { display: block; font-size: 0.66rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
@media (max-width: 700px) { .action-meta-grid { grid-template-columns: 1fr 1fr; } }

/* ======================= 6. ADAPTATIF ET MOUVEMENT RÉDUIT ======================= */

@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;
  }
  .btn-primary:hover:not(:disabled) { transform: none !important; }
}

/* Barre latérale : sous 1080px elle devient un tiroir masqué (classe .nav-open sur .app-shell). */
@media (max-width: 1080px) {
  .btn-sidebar-collapse, .btn-expand-sidebar { display: none !important; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: 296px;
    border-radius: 0 var(--radius-panel) var(--radius-panel) 0;
    transform: translateX(-100%); transition: transform 0.25s var(--ease-soft);
    box-shadow: var(--shadow-overlay); background: var(--surface-sidebar-mobile);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--surface-scrim-nav); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  .app-shell.nav-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .btn-nav-toggle { display: inline-flex; }
}
@media (max-width: 760px) {
  .app-shell { padding: 10px; gap: 10px; }
  .topbar { padding: 8px 4px; height: auto; min-height: var(--topbar-h); }
  .site-footer { padding: 12px 14px; flex-direction: column; align-items: flex-start; border-radius: var(--radius-card); }
  .drawer { max-width: 100%; }
  .action-meta-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Conversation avec l'assistant (composant ajouté pour la Suite QVCT) ----------
   Trois colonnes : historique · fil · détail de la réponse. Aucune couleur nouvelle.
   Assistant = carte standard à plat (#f4f8fb) · ce que la personne écrit = fond creusé (#e3edf5) ·
   zone de saisie = champ creusé arrondi, bouton principal rond pour envoyer (.chat-send).
   Sous 1360px le détail passe en volet sur le fil ; sous 900px l'historique aussi (boutons .chat-toggle). */
.chat {
  --chat-h: calc(100vh - 212px);
  --chat-tail: 6px;                /* coin « queue » d'une bulle, côté de celui qui parle */
  position: relative; display: grid; grid-template-columns: 252px minmax(0, 1fr) 296px; gap: var(--grid-gap);
  height: clamp(540px, var(--chat-h), 1000px); min-height: 0;
}
@media (min-width: 2000px) { .chat { --chat-h: calc((100vh - 212px) / 1.15); } }

/* Historique */
.chat-list { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 14px; background: var(--surface-card); border-radius: var(--radius-card); box-shadow: var(--shadow-flat); }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-list-head h2 { font-size: 0.95rem; margin: 0; }
.chat-list .search-input { flex: none; max-width: none; width: 100%; }
.chat-list-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; margin: 0 -6px; padding: 0 6px; }
.chat-list-group { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); padding: 10px 8px 4px; }
.chat-list-group:first-child { padding-top: 2px; }
.chat-conv-row { position: relative; }
.chat-conv {
  display: flex; flex-direction: column; gap: 2px; width: 100%; min-width: 0; text-align: left; padding: 9px 12px;
  border: none; border-radius: var(--radius-nav-item); background: none; cursor: pointer; font: inherit; color: var(--text-primary);
  transition: background 0.15s ease, box-shadow 0.3s var(--ease-soft);
}
.chat-conv:hover { background: var(--surface-nav-hover); box-shadow: var(--shadow-control); }
.chat-conv.is-active { background: var(--surface-nav-active); box-shadow: var(--shadow-inset); }
.chat-conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.chat-conv-title { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conv.is-active .chat-conv-title { color: var(--text-accent); }
.chat-conv-date { font-size: 0.66rem; color: var(--text-tertiary); flex-shrink: 0; }
.chat-conv-snippet { font-size: 0.74rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conv-del {
  position: absolute; top: 8px; right: 8px; display: none; align-items: center; justify-content: center; gap: 4px; height: 24px; min-width: 24px; padding: 0 6px;
  border: none; border-radius: var(--radius-button-icon-sm); background: var(--btn-icon-bg); box-shadow: var(--shadow-control);
  font: inherit; font-size: 0.68rem; font-weight: 700; color: var(--text-secondary); cursor: pointer;
}
.chat-conv-del svg { width: 12px; height: 12px; }
.chat-conv-row:hover .chat-conv-del, .chat-conv-row:focus-within .chat-conv-del { display: inline-flex; }
.chat-conv-del.is-confirm { display: inline-flex; background: var(--badge-danger-bg); color: var(--badge-danger-fg); box-shadow: none; }
.chat-list-empty { padding: 10px 8px; font-size: 0.78rem; color: var(--text-tertiary); }

/* Colonne du fil */
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 2px 4px 14px; flex-shrink: 0; }
.chat-head-text { flex: 1; min-width: 0; line-height: 1.25; }
.chat-head-text b { display: block; font-size: 0.95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-tertiary); }
.chat-status::before { content: ''; width: 8px; height: 8px; border-radius: var(--radius-round); background: var(--status-ok); box-shadow: 0 0 0 3px var(--status-ok-soft); }
.chat-status.is-busy::before { background: var(--status-warn); box-shadow: 0 0 0 3px var(--status-warn-soft); animation: chat-pulse 1.4s ease-in-out infinite; }
.chat-status.is-off::before { background: var(--text-tertiary); box-shadow: none; }
.chat-toggle { display: none; }
.chat-toggle.is-on { background: var(--accent-soft); color: var(--text-accent); }

.chat-avatar { width: 34px; height: 34px; }
.chat-avatar svg { width: 17px; height: 17px; }
.chat-msg .avatar { width: 32px; height: 32px; }
.chat-msg .avatar svg { width: 16px; height: 16px; }

.chat-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 6px 6px 22px; scroll-behavior: smooth; }
.chat-msg { display: flex; align-items: flex-start; gap: 10px; }
.chat-msg.is-user { flex-direction: row-reverse; }
.chat-msg-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; max-width: min(660px, 84%); }
.chat-msg.is-user .chat-msg-body { align-items: flex-end; }
.chat-bubble {
  padding: 12px 16px; border-radius: var(--radius-card); border-bottom-left-radius: var(--chat-tail);
  background: var(--surface-card); font-size: 0.9rem; line-height: 1.6; color: var(--text-primary); overflow-wrap: anywhere;
}
.chat-bubble p + p { margin-top: 8px; }
.chat-msg.is-user .chat-bubble { background: var(--surface-well); border-bottom-left-radius: var(--radius-card); border-bottom-right-radius: var(--chat-tail); }
.chat-msg.is-selected .chat-bubble { box-shadow: 0 0 0 2px var(--focus-halo); }
.chat-meta { font-size: 0.68rem; color: var(--text-tertiary); padding: 0 6px; }
.chat-bubble h3 { font-size: 0.92rem; margin-bottom: 4px; }
.chat-bubble .check-group { margin: 10px 0 12px; }
.chat-bubble-note { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; }
.chat-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chat-sources .text-fine { margin-right: 2px; }
.chat-sources .badge, .chat-panel .badge { white-space: normal; border-radius: var(--radius-control); line-height: 1.35; text-align: left; }
.chat-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.chat-actions .link-action { padding: 4px 0; }
.chat-msg .chips { margin-top: 8px; }

/* La réponse qui s'écrit : trois points et ce que fait l'assistant (.ai-wait) tant que rien n'est arrivé, puis curseur clignotant au bout du texte */
.chat-answer[data-ia-etat="attente"] { color: var(--text-secondary); font-size: 0.86rem; }
.chat-answer[data-ia-etat="erreur"] { color: var(--text-secondary); font-size: 0.84rem; }
.chat-answer[data-ia-etat="en-cours"] p:last-child::after {
  content: ''; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: text-bottom;
  background: var(--accent); animation: chat-caret 0.9s steps(1, end) infinite;
}
@keyframes chat-caret { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes chat-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Accueil d'une conversation vide */
.chat-welcome { margin: auto; width: 100%; max-width: 640px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 16px 0 28px; }
.chat-welcome .avatar { width: 56px; height: 56px; }
.chat-welcome .avatar svg { width: 26px; height: 26px; }
.chat-welcome h2 { font-size: 1.4rem; margin: 6px 0 0; }
.chat-welcome p { max-width: 460px; font-size: 0.88rem; color: var(--text-secondary); }
.chat-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; width: 100%; margin-top: 14px; }
.chat-suggestion {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 13px 14px; border: none; border-radius: var(--radius-card-compact);
  background: var(--surface-card); font: inherit; font-size: 0.82rem; line-height: 1.4; color: var(--text-primary); text-align: left; cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.3s var(--ease-soft), transform 0.15s var(--ease-soft);
}
.chat-suggestion svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.chat-suggestion:hover { background: var(--surface-raised); box-shadow: var(--shadow-control-hover); transform: translateY(-1px); }

/* Zone de saisie */
.chat-composer {
  display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0; padding: 7px 7px 7px 20px;
  background: var(--surface-control); border-radius: var(--radius-panel); box-shadow: var(--shadow-inset);
}
.chat-composer:focus-within { box-shadow: var(--shadow-inset), 0 0 0 3px var(--focus-halo); }
.chat-input {
  flex: 1; min-width: 0; resize: none; border: none; outline: none; background: transparent; font: inherit; font-size: 0.92rem; line-height: 1.45;
  color: var(--text-primary); padding: 9px 0; max-height: 120px; field-sizing: content;   /* grandit avec le texte */
}
.chat-input::placeholder { color: var(--text-tertiary); }
.chat-send { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: var(--radius-round); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.chat-send svg { width: 18px; height: 18px; }
.chat-note { flex-shrink: 0; text-align: center; font-size: 0.7rem; color: var(--text-tertiary); padding-top: 9px; }

/* Détail de la réponse choisie */
.chat-panel { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 16px; background: var(--surface-card); border-radius: var(--radius-card); box-shadow: var(--shadow-flat); }
.chat-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-panel-head h2 { font-size: 0.95rem; margin: 0; }
.chat-panel-block { display: flex; flex-direction: column; gap: 8px; }
.chat-panel-block .card-label { margin-bottom: 0; }
.chat-facts { display: flex; flex-direction: column; gap: 6px; }
.chat-fact { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: var(--radius-card-compact); background: var(--surface-well); font-size: 0.78rem; color: var(--text-secondary); }
.chat-fact b { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.chat-panel .chat-read { font-size: 0.76rem; color: var(--text-secondary); line-height: 1.5; display: flex; flex-direction: column; gap: 10px; }
.chat-panel .chat-read b { color: var(--text-primary); }
.chat-panel .chips { margin: 0; }
.chat-panel-empty { margin: auto 0; padding: 24px 6px; text-align: center; font-size: 0.8rem; color: var(--text-tertiary); }

@media (max-width: 1360px) {
  .chat { grid-template-columns: 236px minmax(0, 1fr); }
  .chat-panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: min(340px, 100%); background: var(--surface-popover); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); display: none; }
  .chat.is-panel-open .chat-panel { display: flex; }
  .chat-toggle-panel { display: inline-flex; }
}
@media (max-width: 900px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-list { position: absolute; top: 0; left: 0; bottom: 0; z-index: 5; width: min(320px, 100%); background: var(--surface-popover); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); display: none; }
  .chat.is-list-open .chat-list { display: flex; }
  .chat-toggle-list { display: inline-flex; }
  .chat-msg-body { max-width: 92%; }
}
@media (max-width: 560px) {
  .chat-composer { padding-left: 16px; }
  .chat-msg .avatar:not(.avatar-photo) { display: none; }
}

/* ---------- Identité de l'assistant (composants ajoutés pour la Suite QVCT) ----------
   Tout ce que l'assistant écrit ou propose se reconnaît au premier regard : un voile lilas très léger sur la carte standard
   (--surface-ai), un liseré fin (--ring-ai), un médaillon étincelle, un bouton de lancement en dégradé (.btn-ai).
   Aucune couleur nouvelle : ce sont des mélanges de la teinte « badge IA » et de l'accent déjà au kit.
   Règle : --surface-ai est réservé à ce que l'assistant a rédigé ou propose ; une carte ordinaire reste #f4f8fb. */
:root {
  --surface-ai: linear-gradient(135deg, color-mix(in oklab, var(--palette-chart-purple) 6%, var(--surface-card)), color-mix(in oklab, var(--accent-soft) 70%, var(--surface-card)));
  --ring-ai: inset 0 0 0 1.5px var(--badge-ai-ring);
  --btn-ai-bg: linear-gradient(120deg, var(--accent), color-mix(in oklab, var(--palette-chart-purple) 58%, var(--accent)));
  --icon-sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3Z' fill='black'/%3E%3Cpath d='M19 15l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7.7-2Z' fill='black'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Médaillon : pastille ronde, étincelle accent */
.ai-medal {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius-round); display: inline-flex; align-items: center; justify-content: center;
  background: var(--badge-ai-bg); box-shadow: var(--ring-glass), var(--shadow-control); color: var(--text-accent);
}
.ai-medal::before { content: ''; width: 52%; height: 52%; background: currentColor; -webkit-mask: var(--icon-sparkle) center / contain no-repeat; mask: var(--icon-sparkle) center / contain no-repeat; }
.ai-medal-lg { width: 60px; height: 60px; }
.ai-medal-sm { width: 26px; height: 26px; }

/* Bouton de lancement de l'assistant : dégradé accent, étincelle devant le libellé. Un par endroit (même rang que .btn-primary). */
.btn-ai {
  background-color: var(--accent); background-image: var(--btn-ai-bg); color: var(--btn-primary-fg); box-shadow: var(--shadow-btn-primary); gap: 8px;
}
.btn-ai::before { content: ''; width: 16px; height: 16px; flex-shrink: 0; background: currentColor; -webkit-mask: var(--icon-sparkle) center / contain no-repeat; mask: var(--icon-sparkle) center / contain no-repeat; }
.btn-ai.btn-sm::before { width: 13px; height: 13px; }
.btn-ai:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.07); }
.btn-ai:disabled { filter: saturate(0.7); }

/* Puce de l'assistant (« Développer cette réponse ») */
.chip-ai { background: var(--surface-ai); box-shadow: var(--ring-ai); color: var(--text-accent); font-weight: 600; }
.chip-ai::before { content: ''; width: 13px; height: 13px; background: currentColor; -webkit-mask: var(--icon-sparkle) center / contain no-repeat; mask: var(--icon-sparkle) center / contain no-repeat; }

/* Carte de l'assistant : ce qu'il a rédigé. En-tête (médaillon, titre, actions), texte, pied (ce qui a été lu, mise en garde). */
.ai-card { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; border-radius: var(--radius-card); background: var(--surface-ai); box-shadow: var(--ring-ai); }
.ai-card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-card-title { flex: 1 1 200px; min-width: 0; line-height: 1.25; }
.ai-card-title b { display: block; font-size: 1rem; font-weight: 650; }
.ai-card-title small { display: block; font-size: 0.76rem; color: var(--text-secondary); margin-top: 2px; }
.ai-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.ai-card-body { font-size: 0.96rem; line-height: 1.7; color: var(--text-primary); }
.ai-card-body p + p { margin-top: 10px; }
.ai-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 0.74rem; color: var(--text-tertiary); }
.ai-card-foot b { color: var(--text-secondary); font-weight: 600; }
/* Le même fond pour les cartes de l'assistant plus petites (diagnostic de fiche, résumé, suggestion) */
.ai-summary-card { margin-bottom: 12px; background: var(--surface-ai); box-shadow: var(--ring-ai); }

/* Texte rédigé : l'essentiel en première ligne (réponses détaillées), pistes numérotées (listes) */
.ia-lead { font-size: 1.07em; font-weight: 600; line-height: 1.5; }
.ia-ligne { display: flex; align-items: flex-start; gap: 12px; }
.ia-ligne b {
  flex: none; width: 26px; height: 26px; border-radius: var(--radius-round); display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-raised); box-shadow: var(--ring-glass-strong), var(--shadow-control); color: var(--text-accent); font-size: 0.78rem; font-weight: 700;
}
.ia-ligne span { padding-top: 2px; }

/* L'assistant travaille : trois points qui rebondissent et ce qu'il fait */
.ai-wait { display: inline-flex; align-items: center; gap: 10px; font-style: normal; }
.ai-dots { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ai-dots i { width: 7px; height: 7px; border-radius: var(--radius-round); background: var(--accent); opacity: 0.35; animation: ai-bounce 1.2s ease-in-out infinite; }
.ai-dots i:nth-child(2) { animation-delay: 0.15s; }
.ai-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.35; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Piste de l'assistant sous un constat calculé (tableau de bord) */
.insight-lead {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius-card-compact);
  background: var(--surface-ai); box-shadow: var(--ring-ai); font-size: 0.84rem; line-height: 1.5; font-style: normal; color: var(--text-primary);
}
.insight-lead:not([hidden])::before {
  content: ''; flex: none; width: 15px; height: 15px; margin-top: 2px; background: var(--text-accent);
  -webkit-mask: var(--icon-sparkle) center / contain no-repeat; mask: var(--icon-sparkle) center / contain no-repeat;
}

/* Dans une carte de l'assistant, le texte n'a pas de second cadre : la carte porte déjà le fond et le liseré */
.ai-summary-card .insight-lead { margin-top: 8px; padding: 0; background: none; box-shadow: none; font-size: 0.92rem; line-height: 1.6; }
.ai-summary-card .insight-lead:not([hidden])::before { display: none; }

/* Bandeau de présentation de l'assistant (en tête d'une page) */
.ai-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 22px 26px; margin-bottom: 18px; border-radius: var(--radius-card); background: var(--surface-ai); box-shadow: var(--ring-ai); }
.ai-hero-text { flex: 1 1 320px; min-width: 0; }
.ai-hero-eyebrow { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-accent); }
.ai-hero h1 { font-size: 1.55rem; line-height: 1.2; margin: 3px 0 6px; }
.ai-hero p { max-width: 64ch; font-size: 0.9rem; color: var(--text-secondary); }
.ai-promises { display: flex; flex-direction: column; gap: 8px; flex: 0 1 310px; min-width: 0; }
.ai-promise { display: flex; align-items: flex-start; gap: 9px; font-size: 0.8rem; line-height: 1.4; color: var(--text-secondary); }
.ai-promise b { color: var(--text-primary); font-weight: 600; }
.ai-promise::before { content: ''; flex: none; width: 16px; height: 16px; margin-top: 1px; background: var(--badge-ok-fg); -webkit-mask: var(--icon-check) center / contain no-repeat; mask: var(--icon-check) center / contain no-repeat; }

/* Question rapide à l'assistant (tableau de bord) : même zone de saisie que la conversation */
.ai-ask { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: var(--grid-gap); border-radius: var(--radius-card); background: var(--surface-ai); box-shadow: var(--ring-ai); }
.ai-ask-text { flex: 0 1 250px; min-width: 0; line-height: 1.3; }
.ai-ask-text b { display: block; font-size: 0.98rem; font-weight: 650; }
.ai-ask-text small { display: block; font-size: 0.76rem; color: var(--text-secondary); margin-top: 2px; }
.ai-ask .chat-composer { flex: 1 1 360px; min-width: 0; }
.ai-ask .chips { flex: 1 1 100%; margin: 0; }
.topbar-ai { margin-left: auto; flex-shrink: 0; }
@media (max-width: 760px) { .topbar-ai span { display: none; } }

/* La conversation prend l'identité de l'assistant : bulle sur fond « assistant », avatar en dégradé */
.chat-msg.is-assistant .chat-bubble { background: var(--surface-ai); box-shadow: var(--ring-ai); }
.chat-msg.is-assistant.is-selected .chat-bubble { box-shadow: var(--ring-ai), 0 0 0 3px var(--focus-halo); }
.chat-msg.is-assistant > .avatar, .chat-avatar, .chat-welcome .avatar { background: var(--btn-ai-bg); }
.chat-answer .ia-lead { font-size: 1.02em; }
.chat-welcome .ai-promises { align-items: flex-start; max-width: 460px; margin-top: 10px; text-align: left; }

/* ---------- Conversation : niveau, options avancées, rapport, retour (ajouts pour la Suite QVCT) ---------- */
/* Texte pour les lecteurs d'écran seulement (annonces de progression) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Choix du niveau, juste au-dessus de la saisie : puces (une active), phrase d'aide, lien « Options avancées » */
.chat-options { flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 0 6px 10px; }
.chat-levels { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.chat-levels .chips { margin: 0; }
.chat-options .link-action { margin-left: auto; }
.chat-advanced { flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 14px; border-radius: var(--radius-card-compact); background: var(--surface-card); }

/* Rapport : une partie par titre (majuscules accent), séparées par de l'espace, sans filet */
.chat-section + .chat-section { margin-top: 16px; }
.chat-section h3 { margin-bottom: 6px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-accent); }

/* Niveau effectivement utilisé, sous la réponse ; retour (Mauvais périmètre, Chiffre incorrect…) en puces */
.chat-niveau { margin-top: 8px; font-size: 0.72rem; color: var(--text-tertiary); }
.chat-niveau b { font-weight: 600; color: var(--text-secondary); }
.chat-feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-feedback .chip { min-height: 28px; font-size: 0.74rem; }

/* ---------------------------------------------------------------------------
   Assistant : graphique en barres, guide, livrable (présentation)
   Le graphique est un SVG en ligne calculé par le code (js/ia-visuels.js) : les couleurs viennent de ces variables de rôle, jamais du script.
   --------------------------------------------------------------------------- */
:root {
  --viz-serie-1: var(--accent);                 /* première série (équipe choisie, année la plus ancienne) */
  --viz-serie-2: var(--accent-2);               /* deuxième série (entreprise, autre équipe) */
  --viz-serie-3: var(--palette-icy-blue);       /* troisième série (année la plus récente) */
  --viz-serie-4: var(--palette-grey-olive);
  --viz-rang: var(--palette-icy-blue);          /* barre d'un classement */
  --viz-rang-mis: var(--accent);                /* barre de l'équipe choisie dans un classement */
}
.barchart { display: block; width: 100%; height: auto; }
.barchart .grid-line { stroke: var(--chart-grid-line); stroke-width: 1; }
.barchart .axis-label { font-size: 11.5px; fill: var(--text-tertiary); font-family: var(--font-body); }
.barchart .row-label { fill: var(--text-secondary); }
.barchart .row-label.is-mis { fill: var(--text-brand); font-weight: 700; }
.barchart .val-label { font-size: 12px; font-weight: 700; fill: var(--text-primary); font-family: var(--font-body); }
.barchart .bar-0 { fill: var(--viz-serie-1); }
.barchart .bar-1 { fill: var(--viz-serie-2); }
.barchart .bar-2 { fill: var(--viz-serie-3); }
.barchart .bar-3 { fill: var(--viz-serie-4); }
.barchart .bar-rank { fill: var(--viz-rang); }
.barchart .bar-rank.is-mis { fill: var(--viz-rang-mis); }
.barchart .ref-line { stroke: var(--text-tertiary); stroke-width: 1.4; stroke-dasharray: 4 4; }
.barchart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--text-secondary); }
.barchart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.barchart-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
.barchart-swatch.bar-0 { background: var(--viz-serie-1); }
.barchart-swatch.bar-1 { background: var(--viz-serie-2); }
.barchart-swatch.bar-2 { background: var(--viz-serie-3); }
.barchart-swatch.bar-3 { background: var(--viz-serie-4); }
.barchart-swatch.ref-line { width: 18px; height: 0; border-radius: 0; background: none; border-top: 2px dashed var(--text-tertiary); }
.chat-chart .chart-frame { margin-top: 8px; }
.chat-chart-lecture { margin-top: 10px; font-size: 0.86rem; color: var(--text-secondary); }

/* Guide de l'assistant (commande /aide) : sections, exemples cliquables, commandes et assistants en lignes */
.chat-guide .chat-section .text-fine { display: block; margin-bottom: 8px; }
.chat-guide .chips { margin-top: 8px; }
.chat-cmd { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 4px 12px; padding: 8px 12px; border-radius: var(--radius-card-compact); background: var(--surface-well); font-size: 0.84rem; }
.chat-cmd b { font-weight: 650; color: var(--text-accent); }
.chat-cmd span { color: var(--text-secondary); }
.chat-cmd + .chat-cmd { margin-top: 6px; }
.chat-cmd-stack { grid-template-columns: 1fr; }
.chat-guide > p + .chat-section { margin-top: 14px; }
@media (max-width: 560px) { .chat-cmd { grid-template-columns: 1fr; } }

/* Livrable prêt (présentation PowerPoint) : carte de l'assistant avec le bouton de téléchargement */
.chat-livrable { margin-top: 12px; padding: 14px 16px; }
.chat-livrable .ai-card-head { gap: 10px; }
