/* ============================================================================
   CATHEDIS ERP — Styles principaux
   ============================================================================
   Branding CATHEDIS : rouge affiné #f5273a -> #d81124 (restyling 2026)
   Police : Segoe UI (native Windows) — pas de Google Fonts (app offline)
   Layout : sidebar fixe + zone de contenu dynamique
   ============================================================================ */

/* ── Variables ──
   Restyling 2026 : langage plus doux, aéré et arrondi (inspiration
   TastyIgniter) tout en gardant le ROUGE CATHEDIS (affiné) et la densité
   d'un vrai ERP. Mêmes noms de variables qu'avant → les styles inline des
   pages restent valides ; seules les VALEURS changent. */
:root {
  /* Rouge CATHEDIS affiné (un peu plus vif et net que l'ancien #c0000d) */
  --primary: #d81124;
  --primary-dark: #a80d1a;
  --primary-light: #f5273a;
  --primary-bg: #fdeced;
  --primary-border: #f6bcc1;

  /* Rouge grisé (sourd) : modèle UNIQUE des titres de section de la sidebar */
  --sec-red: #9b535d;
  --sec-red-soft: #f1e7e9;
  --sidebar-bg: #fbeef1;   /* fond de sidebar rougeâtre (au lieu de blanc) */

  /* Neutres : canvas plus clair/aéré, bordures « fil de cheveu » */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --border: #eceff4;
  --border-dark: #d4dae3;

  --text: #161b22;
  --text-secondary: #5a6473;
  --text-muted: #98a2b3;

  --success: #0f9d6a;
  --success-bg: #e4f6ee;
  --warning: #b9770a;
  --warning-bg: #fbf0da;
  --danger: #d64545;
  --danger-bg: #fdecec;
  --info: #2f6bd6;
  --info-bg: #e7effc;

  /* ── Palette GRAPHIQUES CATHEDIS ──────────────────────────────────────────
     Catégorielle, ancrée sur le rouge marque + tokens ERP (fini les couleurs
     bariolées type orange/indigo/rose/lime). RÈGLE : tout graphique de l'ERP
     utilise ces variables (ou window.CHART_COLORS côté JS). Ordre = priorité
     visuelle : la 1re série tombe sur le rouge marque. */
  --chart-1: #d81124;   /* rouge marque */
  --chart-2: #2f6bd6;   /* bleu info */
  --chart-3: #0f9d6a;   /* vert succès */
  --chart-4: #b9770a;   /* ambre */
  --chart-5: #9b535d;   /* rouge grisé (sec-red) */
  --chart-6: #7a5cc0;   /* violet sourd */
  --chart-positive: #0f9d6a;   /* montant positif / marge */
  --chart-negative: #d64545;   /* déficit / négatif */
  --chart-axis: #98a2b3;       /* axes + libellés muets */
  --chart-grid: #eceff4;       /* lignes de grille */

  /* Coins plus arrondis + ombres douces et diffuses (valeurs du showcase) */
  --radius: 18px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(20,26,34,.04), 0 10px 26px -12px rgba(20,26,34,.14);
  --shadow-md: 0 2px 4px rgba(20,26,34,.05), 0 12px 28px -12px rgba(20,26,34,.16);
  --shadow-lg: 0 24px 60px -20px rgba(20,26,34,.30);

  /* Liquid glass (clair) — verre dépoli translucide : sidebar ouverte + onglets.
     Plus transparent + flou fort pour bien laisser voir le contenu flouté dessous. */
  --glass-bg: rgba(255,255,255,.38);
  --glass-bg-strong: rgba(255,255,255,.44);
  --glass-blur: saturate(185%) blur(40px);
  --glass-border: rgba(255,255,255,.55);
  --glass-hi: rgba(255,255,255,.85);      /* liseré de rehaut en haut */
  --glass-shadow: 0 18px 50px -18px rgba(20,26,34,.28);

  --sidebar-width: 240px;
  --header-height: 44px;   /* en-tête compact (demande Maher 15/09/2026) */

  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

/* Alignement propre de tous les chiffres, sans imposer la police mono */
body { font-variant-numeric: tabular-nums; }

/* Navigateur : neutralise le geste « balayage = page précédente » (tactile /
   2 doigts sur pavé) et le pull-to-refresh partout dans l'ERP — un swipe au
   bord d'un canvas (organigramme, grilles) ne doit JAMAIS quitter la page. */
html, body { overscroll-behavior: none; }
/* 23/09/2026 — html/body sont en overflow:hidden (coque ET frames d'onglets tab-host) :
   Chrome accroche alors le balayage au conteneur qui défile vraiment (.tab-shell-content,
   grilles AG Grid, tableaux, barre latérale, barre d'onglets…) et, arrivé au bout, le
   relaie au navigateur (« ← » = page précédente). On coupe ce relais HORIZONTAL sur TOUS
   les éléments, et tout relais sur les conteneurs de page. Complété par la garde
   d'historique d'app.js (initGardeRetour).
   ⚠ Effet de bord : Chrome ne relaie plus non plus le défilement horizontal d'un
   conteneur vers son parent (Maj+molette sur un tableau large) → rétabli en JS par
   app.js (initDefilementHorizontal). Ne pas retirer l'un sans l'autre. */
* { overscroll-behavior-x: none; }
.app-content, .tab-shell-content { overscroll-behavior: none; }

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  /* Léger halo rouge en haut à droite (showcase) — visible aussi dans les
     iframes d'onglets puisque chaque page a son propre body. */
  background: radial-gradient(680px 320px at 100% -6%, rgba(216,17,36,.055), transparent 60%) no-repeat, var(--bg);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* ── App Layout ── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  /* 3 rangees : header / barre d'onglets (auto, 0 si masquee) / contenu */
  grid-template-rows: var(--header-height) auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

/* ── Header (barre titre) ── */
.app-header {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  -webkit-app-region: drag; /* permet de deplacer la fenetre */
  user-select: none;
  z-index: 100;
}

.app-header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header-logo img {
  height: 32px;
}

.app-header-logo h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.app-header-logo .subtitle {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* Badge « mes tâches » dans l'en-tête (clic → onglet Projets & Tâches) */
.header-taches-badge {
  -webkit-app-region: no-drag;
  margin-left: 18px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff; font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 5px 12px 5px 10px; border-radius: 999px; cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.header-taches-badge:hover { background: rgba(255,255,255,0.28); }
.header-taches-badge:active { transform: scale(.97); }
.header-taches-badge .htb-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #fff; color: var(--primary); font-size: 12px; font-weight: 800;
}
.header-taches-badge.is-zero .htb-count { background: rgba(255,255,255,0.35); color: #fff; }
.header-taches-badge .htb-label { opacity: .95; }

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-app-region: no-drag;
}

.header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--font);
}

.header-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ── En-tête minimaliste (demande Maher 15/09/2026) : icônes seules, libellé en
   overlay au survol / focus clavier ; nom d'utilisateur et mot « tâches » masqués
   (le nom reste dans le DOM : ancre de app.js pour la pastille de prière). ── */
.header-btn.header-icon {
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.header-btn.header-icon svg {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.header-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1f2937; color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 1001;
}
.header-btn[data-tip]:hover::after, .header-btn[data-tip]:focus-visible::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.header-dropdown.open .header-btn[data-tip]::after { display: none; } /* pas de tooltip par-dessus le menu ouvert */
#header-user { display: none !important; }
.header-taches-badge .htb-label { display: none; }
.header-taches-badge { margin-left: 10px; padding: 3px 7px; }

/* ── Menu deroulant d'en-tete (Parametres) ── */
.header-dropdown {
  position: relative;
  display: inline-block;
}
.header-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1000;
}
.header-dropdown.open .header-dropdown-menu {
  display: block;
}
.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.header-dropdown-item:hover {
  background: var(--surface-alt);
  color: var(--primary);
}

/* ── Horaires de prière (widget en-tête) ── */
#btn-prayer { white-space: nowrap; }
#btn-prayer.prayer-now {
  background: rgba(255,255,255,0.92);
  color: var(--primary);
  font-weight: 700;
  animation: prayer-pulse 1.6s ease-in-out infinite;
}
@keyframes prayer-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}
.prayer-menu { min-width: 240px; }
.prayer-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.prayer-menu-head select {
  font-family: var(--font);
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.prayer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
}
.prayer-row small { color: var(--text-soft, #98a2b3); font-size: 11px; }
.prayer-row b { font-variant-numeric: tabular-nums; }
.prayer-row.next {
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 700;
}
.prayer-menu-foot {
  margin-top: 6px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-soft, #98a2b3);
}

/* ── Sidebar ── */
.app-sidebar {
  grid-column: 1;
  grid-row: 2 / 4; /* longe la barre d'onglets ET le contenu */
  background: var(--sidebar-bg);
  border-right: 1px solid #f0dfe3;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
}

/* Citation CATHEDIS, collee en bas a gauche de la sidebar (memes "quotes" que le login) */
.sidebar-quote {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 12px 18px 14px;
  background: linear-gradient(180deg, rgba(251,238,241,0), var(--sidebar-bg) 32%);
  border-top: 1px solid #f0dfe3;
  display: flex;
  gap: 7px;
  align-items: flex-start;
  min-height: 44px;
}
.sidebar-quote-mark {
  font-size: 22px;
  line-height: 0.9;
  color: var(--primary);
  font-weight: 800;
  flex: 0 0 auto;
}
.sidebar-quote-text {
  font-style: italic;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  transition: opacity 0.45s ease;
}
.sidebar-quote-text.fading { opacity: 0; }

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-family: var(--font-mono);   /* écriture « terminal » comme les libellés de login.html */
  font-size: 11px;
  font-weight: 600;
  color: var(--sec-red);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 8px 16px 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;      /* pas de retour à la ligne pendant l'animation du rail */
  overflow: hidden;
  cursor: pointer;          /* titre = bouton replier/deplier */
  user-select: none;
}

/* Idem pour toutes les lignes de nav (y compris les sous-titres texte) :
   rognées pendant l'expansion du rail au lieu de wrapper (tressautement). */
.sidebar-nav li { white-space: nowrap; overflow: hidden; }
.sidebar-section-title:hover {
  opacity: 0.8;
}

/* Chevron a droite du titre : pointe vers le bas (deplie), vers la droite (replie) */
.sidebar-section-title::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  opacity: 0.7;
  flex: 0 0 auto;
}
.sidebar-section.collapsed .sidebar-section-title::after {
  transform: rotate(-45deg);
}

/* ── Animation d'ouverture / fermeture des sections ──
   Le <ul.sidebar-nav> est enveloppe dans .sidebar-nav-wrap par
   js/sidebar-collapse.js. On anime la hauteur via grid-template-rows
   1fr -> 0fr (permet d'animer jusqu'a la hauteur naturelle, ce que
   height:auto ne permet pas), avec un fondu du contenu. */
.sidebar-nav-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-section.collapsed .sidebar-nav-wrap {
  grid-template-rows: 0fr;
}
.sidebar-nav-wrap > .sidebar-nav {
  overflow: hidden;
  min-height: 0;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0s;
}
.sidebar-section.collapsed .sidebar-nav-wrap > .sidebar-nav {
  opacity: 0;
  /* sort les liens repliés de l'ordre de tabulation (focus clavier) */
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s 0.3s;
}
/* Premier rendu : pas d'animation (sinon repli visible au demarrage) */
.sidebar-no-anim .sidebar-nav-wrap,
.sidebar-no-anim .sidebar-nav-wrap > .sidebar-nav {
  transition: none !important;
}

/* ── Modèle UNIQUE des titres de section (mono rouge grisé) ──
   Plus aucune couleur par section : toutes identiques. L'icône vit dans une
   petite puce arrondie ; c'est le seul repère visuel (repère fonctionnel). */
.sidebar-section-title .sec-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sec-red);
  flex: 0 0 auto;
  transition: width .28s cubic-bezier(.4,0,.2,1),
              height .28s cubic-bezier(.4,0,.2,1),
              background .15s, color .15s;
}
.sidebar-section-title .sec-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: width .28s cubic-bezier(.4,0,.2,1),
              height .28s cubic-bezier(.4,0,.2,1);
}
/* Section courante : pastille pleine autour de l'icône (repère « vous êtes ici ») */
.sidebar-section:has(.sidebar-nav a.active) .sec-icon {
  background: var(--sec-red);
  color: #fff;
}

.sidebar-nav {
  list-style: none;
}

/* En-tête de sous-groupe FORT à l'intérieur d'une section (ex. RH → Paie
   Freelance / Paie CDI / Paie Intérim). Style « terminal » accentué pour se
   distinguer des libellés muets internes. */
.sidebar-nav li.nav-group-strong {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #2f6bd6;
  padding: 11px 16px 5px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
}
.sidebar-nav li.nav-group-strong:first-child {
  border-top: none;
  margin-top: 0;
}
.sidebar-nav li.nav-group-strong .g-ico {
  font-size: 13px;
  line-height: 1;
}

/* ── Sous-groupes RH repliables (accordeon niveau 2) ──
   js/sidebar-subgroups.js transforme chaque <li.nav-group-strong> en titre
   cliquable et enveloppe ses entrees dans un <li.nav-subgroup-wrap> anime
   (grid-template-rows 1fr <-> 0fr, comme les sections). Repli par defaut. */
.sidebar-nav li.nav-group-strong.is-toggle {
  cursor: pointer;
  user-select: none;
}
.sidebar-nav li.nav-group-strong.is-toggle:hover { opacity: 0.8; }
/* Chevron a droite : bas = deplie, droite = replie (identique aux sections) */
.sidebar-nav li.nav-group-strong.is-toggle::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  opacity: 0.7;
  flex: 0 0 auto;
}
.sidebar-nav li.nav-group-strong.is-toggle.collapsed::after {
  transform: rotate(-45deg);
}
/* Conteneur anime des entrees d'un sous-groupe */
.sidebar-nav li.nav-subgroup-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  margin: 0;
}
.sidebar-nav li.nav-group-strong.collapsed + li.nav-subgroup-wrap {
  grid-template-rows: 0fr;
}
.sidebar-nav li.nav-subgroup-wrap > ul.nav-subgroup {
  overflow: hidden;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: opacity 0.2s ease, visibility 0s;
}
.sidebar-nav li.nav-group-strong.collapsed + li.nav-subgroup-wrap > ul.nav-subgroup {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s 0.28s;
}
/* Premier rendu : pas d'animation du repli initial des sous-groupes */
.sidebar-no-anim .nav-subgroup-wrap,
.sidebar-no-anim .nav-subgroup-wrap > .nav-subgroup {
  transition: none !important;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 1px 10px;
  border-radius: 999px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

/* Sous-items indentés (ex-style inline padding-left:32px) */
.sidebar-nav li a.nav-sub { padding-left: 32px; }

.sidebar-nav li a:hover {
  background: rgba(155,83,93,.10);
  color: var(--text);
}

/* Onglet actif : pill pleine rouge CATHEDIS, texte blanc (réf. Dribbble) */
.sidebar-nav li a.active {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px -6px rgba(216,17,36,.5);
}
.sidebar-nav li a.active .nav-badge {
  background: rgba(255,255,255,.22);
  color: #fff;
}

.sidebar-nav li a .nav-icon {
  display: none;   /* icônes UNIQUEMENT sur les grands titres (sections) */
}

.sidebar-nav li a .nav-badge {
  margin-left: auto;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}

/* ── Content Area ── */
/* ── Barre d'onglets de travail (facon Delivery Tracker) — js/tabs.js ── */
.tab-bar {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px 10px 0;
  /* Liquid glass : verre dépoli translucide (comme la sidebar ouverte) */
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  white-space: nowrap;
  user-select: none;
}
.tab-bar:empty { display: none; } /* pas d'onglet -> la rangee se replie */

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 8px 12px;
  max-width: 220px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  flex: 0 0 auto;
}
.tab-item:hover { background: var(--bg); color: var(--text); }
.tab-item.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-bg);
  border-bottom-color: var(--primary);
}
.tab-icon { font-size: 13px; line-height: 1; }
.tab-label { overflow: hidden; text-overflow: ellipsis; }
.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 2px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: inherit;
  opacity: 0.55;
}
.tab-close:hover { opacity: 1; background: var(--primary-bg); color: var(--primary); }

/* Onglet "dormant" : ouvert dans la barre mais frame non chargee (restauration
   de session ou dechargement LRU) — rechargera au clic */
.tab-item.dormant { opacity: 0.62; }

@media print { .tab-bar { display: none; } }

.app-content {
  grid-column: 2;
  grid-row: 3;
  overflow-y: auto;
  padding: 24px;
  background: radial-gradient(680px 320px at 100% -6%, rgba(216,17,36,.055), transparent 60%) no-repeat, var(--bg);
}

/* ── Onglets vivants : conteneur des frames (index.html) ──
   Chaque page vit dans sa propre iframe tab-host.html, empilees ici ; seule
   l'active est visible. visibility (et non display) : la mise en page des
   frames cachees reste calculee, les grilles AG Grid ne se recalent pas a
   chaque bascule et les traitements en cours continuent. */
.app-content.tab-frames {
  position: relative;
  padding: 0;
  overflow: hidden;
}
.tab-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
  visibility: hidden;
}
.tab-frame.active { visibility: visible; }
/* Frame en arriere-plan mais tenue « rendue » (gros job client type html2canvas) :
   visible pour que le navigateur continue son rendu/rAF, mais poussee hors-ecran
   pour ne pas recouvrir l'onglet actif. Meme origine -> pas de throttling rAF. */
.tab-frame.render-hold { visibility: visible; transform: translateX(-200vw); }
.tab-frame.render-hold.active { transform: none; }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stat Cards (dashboard) ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--primary-bg);
  color: var(--primary);
  margin-bottom: 14px;
}

.stat-card .stat-value {
  font-size: 27px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  box-shadow: 0 6px 16px -8px rgba(216,17,36,.55);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-dark);
}
.btn-secondary:hover { background: var(--surface-alt); border-color: var(--primary-border); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { filter: brightness(0.9); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { filter: brightness(0.9); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

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

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.data-table tbody tr.selected {
  background: var(--primary-bg);
}

/* --- Tri par colonne --- */
.data-table th.th-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}
.data-table th.th-sortable::after {
  content: '\2195'; /* ⇕ */
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.28;
  font-size: 10px;
}
.data-table th.th-sortable:hover::after { opacity: 0.55; }
.data-table th.th-sortable.sorted-asc::after { content: '\25B2'; opacity: 0.95; } /* ▲ */
.data-table th.th-sortable.sorted-desc::after { content: '\25BC'; opacity: 0.95; } /* ▼ */

/* --- Recherche par colonne --- */
.data-table thead tr.filter-row th {
  padding: 4px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.data-table thead tr.filter-row input.col-filter {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.data-table thead tr.filter-row input.col-filter:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table .cell-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
}

.data-table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

/* ── AG Grid (surcouche des tableaux .data-table) ──
   Theme Quartz reskinne aux couleurs CATHEDIS + police Segoe UI. */
.ag-erp-grid {
  --ag-font-family: var(--font);
  --ag-font-size: 13px;
  --ag-foreground-color: var(--text);
  --ag-border-color: var(--border);
  --ag-header-background-color: var(--surface-alt);
  --ag-header-foreground-color: var(--text-muted);
  --ag-header-column-resize-handle-color: var(--border-dark);
  --ag-odd-row-background-color: #ffffff;
  --ag-row-hover-color: var(--surface-alt);
  --ag-selected-row-background-color: var(--primary-bg);
  --ag-active-color: var(--primary-light);
  --ag-range-selection-border-color: var(--primary-light);
  --ag-input-focus-border-color: var(--primary-light);
  --ag-cell-horizontal-padding: 14px;
  --ag-borders: solid 1px;
  --ag-wrapper-border-radius: var(--radius);
  /* Un peu plus d'air dans les lignes + séparateurs un poil plus visibles
     que la bordure générale (les grilles gardent des milliers de lignes
     lisibles malgré le canvas plus clair). */
  --ag-row-height: 44px;
  --ag-header-height: 44px;
  --ag-row-border-color: #e8ebf1;
  width: 100%;
}
.ag-erp-grid .ag-header-cell-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ag-erp-grid .ag-erp-center { text-align: center; }
.ag-erp-grid .ag-erp-actions { text-align: right; }
/* Boutons / badges conserves dans les cellules : compacts pour tenir dans 40px */
.ag-erp-grid .ag-cell .btn { padding: 3px 8px; font-size: 12px; vertical-align: middle; }
.ag-erp-grid .ag-cell .badge,
.ag-erp-grid .ag-cell .pill { vertical-align: middle; }

/* ── Toolbar (au dessus des tables) ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.toolbar-search input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-family: var(--font);
}

.toolbar-search input:focus {
  outline: none;
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* Plus de loupe décorative (::before) dans les barres de recherche : seul le bouton 🔎
   cliquable (app.js:decorateSearchInputs) porte l'icône (demande Maher 24/09/2026). */

.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ── Badges / Tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
/* Puce colorée devant le libellé (showcase) */
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);    color: var(--info);    }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Modales pilotees par le style inline `display:flex` (achats, echeancier,
   creances, paie freelance...) : les rendre visibles des qu'elles passent en
   display:flex, sans dependre de la classe .open. Sans ceci, le `opacity:0;
   visibility:hidden` de .modal-overlay les laisse invisibles meme ouvertes. */
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-alt);
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
}

.toast-success { background: var(--success); color: white; }
.toast-error   { background: var(--danger);  color: white; }
.toast-warning { background: var(--warning); color: white; }
.toast-info    { background: var(--info);    color: white; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Tabs (dans les pages) ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utilities ── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-mono   { font-family: var(--font-mono); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════════════
   SIDEBAR « RAIL » (desktop) — barre d'icônes 76px, expansion en
   OVERLAY au survol / focus clavier (réf. Dribbble Web Sidebar Menu).
   Scopé min-width:1121px UNIQUEMENT (en-dessous : tiroir mobile de mobile.css).
   ⚠️ AUCUNE condition de survol dans la media query : ni hover:hover ni
   any-hover:hover. Raison (bug Maher 01/09/2026) : sur certains PC Windows
   TACTILES, Chrome rapporte hover:none ET any-hover:none MÊME avec une souris
   branchée → toute media query gatée sur le survol échouait et la sidebar
   restait bloquée à sa largeur de base (240px). Or la pseudo-classe :hover,
   elle, se déclenche au VRAI passage de la souris quelle que soit la valeur
   (fausse) rapportée par ces media-features → l'expansion au survol marche
   toujours. Le rail est donc activé par la LARGEUR seule (toujours vraie sur
   un écran ≥1121px) ; sur un pur tactile sans souris, un TAP déclenche :hover
   (survol collant) et ouvre le rail. Ne PAS remettre de gate hover ici.
   ════════════════════════════════════════════════════════════════════ */
@media (min-width: 1121px) {
  :root { --sidebar-width: 76px; }

  /* ── RAIL / TIROIR (refonte 16/09/2026, demande Maher) ──
     Le rail de 76px s'ouvre en tiroir à 252px par une GLISSIÈRE DE LARGEUR ;
     pendant l'ouverture RIEN ne bouge verticalement : les deux états partagent
     exactement le même rythme (puce 34px, ligne de titre 38px, même écart
     --sb-gap, icône au même x = 21px). Seuls les libellés et les sous-menus
     apparaissent. L'écart --sb-gap est calculé sur la hauteur d'écran (« fit to
     height ») à partir du nombre de sections visibles (--sb-n posé par app.js). */
  .app-sidebar {
    --sb-row: 38px;                       /* hauteur d'une ligne de titre */
    --sb-gap: clamp(2px, calc((100vh - var(--header-height) - 6px - 64px - var(--sb-n, 16) * var(--sb-row)) / var(--sb-n, 16)), 26px);
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    z-index: 80;             /* < 100 : le menu Paramètres du header reste devant ;
                                modales (1000) et toasts (2000) le couvrent */
    overflow-x: hidden;
    padding: 6px 0 0;                     /* identique dans les deux états */
    justify-content: flex-start;
    /* ── REPLIÉ : fond identique au reste de l'app (canvas), juste les icônes.
       Pas de couleur de sidebar, pas de bordure visible ni d'ombre. ── */
    background: var(--bg);
    border-right: 1px solid transparent;
    box-shadow: none;
    /* Glissière de largeur (tiroir). Petit délai au repli pour éviter le
       clignotement en traversée de souris. */
    transition: width 0.22s cubic-bezier(.4,0,.2,1) 0.12s, box-shadow 0.22s ease 0.12s,
                background 0.22s ease 0.12s, border-color 0.22s ease 0.12s;
  }
  /* :has(:focus-visible) et non :focus-within : un clic souris laisse le focus
     dans la sidebar et la bloquerait ouverte ; seul le clavier la maintient. */
  /* ── OUVERT (survol / focus clavier) : panneau LIQUID GLASS qui floute le
     contenu derrière (verre dépoli translucide clair). ── */
  .app-sidebar:hover,
  .app-sidebar:has(:focus-visible) {
    width: 252px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    box-shadow: inset 1px 0 0 var(--glass-hi), var(--glass-shadow);
    transition-delay: 0.04s;              /* ouverture quasi immédiate */
  }

  /* ── Rythme vertical COMMUN aux deux états ── */
  .app-sidebar .sidebar-section { margin: 0 0 var(--sb-gap); }
  .app-sidebar .sidebar-section-title {
    box-sizing: border-box;
    min-height: var(--sb-row);
    padding: 2px 16px 2px 21px;           /* 21px = (76 - 34) / 2 : la puce ne bouge pas en x */
    margin: 0;
    gap: 9px;
    justify-content: flex-start;
  }
  .app-sidebar .sidebar-section-title .sec-icon {
    width: 34px;
    height: 34px;
    transition: background .15s, color .15s;   /* plus d'animation de taille */
  }
  .app-sidebar .sidebar-section-title .sec-icon svg {
    width: 18px;
    height: 18px;
    transition: none;
  }
  /* Citation : toujours épinglée en bas, dans les deux états. */
  .app-sidebar .sidebar-quote { margin-top: auto; }
  .app-sidebar:hover .sidebar-quote,
  .app-sidebar:has(:focus-visible) .sidebar-quote {
    background: transparent;              /* pas de fond rose opaque sur le verre */
    border-top-color: rgba(155,83,93,.18);
  }

  /* ── État replié (ni survol ni focus) : SEULEMENT les puces des grands
     titres. Les listes d'items sont masquées et réapparaissent au survol. ── */
  .app-sidebar:not(:hover):not(:has(:focus-visible)) .sidebar-nav-wrap { display: none; }
  /* Replié & au repos : AUCUNE barre de défilement (demande Maher 15/09/2026). */
  .app-sidebar:not(:hover):not(:has(:focus-visible)) {
    scrollbar-width: none;                 /* Firefox */
  }
  .app-sidebar:not(:hover):not(:has(:focus-visible))::-webkit-scrollbar {
    width: 0; height: 0; display: none;    /* WebKit/Blink */
  }
  /* ── Citation du bas : TOUJOURS visible, même repliée (demande Maher 15/09/2026),
     en version compacte centrée qui tient dans le rail de 76px. ── */
  .app-sidebar:not(:hover):not(:has(:focus-visible)) .sidebar-quote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    text-align: center;
    padding: 8px 6px 9px;
    min-height: 0;
    background: transparent;
    border-top: 1px solid rgba(155,83,93,.14);
  }
  .app-sidebar:not(:hover):not(:has(:focus-visible)) .sidebar-quote-mark { display: none; }
  .app-sidebar:not(:hover):not(:has(:focus-visible)) .sidebar-quote-text {
    font-size: 9.5px;
    line-height: 1.28;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;                 /* borne la hauteur : 3 lignes max */
    overflow: hidden;
  }
  .app-sidebar:not(:hover):not(:has(:focus-visible)) .sidebar-section-title {
    gap: 0;
    font-size: 0;            /* masque le texte ; la puce .sec-icon reste, au même x */
    letter-spacing: 0;
  }
  .app-sidebar:not(:hover):not(:has(:focus-visible)) .sidebar-section-title::after {
    display: none;           /* chevron d'accordéon masqué */
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar { transition: none !important; }
}

/* Un élément fixed se répète sur chaque page imprimée : on masque, et la
   grille passe en colonne unique (sinon bande morte de 240px à gauche). */
@media print {
  .app-sidebar, .sidebar-backdrop { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .tab-bar, .app-content { grid-column: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Animations d'entrée des graphes & valeurs (validé par Maher 06/08/2026,
   vitesse « normale » 0,9 s). Compteurs : moteur dans app.js (observateur
   .stat-value / [data-countup-auto]). Ici : barres qui poussent du néant.
   ⚠ JAMAIS dans les rendus DOCUMENTS (factures, états imprimables) :
   garde-fous @media print + [data-no-anim].
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes erp-hbar-grow  { from { width: 0; } }
@keyframes erp-vbar-grow  { from { transform: scaleY(0); } }
@keyframes erp-hbar-scale { from { transform: scaleX(0); } }
@keyframes erp-fadein     { from { opacity: 0; } }

/* Barres horizontales en div (top clients, listes du dashboard) */
.dash-top-bar { animation: erp-hbar-grow .55s cubic-bezier(.2,.7,.3,1) both; }
.dash-top-row:nth-child(2)  .dash-top-bar { animation-delay: .04s; }
.dash-top-row:nth-child(3)  .dash-top-bar { animation-delay: .08s; }
.dash-top-row:nth-child(4)  .dash-top-bar { animation-delay: .12s; }
.dash-top-row:nth-child(5)  .dash-top-bar { animation-delay: .16s; }
.dash-top-row:nth-child(6)  .dash-top-bar { animation-delay: .20s; }
.dash-top-row:nth-child(7)  .dash-top-bar { animation-delay: .24s; }
.dash-top-row:nth-child(8)  .dash-top-bar { animation-delay: .28s; }
.dash-top-row:nth-child(9)  .dash-top-bar { animation-delay: .32s; }
.dash-top-row:nth-child(10) .dash-top-bar { animation-delay: .36s; }

/* Barres SVG : verticales (.abar, origine bas), horizontales (.abar-h, origine
   gauche), valeur au-dessus (.abar-val, fondu après la pousse). Décalage en
   cascade optionnel via style="--d:0.12s" posé par le générateur. */
svg .abar   { transform-box: fill-box; transform-origin: bottom; animation: erp-vbar-grow  .55s cubic-bezier(.2,.7,.3,1) both; animation-delay: var(--d, 0s); }
svg .abar-h { transform-box: fill-box; transform-origin: left;   animation: erp-hbar-scale .55s cubic-bezier(.2,.7,.3,1) both; animation-delay: var(--d, 0s); }
svg .abar-val { animation: erp-fadein .35s ease both; animation-delay: calc(var(--d, 0s) + .3s); }

/* Garde-fous : impression, rendus marqués, et réglage système « réduire les animations » */
@media print {
  .dash-top-bar, svg .abar, svg .abar-h, svg .abar-val { animation: none !important; }
}
[data-no-anim] .dash-top-bar, [data-no-anim] svg .abar, [data-no-anim] svg .abar-h, [data-no-anim] svg .abar-val { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .dash-top-bar, svg .abar, svg .abar-h, svg .abar-val { animation: none !important; }
}

/* Réglage ⚙ Paramètres (app.js pose data-anim + --anim-k sur <html>) :
   --anim-k = vitesse / 0,9 (1 = « normale ») ; data-anim="off" = tout coupé. */
.dash-top-bar, svg .abar, svg .abar-h { animation-duration: calc(.55s * var(--anim-k, 1)); }
svg .abar-val { animation-duration: calc(.35s * var(--anim-k, 1)); }
html[data-anim="off"] .dash-top-bar, html[data-anim="off"] svg .abar,
html[data-anim="off"] svg .abar-h, html[data-anim="off"] svg .abar-val { animation: none !important; }

/* Déclenchement au défilement (06/08/2026) : les barres restent EN PAUSE tant
   qu'elles ne sont pas entrées dans le champ de vision — l'IntersectionObserver
   d'app.js pose .anim-vu à l'apparition (le délai de cascade court à partir de
   là). Sans effet à l'impression (animation:none plus haut). */
.dash-top-bar, svg .abar, svg .abar-h, svg .abar-val { animation-play-state: paused; }
.dash-top-bar.anim-vu, svg .abar.anim-vu, svg .abar-h.anim-vu, svg .abar-val.anim-vu { animation-play-state: running; }

/* Bouton « Tout fermer » (barre d'onglets, tabs.js) : sticky au bord droit,
   reste visible pendant le défilement horizontal de la barre. */
.tab-close-all {
  position: sticky; right: 0; margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 12px; cursor: pointer; font-size: 12px; font-weight: 600;
  color: #5a6473; background: #f4f5f8;
  border-left: 1px solid #e3e7ee; box-shadow: -8px 0 8px -6px rgba(23,30,45,.12);
}
.tab-close-all:hover { color: #d81124; background: #faeef0; }

/* ── Bouton 🔎 automatique des barres de recherche (app.js:decorateSearchInputs) ── */
.sq-wrap { display: flex; align-items: stretch; gap: 6px; min-width: 0; box-sizing: border-box; }
.sq-wrap > input { flex: 1 1 auto !important; min-width: 0 !important; width: auto !important; margin: 0 !important; }
.sq-btn {
  flex: 0 0 auto; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card-bg, #fff); color: var(--text); font-size: 15px; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sq-btn:hover { border-color: var(--primary); background: var(--primary-bg); }
.sq-btn:active { transform: translateY(1px); }
/* Icône Déconnexion pivotée de 180° (porte en haut, flèche vers le bas) (demande Maher 15/09/2026) */
#btn-logout svg { transform: rotate(180deg); }

/* ── Onglets de travail DANS l'en-tête (15/09/2026) : pastilles blanches sur le rouge,
   défilement horizontal discret, titre de page masqué. Les règles génériques .tab-bar /
   .tab-item (rangée sous l'en-tête) restent pour tab-host.html et la version imprimable. ── */
#topbar-title { display: none !important; }
.app-header .tab-bar {
  grid-column: auto; grid-row: auto;
  flex: 1 1 auto; min-width: 0; align-self: center;
  display: flex; align-items: center; gap: 4px;
  margin: 0 10px; padding: 2px 4px;
  background: transparent; border-bottom: none; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  -webkit-app-region: no-drag;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.app-header .tab-bar::-webkit-scrollbar { display: none; }
.app-header .tab-bar:empty { display: none; }
.app-header .tab-item {
  padding: 4px 8px 4px 11px; max-width: 200px; font-size: 12.5px;
  color: rgba(255,255,255,.85); background: rgba(255,255,255,.12);
  border-radius: 999px; border-bottom: none; line-height: 1.2;
}
.app-header .tab-item:hover { background: rgba(255,255,255,.22); color: #fff; }
.app-header .tab-item.active { background: #fff; color: var(--primary); font-weight: 700; }
.app-header .tab-item.dormant { opacity: .7; }
.app-header .tab-close { opacity: .6; }
.app-header .tab-close:hover { opacity: 1; background: rgba(216,17,36,.12); color: var(--primary); }
.app-header .tab-close-all {
  position: sticky; left: 0; z-index: 3; order: -1;   /* toujours en tête, épinglé à gauche */
  flex: 0 0 auto; width: 26px; height: 26px; margin: 0 6px 0 2px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer;
  color: var(--primary); background: #fff;
  transition: background .12s, color .12s;
}
.app-header .tab-close-all .tca-icon {
  width: 15px; height: 15px; stroke: currentColor; fill: none;
  stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
}
.app-header .tab-close-all .tca-label { display: none; }
.app-header .tab-close-all:hover {
  color: #fff; background: var(--primary);
}

/* ── Onglets adaptatifs (tabs.js:_fitTabs, 15/09/2026) : si la rangée déborde,
   la barre reçoit .compact → les onglets INACTIFS se réduisent à leur icône,
   seul l'onglet ACTIF garde son titre. S'il y a de la place, tout s'affiche. ── */
.app-header .tab-bar.compact .tab-item:not(.active) {
  position: relative; gap: 0; padding: 5px 9px; justify-content: center;
}
.app-header .tab-bar.compact .tab-item:not(.active) .tab-label { display: none; }
.app-header .tab-bar.compact .tab-item:not(.active) .tab-icon { font-size: 14px; }
/* Onglet minimisé (icône seule) : AUCUNE croix, pour éviter la fermeture
   accidentelle au clic sur une si petite cible. On ferme au clic-molette
   (auxclick) ou en activant l'onglet (il reprend alors son titre + sa croix). */
.app-header .tab-bar.compact .tab-item:not(.active) .tab-close { display: none; }

/* ── Icônes d'onglet MONOCHROMES (jeu js/nav-icons.js) : trait courant, elles
   héritent de la couleur du texte de l'onglet → blanc sur inactif, rouge sur
   l'actif. Remplacent les emojis multicolores (demande Maher 15/09/2026). ── */
.app-header .tab-item .tab-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.app-header .tab-item .tab-icon svg {
  width: 15px; height: 15px; display: block; stroke: currentColor; fill: none;
}
.app-header .tab-item .tab-icon-letter {
  width: 15px; height: 15px; font-size: 11px; font-weight: 800; line-height: 1;
}
/* Onglet minimisé : icône un peu plus grande, mieux lisible sans libellé. */
.app-header .tab-bar.compact .tab-item:not(.active) .tab-icon svg { width: 17px; height: 17px; }

/* ── Mobile (≤ 768px) : onglets EN ICÔNE SEULE — aucun titre affiché pour tenir
   la largeur du téléphone (demande Maher 15/09/2026). L'onglet actif (pastille
   blanche) garde sa croix ; les inactifs n'en ont pas (fermeture accidentelle). ── */
@media (max-width: 768px) {
  .app-header .tab-item { padding: 5px 9px; gap: 0; justify-content: center; position: relative; }
  .app-header .tab-item .tab-label { display: none; }
  .app-header .tab-item:not(.active) .tab-close { display: none; }
  .app-header .tab-item .tab-icon svg { width: 17px; height: 17px; }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   SYSTÈME DE DESIGN — règles Maher du 22/09/2026 (issues de la refonte de la
   Synthèse Versements). Primitives OPT-IN : elles ne changent rien aux pages
   existantes tant qu'on ne pose pas la classe. À utiliser sur toute NOUVELLE
   page et à appliquer au fil des passages sur les pages existantes.
   Rappel : `.card` n'a PAS de padding → contenu direct = `.card.erp-panel`
   (ou `.card-body`). Réf. skill maher-erp « RÈGLE DESIGN ».
   ═══════════════════════════════════════════════════════════════════════════════ */

/* 1. Respiration : contenu à ≥ 12 px des bords, texte à ≥ 6 px d'une ombre/séparation. */
.card.erp-panel { padding: 12px 16px; box-sizing: border-box; }
.card.erp-panel-lg { padding: 16px 18px; box-sizing: border-box; }

/* 2. Barre de filtres/actions d'un panneau : label → 6 px → champ, tout aligné en bas. */
.erp-toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.erp-toolbar .form-label { display: block; margin: 0 0 6px; line-height: 16px; }
/* Statut/portée discret poussé à droite (« Aucune période sélectionnée. », « Période : … »). */
.erp-toolbar-hint { margin-left: auto; align-self: flex-end; padding-bottom: 9px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.erp-toolbar-hint.is-set { color: var(--text-secondary); }
.erp-toolbar-hint .erp-hint-glyph { font-size: 11px; line-height: 1; }
.erp-toolbar-hint.is-set .erp-hint-glyph { color: var(--chart-2); }

/* 3. Pied de panneau : aide/statut avec marge haute et filet, replié tant qu'il est vide. */
.erp-panel-footer { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12.5px; line-height: 18px; }
.erp-panel-footer:empty { display: none; }
.erp-help { color: var(--text-muted); font-weight: 400; }          /* aide inline neutre, jamais rouge */

/* 4. Boutons : UN seul bouton rouge (.btn-primary) par barre = l'action principale ;
      tout le reste = .btn-quiet (alias lisible de .btn-secondary, angles 6 px comme un champ). */
.btn-quiet { background: var(--surface); color: var(--text); border: 1px solid var(--border-dark); border-radius: 999px; padding: 9px 14px; line-height: 1.25; transition: background .15s, border-color .15s; }
.btn-quiet:hover { background: var(--border); border-color: #c5ccd8; color: var(--text); }
.btn-quiet .erp-ico { color: var(--text-secondary); }               /* icône discrète */
.btn-quiet .erp-ico-accent { color: var(--chart-2); }               /* icône accentuée (rare) */
.btn-primary.btn-square { border: 1px solid var(--primary); border-radius: 999px; padding: 9px 14px; line-height: 1.25; } /* même hauteur que .btn-quiet (bordure 1 px) */ /* même gabarit que .btn-quiet */

/* 5. En-tête de graphique DÉDIÉ : marqueur couleur-série + titre, filet, graphique en dessous.
      Jamais de marge négative ni de position absolue sur le bord de la carte. */
.erp-chart-head { display: flex; align-items: center; gap: 8px; min-height: 20px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.erp-chart-head h3, .erp-chart-head .erp-chart-title { margin: 0; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.erp-mark { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; background: var(--chart-1); }
.erp-mark-1 { background: var(--chart-1); } .erp-mark-2 { background: var(--chart-2); } .erp-mark-3 { background: var(--chart-3); }
.erp-mark-4 { background: var(--chart-4); } .erp-mark-5 { background: var(--chart-5); } .erp-mark-6 { background: var(--chart-6); }
.erp-chart-body { flex: 1; min-height: 0; display: flex; align-items: flex-end; }
.erp-chart-body svg { width: 100%; height: auto; max-height: 100%; display: block; }

/* 6. KPI : hiérarchie par un accent 3 px en haut (pas par plus de couleur), ombre douce, compact. */
.stat-card.compact { padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.stat-card.compact .stat-label { font-size: 11.5px; margin-bottom: 2px; }
.stat-card.compact .stat-value { font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.stat-card.kpi-accent { position: relative; overflow: hidden; }
.stat-card.kpi-accent::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--chart-1); }
.stat-card.kpi-accent-neutral::before { background: #3d4654; }
.stat-card.kpi-accent .stat-label { font-weight: 700; color: var(--text); }
.stat-card.shadow-soft, .erp-kpi-band .stat-card { box-shadow: 0 1px 2px rgba(20,26,34,.04), 0 6px 16px -10px rgba(20,26,34,.12); }
/* Bandeau unique bulles + graphiques : bloc KPI 2 colonnes à gauche, graphiques rétrécis à droite, même hauteur. */
.erp-kpi-band { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(280px, 1fr) minmax(280px, 1fr); gap: 12px; align-items: stretch; margin-bottom: 12px; }
.erp-kpi-band .erp-kpis { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; min-width: 0; }
.erp-kpi-band .erp-kpis .kpi-wide { grid-column: 1 / -1; }
.erp-kpi-band .card.erp-chart { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 1200px) { .erp-kpi-band { grid-template-columns: 1fr 1fr; } .erp-kpi-band .erp-kpis { grid-column: 1 / -1; grid-template-columns: repeat(5, 1fr); } .erp-kpi-band .erp-kpis .kpi-wide { grid-column: auto; } }
@media (max-width: 860px)  { .erp-kpi-band { grid-template-columns: 1fr; } .erp-kpi-band .erp-kpis { grid-template-columns: 1fr 1fr; } .erp-kpi-band .erp-kpis .kpi-wide { grid-column: 1 / -1; } }

/* 7. Tableau simple (.data-table) : en-têtes un cran plus sombres et aérés. */
.data-table.erp-table thead tr { background: #eef1f5; }
.data-table.erp-table thead th { color: var(--text); font-weight: 700; line-height: 20px; border-bottom: 1px solid var(--border-dark); }
.data-table.erp-table tbody tr:first-child td { padding-top: 8px; }
.erp-table-title { margin: 0 0 10px; font-size: 14px; font-weight: 600; }

/* 8. Toast d'alerte compact : ≤ 420 px, icône, titre gras + explication. Hôte dédié à droite
      (le #toast-container global est étroit et écraserait le texte sur 6 lignes). */
#erp-alert-host { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.erp-alert { display: flex; align-items: flex-start; gap: 10px; width: min(420px, calc(100vw - 32px)); box-sizing: border-box; pointer-events: auto; padding: 12px 16px 12px 14px; border-radius: 12px; background: var(--primary); color: #fff; box-shadow: 0 8px 24px rgba(61,70,84,.22); animation: toast-in .25s ease; }
.erp-alert .erp-alert-ico { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.erp-alert .erp-alert-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.erp-alert .erp-alert-text { font-size: 12.5px; font-weight: 400; line-height: 1.4; opacity: .92; margin-top: 2px; }
/* Cohabitation .card-header + .erp-chart-head (tuiles du tableau de bord) : l'en-tête de carte garde
   son gabarit (16/20, filet, justify space-between) et ne prend du primitif que le marqueur/titre. */
.card-header.erp-chart-head { padding: 12px 20px; margin: 0; min-height: 0; justify-content: space-between; border-bottom: 1px solid var(--border); }
.card-header.erp-chart-head h3 { font-size: 15px; }

/* Notifications sous l en-tete rouge (Maher 30/09/2026) : ne chevauchent plus l en-tete ni la barre de chargement */
body:has(.app-header) .toast-container,
body:has(.app-header) #erp-alert-host { top: calc(var(--header-height, 44px) + 50px); }

/* ── RÈGLE « filtres sur une ligne » (Maher, 01/10/2026) ──────────────────────
   Une barre de filtres tient sur UNE rangée tant que la largeur le permet : colonnes
   égales à minimum 120 px (au lieu de 160) qui se partagent toute la largeur, puis
   retour à la ligne seulement quand ça ne tient vraiment plus. À poser sur le
   conteneur des filtres : class="erp-toolbar erp-filtres" (un <div> par filtre). */
.erp-toolbar.erp-filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; align-items: end; }
.erp-toolbar.erp-filtres > * { min-width: 0; }
.erp-toolbar.erp-filtres .form-input { width: 100%; min-width: 0; }
.erp-toolbar.erp-filtres .form-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Filtres AG Grid : une seule icône de filtre (celle de l'en-tête), pas celle de la case (15/10/2026) */
.ag-floating-filter-button { display: none !important; }


/* Onglets : appui long 2,5 s (trait qui fait le tour de l'onglet) puis glisser pour déplacer (21/10/2026) */
@property --tab-hold { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.tab-item { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tab-item.tab-holding::after {
  content: ''; position: absolute; inset: -3px; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(#ffd166 var(--tab-hold), transparent 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: tab-hold-tour 2s linear 0.5s forwards;
}
@keyframes tab-hold-tour { to { --tab-hold: 360deg; } }
.tab-item.tab-dragging { box-shadow: 0 0 0 2px #ffd166, 0 6px 16px rgba(0,0,0,.25); transform: scale(1.06); cursor: grabbing; z-index: 5; }
.tab-bar-dragging { cursor: grabbing; touch-action: none; }

/* ── Boutons rouges : effet verre + reflet qui passe de gauche à droite toutes les 30 s (Maher 23/10/2026) ── */
.btn-primary {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28) 0%, rgba(255,255,255,.06) 48%, rgba(0,0,0,0) 52%),
    linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -1px 0 rgba(0,0,0,.12), 0 6px 16px -8px rgba(216,17,36,.55);
}
.btn-primary:hover {
  background:
    linear-gradient(180deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,.05) 48%, rgba(0,0,0,0) 52%),
    linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-20deg);
  animation: erp-btn-reflet 30s ease-in-out infinite;
}
@keyframes erp-btn-reflet {
  0%   { left: -60%; }
  4%   { left: 130%; }   /* passage ≈ 1,2 s */
  100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) { .btn-primary::after { animation: none; display: none; } }

/* ── Bulles rouges de bascule / onglet actif : même verre + reflet 30 s que les boutons rouges (Maher 23/10/2026) ──
   Une classe par page (historique) : toute nouvelle bulle rouge de ce genre s'ajoute à cette liste. */
:is(#bk-view-knob, .pcl-tabs button.on, .acs-tab.on, .dash-tile-size button.on, .dash-prio-opt.on, .ccx-tab-active, .cst-tab-active, .cg-tab-btn.cg-tab-active, .cfr-crop-seg button.active,
    .cre-tab-btn.cre-tab-active, .dm-tab-btn.dm-tab-active, .ech-tab-btn.ech-tab-active, .rmd-tab-btn.rmd-tab-active,
    .otv-tab.active, .oip-seg-btn.active, .ope-tab-active, .opd-unit-btn.active, .opi-tab.opi-active, .ops-tab-active,
    .wa-tab-active, .plh-tab.active, .vl-rav-sub.active, .vl-tab-btn.vl-tab-active) {
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -1px 0 rgba(0,0,0,.12), 0 1px 3px rgba(216,17,36,.35);
}
:is(.pcl-tabs button.on, .acs-tab.on, .dash-tile-size button.on, .dash-prio-opt.on, .ccx-tab-active, .cst-tab-active, .cg-tab-btn.cg-tab-active, .cfr-crop-seg button.active,
    .cre-tab-btn.cre-tab-active, .dm-tab-btn.dm-tab-active, .ech-tab-btn.ech-tab-active, .rmd-tab-btn.rmd-tab-active,
    .otv-tab.active, .oip-seg-btn.active, .ope-tab-active, .opd-unit-btn.active, .opi-tab.opi-active, .ops-tab-active,
    .wa-tab-active, .plh-tab.active, .vl-rav-sub.active, .vl-tab-btn.vl-tab-active) { position: relative; }
:is(#bk-view-knob, .pcl-tabs button.on, .acs-tab.on, .dash-tile-size button.on, .dash-prio-opt.on, .ccx-tab-active, .cst-tab-active, .cg-tab-btn.cg-tab-active, .cfr-crop-seg button.active,
    .cre-tab-btn.cre-tab-active, .dm-tab-btn.dm-tab-active, .ech-tab-btn.ech-tab-active, .rmd-tab-btn.rmd-tab-active,
    .otv-tab.active, .oip-seg-btn.active, .ope-tab-active, .opd-unit-btn.active, .opi-tab.opi-active, .ops-tab-active,
    .wa-tab-active, .plh-tab.active, .vl-rav-sub.active, .vl-tab-btn.vl-tab-active)::before {
  content: ""; position: absolute; inset: 0 0 50% 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.05));
}
:is(#bk-view-knob, .pcl-tabs button.on, .acs-tab.on, .dash-tile-size button.on, .dash-prio-opt.on, .ccx-tab-active, .cst-tab-active, .cg-tab-btn.cg-tab-active, .cfr-crop-seg button.active,
    .cre-tab-btn.cre-tab-active, .dm-tab-btn.dm-tab-active, .ech-tab-btn.ech-tab-active, .rmd-tab-btn.rmd-tab-active,
    .otv-tab.active, .oip-seg-btn.active, .ope-tab-active, .opd-unit-btn.active, .opi-tab.opi-active, .ops-tab-active,
    .wa-tab-active, .plh-tab.active, .vl-rav-sub.active, .vl-tab-btn.vl-tab-active)::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-20deg); animation: erp-btn-reflet 30s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  :is(#bk-view-knob, .pcl-tabs button.on, .acs-tab.on, .dash-tile-size button.on, .dash-prio-opt.on, .ccx-tab-active, .cst-tab-active, .cg-tab-btn.cg-tab-active, .cfr-crop-seg button.active,
      .cre-tab-btn.cre-tab-active, .dm-tab-btn.dm-tab-active, .ech-tab-btn.ech-tab-active, .rmd-tab-btn.rmd-tab-active,
      .otv-tab.active, .oip-seg-btn.active, .ope-tab-active, .opd-unit-btn.active, .opi-tab.opi-active, .ops-tab-active,
      .wa-tab-active, .plh-tab.active, .vl-rav-sub.active, .vl-tab-btn.vl-tab-active)::after { display: none; }
}

/* ── Barre latérale : page active + pastille de sa section, même verre + reflet 30 s (Maher 23/10/2026) ── */
.sidebar-nav li a.active, .sidebar-section:has(.sidebar-nav a.active) .sec-icon { position: relative; overflow: hidden; }
.sidebar-nav li a.active { box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -1px 0 rgba(0,0,0,.12), 0 6px 14px -6px rgba(216,17,36,.5); }
.sidebar-nav li a.active::before, .sidebar-section:has(.sidebar-nav a.active) .sec-icon::before {
  content: ""; position: absolute; inset: 0 0 50% 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.05));
}
.sidebar-nav li a.active::after, .sidebar-section:has(.sidebar-nav a.active) .sec-icon::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-20deg); animation: erp-btn-reflet 30s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-nav li a.active::after, .sidebar-section:has(.sidebar-nav a.active) .sec-icon::after { display: none; }
}
