/* ==========================================================================
   MICROFIN-SOFT / SOMIK-MF - Design system
   --------------------------------------------------------------------------
   Portee :
   - Coque applicative (barre haute, menu lateral, pied) : styles globaux,
     toutes les pages y compris les tableaux de bord.
   - Contenu (cartes, tables, formulaires, boutons, modales, pagination) :
     styles portes par « body.app-ui », pose par views/include/header.php sauf
     sur dashboard/* et credit/credit.portefeuille.

   Le theme est porte par <html data-bs-theme="light|dark"> : c'est le
   mecanisme natif de Bootstrap 5.3, aucun systeme parallele n'est ajoute.
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   --------------------------------------------------------------------------
   Toute valeur de couleur, de rayon, d'ombre, d'espacement ou de duree est
   declaree ici. Aucun code hexadecimal ne doit apparaitre ailleurs, ni dans
   les feuilles de page, ni dans le HTML ou le PHP.

   Trois familles :
     --app-*   jetons canoniques du produit (les seuls a utiliser).
     --au-*    alias historiques : ils pointent sur les jetons canoniques et
               permettent au CSS deja ecrit de suivre la nouvelle palette
               sans duplication.
     --bs-*    pont vers Bootstrap : ses composants heritent du systeme.
   ========================================================================== */

:root {
  /* ---- Marque ---------------------------------------------------------- */
  --app-primary: #20B879;          /* vert SOMIK-MF : accent, actifs, indicateurs */
  --app-primary-hover: #179A64;
  --app-primary-active: #117A50;
  --app-accent: #B8D957;           /* vert clair : appuis graphiques */
  --app-gold: #D7B653;             /* or : distinctions, vigilance */
  --app-brand-dark: #063C2B;       /* vert profond : panneau de marque */
  --app-brand-darker: #03291E;

  /* Aplat vert portant du texte blanc : assombri pour rester lisible
     (WCAG AA, 5.3:1 contre le blanc). --app-primary reste l'accent. */
  --app-primary-solid: #117A50;
  --app-primary-solid-hover: #0E6845;

  /* ---- Etats ----------------------------------------------------------- */
  --app-success: #20B879;
  --app-warning: #D7B653;
  --app-danger: #D95C5C;
  --app-info: #4BA3B7;

  /* ---- Surfaces (mode clair) ------------------------------------------- */
  --app-bg: #F7F9F8;               /* fond de page */
  --app-surface: #FFFFFF;          /* carte, modale, menu */
  --app-surface-2: #F1F5F3;        /* zone calme : entete de table, pied */
  --app-surface-3: #E9EFEC;        /* appui : survol marque, jauge */
  --app-surface-hover: rgba(16, 42, 58, 0.035);

  /* ---- Texte (mode clair) ---------------------------------------------- */
  --app-text: #102A3A;
  --app-text-secondary: #5E6D75;
  --app-text-muted: #87939A;
  --app-text-on-primary: #FFFFFF;
  --app-text-on-brand: #FFFFFF;

  /* ---- Filets et saisie (mode clair) ----------------------------------- */
  --app-border: #DCE5E1;
  --app-border-strong: #C4D2CB;
  --app-input-bg: #FFFFFF;
  --app-input-border: #D6E0DC;

  /* ---- Teintes douces des etats (mode clair) --------------------------- */
  --app-primary-soft: #E5F6EE;
  --app-primary-soft-text: #0D6342;
  --app-primary-soft-border: #C4E8D6;

  --app-success-soft: #E5F6EE;
  --app-success-text: #0D6342;
  --app-success-border: #C4E8D6;

  --app-warning-soft: #FBF3DF;
  --app-warning-text: #7A6320;
  --app-warning-border: #EEDFB2;

  --app-danger-soft: #FBEAEA;
  --app-danger-text: #9E3131;
  --app-danger-border: #F2CFCF;

  --app-info-soft: #E6F2F5;
  --app-info-text: #2A6C7C;
  --app-info-border: #C7E1E8;

  --app-gold-soft: #FAF3E0;
  --app-gold-text: #7A6320;
  --app-gold-border: #EEDFB2;

  /* ---- Coque (mode clair) ---------------------------------------------- */
  --app-topbar-bg: #FFFFFF;
  --app-sidebar-bg: #FFFFFF;
  --app-sidebar-text: #5E6D75;
  --app-sidebar-text-2: #87939A;
  --app-sidebar-faint: #9AA6AC;
  --app-sidebar-hover: rgba(16, 42, 58, 0.045);
  --app-sidebar-active-bg: #E5F6EE;
  --app-sidebar-active-text: #0D6342;
  --app-sidebar-line: #E4EBE7;

  /* Panneau de marque : degrade vert profond, halo tres discret */
  --app-brand-fill:
    radial-gradient(90% 70% at 12% 8%, rgba(32, 184, 121, 0.22), rgba(32, 184, 121, 0) 62%),
    linear-gradient(158deg, #0A4C36 0%, #063C2B 52%, #03291E 100%);

  /* Voile pose sur la photographie du panneau de connexion : dense a gauche,
     transparent en bas a droite pour laisser la photographie respirer. */
  --app-brand-veil:
    linear-gradient(100deg,
      rgba(3, 41, 30, 0.62) 0%,
      rgba(3, 41, 30, 0.34) 42%,
      rgba(3, 41, 30, 0.08) 76%,
      rgba(3, 41, 30, 0) 100%);

  /* ---- Elevation ------------------------------------------------------- */
  /* Vague de marque de la composition mobile */
  --app-wave-back: #EAF6EF;
  --app-wave-front: #D8EFE2;
  --app-wave-text: #0D6342;

  --app-shadow-xs: 0 1px 2px rgba(16, 42, 58, 0.05);
  --app-shadow-sm: 0 1px 3px rgba(16, 42, 58, 0.07), 0 1px 2px rgba(16, 42, 58, 0.04);
  --app-shadow-md: 0 6px 18px rgba(16, 42, 58, 0.09);
  --app-shadow-lg: 0 18px 44px rgba(16, 42, 58, 0.14);
  --app-shadow-primary: 0 2px 6px rgba(17, 122, 80, 0.22);

  /* ---- Etats d'interaction --------------------------------------------- */
  --app-focus-ring: 0 0 0 3px rgba(32, 184, 121, 0.28);
  --app-disabled-bg: #F1F5F3;
  --app-disabled-text: #A7B2B7;

  /* ---- Geometrie ------------------------------------------------------- */
  --app-radius-sm: 6px;
  --app-radius: 8px;
  --app-radius-lg: 12px;
  --app-radius-xl: 16px;
  --app-radius-pill: 999px;

  --app-space-1: 4px;
  --app-space-2: 8px;
  --app-space-3: 12px;
  --app-space-4: 16px;
  --app-space-5: 24px;
  --app-space-6: 32px;
  --app-space-7: 48px;

  /* ---- Dimensions des composants --------------------------------------- */
  --app-control-h: 42px;           /* champ et bouton : hauteur commune */
  --app-control-h-sm: 34px;
  --app-control-px: 14px;
  --app-btn-px: 18px;
  --app-topbar-h: 62px;
  --app-sidebar-w: 268px;
  --app-sidebar-w-mini: 76px;
  --app-tap: 44px;                 /* zone tactile minimale */

  /* Densite des tableaux */
  --app-cell-py: 13px;
  --app-cell-px: 14px;
  --app-cell-py-dense: 9px;

  /* ---- Typographie ------------------------------------------------------ */
  --app-font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui,
              -apple-system, "Helvetica Neue", Arial, sans-serif;
  --app-font-mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas, monospace;

  --app-fs-h1: 32px;
  --app-fs-h2: 25px;
  --app-fs-h3: 19px;
  --app-fs-body: 14.5px;
  --app-fs-label: 13.5px;
  --app-fs-small: 13px;
  --app-fs-tiny: 11.5px;

  --app-lh-tight: 1.25;
  --app-lh-body: 1.55;

  /* ---- Mouvement -------------------------------------------------------- */
  --app-ease: cubic-bezier(0.2, 0, 0.2, 1);
  --app-dur-fast: 150ms;
  --app-dur: 200ms;
  --app-dur-slow: 250ms;
  --app-transition: var(--app-dur) var(--app-ease);
}

/* ==========================================================================
   Mode sombre
   --------------------------------------------------------------------------
   Fonds vert-bleu tres sombres, jamais du noir pur. Le vert de marque est
   conserve : le mode sombre est une variante du meme produit.
   ========================================================================== */
[data-bs-theme="dark"] {
  --app-primary: #2ECB8A;
  --app-primary-hover: #45D69A;
  --app-primary-active: #22B277;
  --app-accent: #C6E36B;
  --app-gold: #E0C468;

  --app-primary-solid: #12855B;
  --app-primary-solid-hover: #17996A;

  --app-success: #2ECB8A;
  --app-warning: #E0C468;
  --app-danger: #E57373;
  --app-info: #5FB8CC;

  --app-bg: #08131B;
  --app-surface: #0D1B24;
  --app-surface-2: #12232D;
  --app-surface-3: #172A35;
  --app-surface-hover: rgba(255, 255, 255, 0.04);

  --app-text: #F2F7F5;
  --app-text-secondary: #AAB9BE;
  --app-text-muted: #74858C;

  --app-border: #263B46;
  --app-border-strong: #334A56;
  --app-input-bg: #0B1821;
  --app-input-border: #334A55;

  --app-primary-soft: rgba(46, 203, 138, 0.14);
  --app-primary-soft-text: #6EE0B0;
  --app-primary-soft-border: rgba(46, 203, 138, 0.32);

  --app-success-soft: rgba(46, 203, 138, 0.14);
  --app-success-text: #6EE0B0;
  --app-success-border: rgba(46, 203, 138, 0.32);

  --app-warning-soft: rgba(224, 196, 104, 0.14);
  --app-warning-text: #EED996;
  --app-warning-border: rgba(224, 196, 104, 0.32);

  --app-danger-soft: rgba(229, 115, 115, 0.14);
  --app-danger-text: #F0A3A3;
  --app-danger-border: rgba(229, 115, 115, 0.32);

  --app-info-soft: rgba(95, 184, 204, 0.14);
  --app-info-text: #9BD5E1;
  --app-info-border: rgba(95, 184, 204, 0.32);

  --app-gold-soft: rgba(224, 196, 104, 0.14);
  --app-gold-text: #EED996;
  --app-gold-border: rgba(224, 196, 104, 0.32);

  --app-topbar-bg: #0D1B24;
  --app-sidebar-bg: #0D1B24;
  --app-sidebar-text: #AAB9BE;
  --app-sidebar-text-2: #8B9BA1;
  --app-sidebar-faint: #74858C;
  --app-sidebar-hover: rgba(255, 255, 255, 0.05);
  --app-sidebar-active-bg: rgba(46, 203, 138, 0.14);
  --app-sidebar-active-text: #6EE0B0;
  --app-sidebar-line: #1B2E39;

  --app-brand-fill:
    radial-gradient(90% 70% at 12% 8%, rgba(32, 184, 121, 0.2), rgba(32, 184, 121, 0) 62%),
    linear-gradient(158deg, #0A3D2C 0%, #063122 52%, #03211A 100%);

  --app-brand-veil:
    linear-gradient(100deg,
      rgba(2, 26, 20, 0.8) 0%,
      rgba(2, 26, 20, 0.56) 42%,
      rgba(2, 26, 20, 0.3) 76%,
      rgba(2, 26, 20, 0.2) 100%);

  --app-wave-back: #0A4C36;
  --app-wave-front: #063C2B;
  --app-wave-text: #F2F7F5;

  --app-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --app-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --app-shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --app-shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.58);
  --app-shadow-primary: 0 2px 8px rgba(0, 0, 0, 0.45);

  --app-focus-ring: 0 0 0 3px rgba(46, 203, 138, 0.34);
  --app-disabled-bg: #12232D;
  --app-disabled-text: #667A82;

  color-scheme: dark;
}

/* ==========================================================================
   2. ALIAS HISTORIQUES
   --------------------------------------------------------------------------
   Le CSS deja ecrit s'appuie sur les jetons --au-* : ils sont ici rediriges
   vers les jetons canoniques. Aucune valeur n'est dupliquee, un seul endroit
   change la palette. A n'utiliser que pour l'existant ; tout nouveau style
   emploie --app-*.
   ========================================================================== */
:root {
  --au-brand-ink: var(--app-primary);
  --au-brand-gold: var(--app-gold);
  --au-brand-green: var(--app-success);
  --au-brand-red: var(--app-danger);
  --au-brand-warn: var(--app-warning);
  --au-brand-info: var(--app-info);

  --au-ink: var(--app-primary-solid);
  --au-ink-2: var(--app-primary-solid-hover);
  --au-ink-3: var(--app-brand-dark);
  --au-ink-soft: var(--app-primary-soft);
  --au-ink-text: var(--app-primary-soft-text);
  --au-ink-border: var(--app-primary-soft-border);

  --au-gold: var(--app-gold);
  --au-gold-soft: var(--app-gold-soft);
  --au-gold-text: var(--app-gold-text);
  --au-gold-border: var(--app-gold-border);

  --au-green: var(--app-success);
  --au-green-soft: var(--app-success-soft);
  --au-green-text: var(--app-success-text);
  --au-green-border: var(--app-success-border);
  --au-green-hover: var(--app-primary-hover);

  --au-red: var(--app-danger);
  --au-red-soft: var(--app-danger-soft);
  --au-red-text: var(--app-danger-text);
  --au-red-border: var(--app-danger-border);
  --au-red-hover: #C24E4E;

  --au-warn: var(--app-warning);
  --au-warn-soft: var(--app-warning-soft);
  --au-warn-text: var(--app-warning-text);
  --au-warn-border: var(--app-warning-border);
  --au-warn-hover: #C4A445;

  --au-info: var(--app-info);
  --au-info-soft: var(--app-info-soft);
  --au-info-text: var(--app-info-text);
  --au-info-border: var(--app-info-border);
  --au-info-hover: #3D8FA2;

  --au-paper: var(--app-bg);
  --au-card: var(--app-surface);
  --au-card-2: var(--app-surface);
  --au-surface-2: var(--app-surface-2);
  --au-soft: var(--app-surface-2);
  --au-hover: var(--app-surface-hover);
  --au-stripe: var(--app-surface-2);

  --au-heading: var(--app-text);
  --au-text: var(--app-text);
  --au-muted: var(--app-text-secondary);
  --au-faint: var(--app-text-muted);
  --au-on-brand: var(--app-text-on-brand);

  --au-line: var(--app-border);
  --au-line-strong: var(--app-border-strong);

  --au-topbar-bg: var(--app-topbar-bg);
  --au-sidebar-bg: var(--app-sidebar-bg);
  --au-sidebar-text: var(--app-sidebar-text);
  --au-sidebar-text-2: var(--app-sidebar-text-2);
  --au-sidebar-faint: var(--app-sidebar-faint);
  --au-sidebar-hover: var(--app-sidebar-hover);
  --au-sidebar-active: var(--app-sidebar-active-bg);
  --au-sidebar-line: var(--app-sidebar-line);

  --au-page-wash: var(--app-bg);

  --au-focus-ring: var(--app-focus-ring);
  --au-disabled-bg: var(--app-disabled-bg);
  --au-disabled-text: var(--app-disabled-text);

  --au-shadow-1: var(--app-shadow-xs);
  --au-shadow-2: var(--app-shadow-md);
  --au-shadow-3: var(--app-shadow-lg);
  --au-shadow-brand: var(--app-shadow-primary);
  --au-brand-fill: var(--app-brand-fill);

  --au-radius: var(--app-radius);
  --au-radius-lg: var(--app-radius-lg);
  --au-radius-pill: var(--app-radius-pill);
  --au-gap: var(--app-space-4);
  --au-header-h: var(--app-topbar-h);
  --au-sidebar-w: var(--app-sidebar-w);
  --au-sidebar-w-mini: var(--app-sidebar-w-mini);
  --au-tap: var(--app-tap);

  --au-font: var(--app-font);
  --au-fs-1: var(--app-fs-h3);
  --au-fs-2: var(--app-fs-body);
  --au-fs-3: var(--app-fs-small);
  --au-fs-4: var(--app-fs-tiny);

  --au-ease: var(--app-ease);
  --au-dur-1: var(--app-dur-fast);
  --au-dur-2: var(--app-dur);
  --au-dur-3: var(--app-dur-slow);
}

/* ==========================================================================
   3. PONT VERS BOOTSTRAP 5.3
   --------------------------------------------------------------------------
   Bootstrap pilote ses composants par ses propres variables. On les relie aux
   jetons du produit : tables, listes deroulantes, modales, champs, alertes et
   boutons suivent le systeme sans surcharge regle par regle. Le mode sombre
   natif de Bootstrap est deja gere par data-bs-theme.
   ========================================================================== */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-primary: var(--app-primary-solid);
  --bs-primary-rgb: 17, 122, 80;
  --bs-success: var(--app-success);
  --bs-danger: var(--app-danger);
  --bs-warning: var(--app-warning);
  --bs-info: var(--app-info);

  --bs-body-font-family: var(--app-font);
  --bs-body-font-size: var(--app-fs-body);
  --bs-body-line-height: var(--app-lh-body);
  --bs-body-color: var(--app-text);
  --bs-body-bg: var(--app-bg);
  --bs-emphasis-color: var(--app-text);
  --bs-secondary-color: var(--app-text-secondary);
  --bs-tertiary-color: var(--app-text-muted);
  --bs-secondary-bg: var(--app-surface-2);
  --bs-tertiary-bg: var(--app-surface-2);
  --bs-border-color: var(--app-border);
  --bs-border-color-translucent: var(--app-border);
  --bs-border-radius: var(--app-radius);
  --bs-border-radius-sm: var(--app-radius-sm);
  --bs-border-radius-lg: var(--app-radius-lg);
  --bs-heading-color: var(--app-text);
  --bs-link-color: var(--app-primary-soft-text);
  --bs-link-hover-color: var(--app-primary-active);
  --bs-focus-ring-color: rgba(32, 184, 121, 0.28);

  --bs-table-color: var(--app-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--app-border);
  --bs-table-striped-color: var(--app-text);
  --bs-table-striped-bg: var(--app-surface-2);
  --bs-table-hover-color: var(--app-text);
  --bs-table-hover-bg: var(--app-surface-hover);
  --bs-table-active-color: var(--app-text);

  --bs-dropdown-color: var(--app-text);
  --bs-dropdown-bg: var(--app-surface);
  --bs-dropdown-border-color: var(--app-border);
  --bs-dropdown-link-color: var(--app-text);
  --bs-dropdown-link-hover-color: var(--app-primary-soft-text);
  --bs-dropdown-link-hover-bg: var(--app-surface-2);
  --bs-dropdown-link-active-color: var(--app-primary-soft-text);
  --bs-dropdown-link-active-bg: var(--app-primary-soft);
  --bs-dropdown-divider-bg: var(--app-border);
  --bs-dropdown-header-color: var(--app-text-secondary);
  --bs-dropdown-border-radius: var(--app-radius);

  --bs-modal-color: var(--app-text);
  --bs-modal-bg: var(--app-surface);
  --bs-modal-border-color: var(--app-border);
  --bs-modal-header-border-color: var(--app-border);
  --bs-modal-footer-border-color: var(--app-border);
  --bs-modal-border-radius: var(--app-radius-lg);

  --bs-card-color: var(--app-text);
  --bs-card-bg: var(--app-surface);
  --bs-card-border-color: var(--app-border);
  --bs-card-cap-bg: var(--app-surface-2);
  --bs-card-border-radius: var(--app-radius-lg);

  --bs-nav-tabs-border-color: var(--app-border);
  --bs-nav-link-color: var(--app-text-secondary);
  --bs-nav-link-hover-color: var(--app-primary-soft-text);

  --bs-tooltip-bg: var(--app-brand-dark);
  --bs-tooltip-color: var(--app-text-on-brand);

  --bs-offcanvas-bg: var(--app-surface);
  --bs-offcanvas-color: var(--app-text);
  --bs-offcanvas-border-color: var(--app-border);

  --bs-accordion-bg: var(--app-surface);
  --bs-accordion-border-color: var(--app-border);
  --bs-accordion-btn-color: var(--app-text);
  --bs-accordion-active-color: var(--app-primary-soft-text);
  --bs-accordion-active-bg: var(--app-primary-soft);

  --bs-pagination-color: var(--app-text-secondary);
  --bs-pagination-bg: var(--app-surface);
  --bs-pagination-border-color: var(--app-border);
  --bs-pagination-hover-color: var(--app-primary-soft-text);
  --bs-pagination-hover-bg: var(--app-surface-2);
  --bs-pagination-active-bg: var(--app-primary-solid);
  --bs-pagination-active-border-color: var(--app-primary-solid);
}

/* Les champs natifs suivent aussi le theme */
.app-ui select option { background: var(--app-surface); color: var(--app-text); }
.app-ui input[type="date"]::-webkit-calendar-picker-indicator,
.app-ui input[type="search"]::-webkit-search-cancel-button { filter: var(--app-icon-filter, none); }

[data-bs-theme="dark"] { --app-icon-filter: invert(1) opacity(0.65); }

/* Mouvement : respecte le reglage systeme */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   1. Coque applicative - globale (tableaux de bord inclus)
   ========================================================================== */

body {
  font-family: var(--au-font);
  /* Lavis tres discrets : evite les grandes zones blanches sans nuire aux chiffres */
  background: var(--au-page-wash);
  background-attachment: fixed;
  color: var(--au-text);
  -webkit-font-smoothing: antialiased;
}

/* -------- En-tete ------------------------------------------------------- */
#header.header {
  height: var(--au-header-h);
  background: var(--au-topbar-bg);
  border-bottom: 1px solid var(--au-line);
  box-shadow: none;
  padding-left: 16px;
  padding-right: 8px;
  z-index: 1002;
}

#header.header.header-scrolled {
  box-shadow: var(--au-shadow-1);
}

#header .logo {
  width: var(--au-sidebar-w);
  min-width: 0;
  padding-right: 12px;
}

#header .logo img {
  max-height: 34px;
  width: 34px;
  height: 34px;
  object-fit: cover;
  margin-right: 10px;
  border: 1px solid var(--au-line);
}

#header .logo span {
  font-family: var(--au-font);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--au-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#header .toggle-sidebar-btn {
  font-size: 24px;
  color: var(--au-heading);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--au-radius);
  line-height: 1;
}

#header .toggle-sidebar-btn:hover {
  background: var(--au-ink-soft);
}

#header .header-nav .nav-profile {
  color: var(--au-text);
  font-size: var(--au-fs-3);
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--au-radius);
}

#header .header-nav .nav-profile:hover {
  background: var(--au-soft);
}

#header .header-nav .nav-profile img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 1px solid var(--au-line);
}

#header .header-nav .profile .dropdown-header h6,
#header .header-nav .profile .profile-name {
  color: var(--au-heading);
}

.dropdown-menu {
  border: 1px solid var(--au-line);
  border-radius: var(--au-radius);
  box-shadow: var(--au-shadow-2);
  font-size: var(--au-fs-3);
}

.dropdown-menu .dropdown-item {
  padding: 9px 16px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.dropdown-menu .dropdown-item:hover {
  background: var(--au-soft);
  color: var(--au-heading);
}

@media (max-width: 575px) {
  #header .logo span { display: none; }
  #header .logo { width: auto; }
}

/* -------- Menu lateral -------------------------------------------------- */
.sidebar {
  top: var(--au-header-h);
  width: var(--au-sidebar-w);
  padding: 14px 12px 28px;
  background: var(--au-sidebar-bg);
  box-shadow: none;
  border-right: 1px solid var(--au-sidebar-line);
  scrollbar-color: var(--au-sidebar-text-2) transparent;
  z-index: 1001;
}

.sidebar::-webkit-scrollbar { width: 6px; background-color: transparent; }
.sidebar::-webkit-scrollbar-thumb { background-color: var(--au-sidebar-text-2); border-radius: 3px; }

@media (max-width: 1199px) { .sidebar { left: calc(-1 * var(--au-sidebar-w)); } }

@media (min-width: 1200px) {
  #main, #footer { margin-left: var(--au-sidebar-w); }
  .toggle-sidebar #main, .toggle-sidebar #footer { margin-left: 0; }
  .toggle-sidebar .sidebar { left: calc(-1 * var(--au-sidebar-w)); }
}

.sidebar-nav .nav-item { margin-bottom: 2px; }

.sidebar-nav .nav-heading {
  color: var(--app-sidebar-faint);
  font-size: var(--app-fs-tiny);
  letter-spacing: 0.08em;
  margin: var(--app-space-4) 0 var(--app-space-1) 12px;
}

.sidebar-nav .nav-link,
.sidebar-nav .nav-link.collapsed {
  background: transparent;
  color: var(--app-sidebar-text);
  font-size: var(--app-fs-label);
  font-weight: 500;
  padding: 10px 12px;
  min-height: var(--app-tap);
  border-radius: var(--app-radius);
  border-left: 3px solid transparent;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease);
}

.sidebar-nav .nav-link i,
.sidebar-nav .nav-link.collapsed i {
  color: var(--app-sidebar-text-2);
  font-size: 17px;
  margin-right: 10px;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.collapsed:hover {
  background: var(--app-sidebar-hover);
  color: var(--app-text);
}

.sidebar-nav .nav-link:hover i { color: var(--app-text); }

.sidebar-nav .nav-link:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: -2px;
}

/* Etat actif : fond vert tres leger, texte vert, indicateur lateral discret */
.sidebar-nav .nav-link:not(.collapsed) {
  background: var(--app-sidebar-active-bg);
  color: var(--app-sidebar-active-text);
  font-weight: 600;
  border-left-color: var(--app-primary);
}

.sidebar-nav .nav-link:not(.collapsed) i { color: var(--app-primary); }

.sidebar-nav .nav-link .bi-chevron-down {
  margin-right: 0;
  font-size: 12px;
  transition: transform var(--app-dur) var(--app-ease);
}

.sidebar-nav .nav-content {
  padding: 2px 0 6px 12px;
  margin: 0 0 var(--app-space-1) 16px;
  border-left: 1px solid var(--app-sidebar-line);
}

.sidebar-nav .nav-content a {
  color: var(--app-sidebar-text);
  font-size: var(--app-fs-small);
  font-weight: 500;
  padding: 8px 10px;
  min-height: 38px;
  display: flex;
  align-items: center;
  border-radius: var(--app-radius-sm);
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease);
}

.sidebar-nav .nav-content a i {
  font-size: 6px;
  margin-right: 9px;
  color: var(--app-sidebar-faint);
  background-color: var(--app-sidebar-faint);
}

.sidebar-nav .nav-content a:hover {
  background: var(--app-sidebar-hover);
  color: var(--app-text);
}

.sidebar-nav .nav-content a:hover i { color: var(--app-primary); background-color: var(--app-primary); }

.sidebar-nav .nav-content a:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: -2px;
}

.sidebar-nav .nav-content a.active {
  background: var(--app-sidebar-active-bg);
  color: var(--app-sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--app-primary);
}

.sidebar-nav .nav-content a.active i { color: var(--app-primary); background-color: var(--app-primary); }

/* Voile mobile derriere le menu lateral */
.app-backdrop {
  position: fixed;
  inset: var(--au-header-h) 0 0 0;
  background: rgba(4, 8, 20, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 1000;
}

@media (max-width: 1199px) {
  .toggle-sidebar .app-backdrop { opacity: 1; visibility: visible; }
  .toggle-sidebar { overflow: hidden; }
}

/* -------- Zone principale et pied --------------------------------------- */
#main { margin-top: var(--au-header-h); padding: 22px 28px 40px; }

@media (max-width: 1199px) { #main { padding: 18px 16px 32px; } }
@media (max-width: 575px) { #main { padding: 14px 12px 28px; } }

#footer.footer {
  background: transparent;
  border-top: 1px solid var(--au-line);
  padding: 16px 28px;
  font-size: var(--au-fs-4);
  color: var(--au-muted);
  box-shadow: none;
}

#footer.footer .copyright { color: var(--au-muted); }
#footer.footer strong span { color: var(--au-heading); }

.back-to-top {
  background: var(--au-ink);
  border-radius: var(--au-radius);
  width: 42px;
  height: 42px;
}

.back-to-top:hover { background: var(--au-ink-2); }

/* -------- Titre de page + fil d'Ariane ---------------------------------- */
.pagetitle {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--au-line-strong);
}

.pagetitle h1 {
  font-family: var(--au-font);
  font-size: var(--au-fs-1);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--au-heading);
  margin-bottom: 4px;
}

.pagetitle .breadcrumb {
  font-size: var(--au-fs-4);
  background: transparent;
  margin: 0;
  padding: 0;
}

.pagetitle .breadcrumb a { color: var(--au-muted); }
.pagetitle .breadcrumb a:hover { color: var(--au-heading); text-decoration: underline; }
.pagetitle .breadcrumb .active { color: var(--au-text); font-weight: 600; }

@media (max-width: 575px) {
  .pagetitle h1 { font-size: 17px; }
}

/* Preloader */
#preloader { background: var(--au-paper); }

/* ==========================================================================
   2. Composants du contenu - portee « body.app-ui »
   ========================================================================== */

/* Couleurs par defaut des liens et titres, a specificite minimale grace a
   :where() : elles l'emportent encore sur style.css (charge avant), mais
   plus sur la couleur propre d'un composant. Auparavant, « .app-ui a »
   noircissait le texte des liens-boutons verts (.cm-ajout, .dash-action...)
   et les passait en vert sur vert au survol ; « .app-ui h2 » noircissait
   les titres poses sur un fond de marque. */
:where(.app-ui) a { color: var(--au-heading); }
:where(.app-ui) a:hover { color: var(--au-ink-2); }

:where(.app-ui) :is(h1, h2, h3, h4, h5, h6) { font-family: var(--au-font); color: var(--au-heading); }

/* -------- Cartes -------------------------------------------------------- */
.app-ui .card {
  background: linear-gradient(180deg, var(--au-card) 0%, var(--au-card-2) 55%, var(--au-surface-2) 100%);
  border: 1px solid var(--au-line);
  border-radius: var(--au-radius);
  box-shadow: var(--au-shadow-1);
  margin-bottom: var(--au-gap);
}

.app-ui .card-header {
  background: linear-gradient(180deg, var(--au-card) 0%, var(--au-surface-2) 100%);
  border-bottom: 1px solid var(--au-line);
  padding: 12px 18px;
  font-size: var(--au-fs-3);
  font-weight: 600;
  color: var(--au-heading);
}

.app-ui .card-footer {
  background: var(--au-card);
  border-top: 1px solid var(--au-line);
  padding: 12px 18px;
  color: var(--au-muted);
  font-size: var(--au-fs-4);
}

.app-ui .card-body { padding: 16px 18px 18px; }

.app-ui .card-title {
  font-family: var(--au-font);
  font-size: var(--au-fs-2);
  font-weight: 600;
  color: var(--au-heading);
  padding: 4px 0 14px;
  margin: 0;
}

.app-ui .card-title span {
  color: var(--au-heading);
  font-size: var(--au-fs-2);
  font-weight: 600;
}

/* -------- Barre d'outils (recherche + actions) -------------------------- */
.app-ui .au-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0 0 14px;
  margin: 0;
}

.app-ui .au-toolbar__title {
  font-size: var(--au-fs-2);
  font-weight: 600;
  color: var(--au-heading);
  margin: 0;
  flex: 0 0 auto;
  max-width: 100%;
}

.app-ui .au-toolbar__search {
  flex: 1 1 260px;
  min-width: 200px;
  max-width: 420px;
}

.app-ui .au-toolbar__actions {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.app-ui .au-toolbar__banner { flex: 1 1 100%; order: -1; }
.app-ui .au-toolbar__banner .alert { margin-bottom: 0; }

@media (max-width: 767px) {
  .app-ui .au-toolbar { gap: 8px; }
  .app-ui .au-toolbar__title { flex: 1 1 100%; }
  .app-ui .au-toolbar__search { flex: 1 1 100%; max-width: none; }
  .app-ui .au-toolbar__actions { flex: 1 1 100%; margin-left: 0; }
  .app-ui .au-toolbar__actions > .btnPage,
  .app-ui .au-toolbar__actions > .btn { flex: 1 1 auto; justify-content: center; }
}


/* Champ de recherche */
.app-ui .au-search { position: relative; display: block; }

.app-ui .au-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--au-muted);
  font-size: 14px;
  pointer-events: none;
  line-height: 1;
}

.app-ui .au-search input.form-control {
  height: var(--au-tap);
  padding-left: 34px;
  padding-right: 38px;
  font-size: var(--au-fs-3);
  border-radius: var(--au-radius);
}

.app-ui .au-search__clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--au-muted);
  border-radius: var(--au-radius);
  cursor: pointer;
  padding: 0;
}

.app-ui .au-search__clear:hover { background: var(--au-soft); color: var(--au-red); }
.app-ui .au-search.is-filled .au-search__clear { display: flex; }

/* -------- Champ de recherche d'un panneau ------------------------------- */
/* Un seul dessin pour toute l'application. Les classes .cm-, .mmc- et .pa-
   sont des alias historiques : elles restent dans les gabarits, mais elles
   ne portent plus leur propre geometrie, ce qui laissait l'icone collee au
   texte sur les ecrans les plus recents. */
.app-recherche,
.cm-recherche,
.mmc-recherche,
.pa-recherche {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 240px;
  min-width: 180px;
  margin: 0;
}

/* Centrage vertical explicite : dans un conteneur flex, un element en
   position absolue se cale sur le haut du bloc, pas sur son milieu. */
.app-recherche > i,
.cm-recherche > i,
.mmc-recherche > i,
.pa-recherche > i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: block;
  width: 16px;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  color: var(--app-text-muted);
  pointer-events: none;
}

.app-recherche input,
.cm-recherche input,
.mmc-recherche input,
.pa-recherche input {
  width: 100%;
  min-width: 0;
  height: 36px;
  /* L'icone occupe 13 + 16 px : le texte commence apres, pas dessus. */
  padding: 0 12px 0 38px;
  border: 1px solid var(--app-input-border);
  border-radius: var(--app-radius);
  background: var(--app-input-bg);
  color: var(--app-text);
  font: inherit;
  font-size: var(--app-fs-small);
}

.app-recherche input::placeholder,
.cm-recherche input::placeholder,
.mmc-recherche input::placeholder,
.pa-recherche input::placeholder { color: var(--app-text-muted); }

.app-recherche input:focus,
.cm-recherche input:focus,
.mmc-recherche input:focus,
.pa-recherche input:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: var(--app-focus-ring);
}

/* La croix de la recherche native fait doublon avec nos boutons d'effacement */
.app-recherche input[type="search"]::-webkit-search-cancel-button,
.cm-recherche input[type="search"]::-webkit-search-cancel-button,
.mmc-recherche input[type="search"]::-webkit-search-cancel-button,
.pa-recherche input[type="search"]::-webkit-search-cancel-button { display: none; }

@media (max-width: 575.98px) {
  .app-recherche,
  .cm-recherche,
  .mmc-recherche,
  .pa-recherche { flex: 1 1 100%; }
}

/* -------- Formulaires --------------------------------------------------- */
.app-ui .form-label {
  font-size: var(--au-fs-4);
  font-weight: 600;
  color: var(--au-text);
  margin-bottom: 5px;
}

.app-ui .form-control,
.app-ui .form-select {
  min-height: var(--au-tap);
  font-size: var(--au-fs-3);
  color: var(--au-text);
  border: 1px solid var(--au-line-strong);
  border-radius: var(--au-radius);
  padding: 9px 12px;
  background-color: var(--au-card);
}

.app-ui textarea.form-control { min-height: 88px; }

.app-ui .form-control:focus,
.app-ui .form-select:focus {
  border-color: var(--au-ink-2);
  box-shadow: var(--au-focus-ring);
}

.app-ui .form-control::placeholder { color: var(--au-faint); }

.app-ui .form-control:disabled,
.app-ui .form-control[readonly],
.app-ui .form-select:disabled { background-color: var(--au-soft); color: var(--au-muted); }

.app-ui .input-group-text {
  background: var(--au-soft);
  border: 1px solid var(--au-line-strong);
  color: var(--au-muted);
  font-size: var(--au-fs-3);
}

.app-ui .form-text { font-size: 11.5px; color: var(--au-muted); }
.app-ui .invalid-feedback { font-size: 11.5px; }
.app-ui .form-check-label { font-size: var(--au-fs-3); }
.app-ui .form-check-input:checked { background-color: var(--au-ink); border-color: var(--au-ink); }
.app-ui .form-check-input:focus { border-color: var(--au-ink-2); box-shadow: var(--au-focus-ring); }

/* dselect : le declencheur est un <button>, il doit se lire comme un champ */
.app-ui button.form-select {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-ui .dselect-wrapper .form-control { min-height: var(--au-tap); }
.app-ui .dselect-wrapper .dropdown-menu { font-size: var(--au-fs-3); }

/* -------- Boutons ------------------------------------------------------- */
.app-ui .btnPage,
.app-ui .btnModSave,
.app-ui .btnModClose,
.app-ui .btnPageReturn,
.app-ui .btnParam,
.app-ui .btnHeader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--au-tap);
  padding: 9px 16px;
  font-family: var(--au-font);
  font-size: var(--au-fs-3);
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--au-radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-ui .btnPage,
.app-ui .btnModSave,
.app-ui .btnParam,
.app-ui .btnHeader {
  background: linear-gradient(180deg, var(--au-ink-2) 0%, var(--au-ink) 60%, var(--au-ink-3) 100%);
  border-color: var(--au-ink-3);
  color: var(--au-on-brand);
  box-shadow: var(--au-shadow-brand);
}

.app-ui .btnPage:hover,
.app-ui .btnModSave:hover,
.app-ui .btnParam:hover,
.app-ui .btnHeader:hover {
  background: linear-gradient(180deg, var(--au-ink-2) 0%, var(--au-ink-2) 60%, var(--au-ink) 100%);
  border-color: var(--au-ink-2);
  color: var(--au-on-brand);
  box-shadow: var(--au-shadow-2);
}

.app-ui .btnPage:disabled,
.app-ui .btnModSave:disabled { opacity: 0.55; cursor: not-allowed; }

.app-ui .btnModClose,
.app-ui .btnPageReturn {
  background: var(--au-card);
  border-color: var(--au-line-strong);
  color: var(--au-text);
}

.app-ui .btnModClose:hover,
.app-ui .btnPageReturn:hover {
  background: var(--au-soft);
  border-color: var(--au-muted);
  color: var(--au-heading);
}

.app-ui .btnPage i,
.app-ui .btnModSave i,
.app-ui .btnModClose i { font-size: 15px; line-height: 1; }

.app-ui .btn { font-size: var(--au-fs-3); border-radius: var(--au-radius); }

.app-ui .btn-sm {
  font-size: 12px;
  padding: 5px 10px;
  min-height: 32px;
  border-radius: var(--au-radius);
}

.app-ui .btn-primary { background: var(--au-ink); border-color: var(--au-ink); }
.app-ui .btn-primary:hover,
.app-ui .btn-primary:focus { background: var(--au-ink-2); border-color: var(--au-ink-2); }
.app-ui .btn-outline-primary { color: var(--au-heading); border-color: var(--au-line-strong); }
.app-ui .btn-outline-primary:hover { background: var(--au-ink); border-color: var(--au-ink); color: var(--au-on-brand); }
.app-ui .btn-secondary { background: var(--au-muted); border-color: var(--au-muted); }
.app-ui .btn-outline-secondary { color: var(--au-text); border-color: var(--au-line-strong); }
.app-ui .btn-outline-secondary:hover { background: var(--au-soft); border-color: var(--au-muted); color: var(--au-heading); }
.app-ui .btn-success { background: var(--au-green); border-color: var(--au-green); }
.app-ui .btn-success:hover { background: var(--au-green-hover); border-color: var(--au-green-hover); }
.app-ui .btn-danger { background: var(--au-red); border-color: var(--au-red); }
.app-ui .btn-danger:hover { background: var(--au-red-hover); border-color: var(--au-red-hover); }
.app-ui .btn-warning { background: var(--au-warn); border-color: var(--au-warn); color: var(--au-on-brand); }
.app-ui .btn-warning:hover { background: var(--au-warn-hover); border-color: var(--au-warn-hover); color: var(--au-on-brand); }
.app-ui .btn-info { background: var(--au-info); border-color: var(--au-info); color: var(--au-on-brand); }
.app-ui .btn-info:hover { background: var(--au-info-hover); border-color: var(--au-info-hover); color: var(--au-on-brand); }
.app-ui .btn-light { background: var(--au-card); border-color: var(--au-line-strong); color: var(--au-text); }
.app-ui .btn-light:hover { background: var(--au-soft); }

/* Groupe de boutons d'action dans les tables */
.app-ui .au-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* -------- Badges doux -------------------------------------------------- */
.app-ui .badge {
  font-family: var(--au-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.app-ui .badge.bg-primary,
.app-ui .badge.bg-dark { background: var(--au-ink-soft) !important; color: var(--au-heading) !important; border-color: var(--au-ink-border); }
.app-ui .badge.bg-success { background: var(--au-green-soft) !important; color: var(--au-green) !important; border-color: var(--au-green-border); }
.app-ui .badge.bg-danger { background: var(--au-red-soft) !important; color: var(--au-red) !important; border-color: var(--au-red-border); }
.app-ui .badge.bg-warning { background: var(--au-warn-soft) !important; color: var(--au-warn) !important; border-color: var(--au-warn-border); }
.app-ui .badge.bg-info { background: var(--au-info-soft) !important; color: var(--au-info) !important; border-color: var(--au-info-border); }
.app-ui .badge.bg-secondary,
.app-ui .badge.bg-light { background: var(--au-soft) !important; color: var(--au-muted) !important; border-color: var(--au-line); }

/* -------- Couleurs utilitaires Bootstrap ramenees a la palette ---------- */
.app-ui .text-primary { color: var(--au-heading) !important; }
.app-ui .text-danger { color: var(--au-red) !important; }
.app-ui .text-warning { color: var(--au-gold) !important; }
.app-ui .text-success { color: var(--au-green) !important; }
.app-ui .text-info { color: var(--au-info) !important; }

.app-ui .border-primary { border-color: var(--au-ink) !important; }
.app-ui .border-danger { border-color: var(--au-red) !important; }
.app-ui .border-warning { border-color: var(--au-gold) !important; }
.app-ui .border-success { border-color: var(--au-green) !important; }
.app-ui .border-info { border-color: var(--au-info) !important; }

/* Pastilles d'indicateur (cartes de synthese des rapports) */
.app-ui .card-icon {
  width: 54px;
  height: 54px;
  font-size: 25px;
  background: var(--au-ink-soft);
  color: var(--au-heading);
}

.app-ui .card-icon.bg-primary { background: var(--au-ink-soft) !important; color: var(--au-heading) !important; }
.app-ui .card-icon.bg-warning { background: var(--au-gold-soft) !important; color: var(--au-gold) !important; }
.app-ui .card-icon.bg-success { background: var(--au-green-soft) !important; color: var(--au-green) !important; }
.app-ui .card-icon.bg-danger { background: var(--au-red-soft) !important; color: var(--au-red) !important; }
.app-ui .card-icon.bg-info { background: var(--au-info-soft) !important; color: var(--au-info) !important; }

/* -------- Alertes ------------------------------------------------------- */
.app-ui .alert {
  border: 1px solid var(--au-line);
  border-left-width: 3px;
  border-radius: var(--au-radius);
  font-size: var(--au-fs-3);
  padding: 12px 16px;
}

.app-ui .alert-success { background: var(--au-green-soft); border-color: var(--au-green-border); border-left-color: var(--au-green); color: var(--au-green-text); }
.app-ui .alert-danger { background: var(--au-red-soft); border-color: var(--au-red-border); border-left-color: var(--au-red); color: var(--au-red-text); }
.app-ui .alert-warning { background: var(--au-warn-soft); border-color: var(--au-warn-border); border-left-color: var(--au-warn); color: var(--au-warn-text); }
.app-ui .alert-info { background: var(--au-info-soft); border-color: var(--au-info-border); border-left-color: var(--au-info); color: var(--au-info-text); }
.app-ui .alert-heading { font-family: var(--au-font); font-size: var(--au-fs-2); font-weight: 600; }

/* -------- Modales ------------------------------------------------------- */
.app-ui .modal-content {
  border: 0;
  border-radius: var(--au-radius-lg);
  overflow: hidden;
  box-shadow: var(--au-shadow-3);
}

.app-ui .modal-header {
  background: var(--au-brand-fill);
  border-bottom: 0;
  padding: 15px 20px;
  align-items: center;
}

.app-ui .modal-header .modal-title {
  color: var(--au-on-brand);
  font-family: var(--au-font);
  font-size: var(--au-fs-2);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-ui .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
  opacity: 0.85;
  background-size: 30%;
}

.app-ui .modal-header .btn-close:hover { opacity: 1; }

.app-ui .modal-body { padding: 20px; font-size: var(--au-fs-3); }

/* Plusieurs fenetres heritees enveloppent leur contenu dans une carte : le
   cadre, l'ombre et la marge se doublaient avec ceux de la fenetre. La carte
   imbriquee devient un simple conteneur. */
.app-ui .modal-body > .card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: visible;
}
.app-ui .modal-body > .card > .card-body { padding: 0; }

.app-ui .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--au-card);
  border-top: 1px solid var(--au-line);
  padding: 14px 20px;
  gap: 8px;
}

.app-ui .modal-footer > * { margin: 0; }

/* Pied de modale place dans le corps (cas frequent dans les vues) */
.app-ui .modal-body > form > .modal-footer,
.app-ui .modal-body > .modal-footer {
  margin: 20px -20px -20px;
  border-radius: 0;
}

.app-ui .modal-dialog-scrollable .modal-body { max-height: calc(100vh - 210px); }

/* Pied colle en bas d'un corps defilant : il couvre aussi la marge basse,
   sinon le contenu defile visiblement sous les boutons */
.app-ui .modal-dialog-scrollable .modal-body > form > .modal-footer,
.app-ui .modal-dialog-scrollable .modal-body > .modal-footer { bottom: -20px; }

/* Modales standard un peu plus larges : champs de saisie plus longs */
@media (min-width: 576px) {
  .app-ui .modal-dialog:not(.modal-sm):not(.modal-lg):not(.modal-xl) { max-width: 580px; }
}

@media (max-width: 575px) {
  .app-ui .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: 100%;
  }
  .app-ui .modal-content { border-radius: 0; min-height: 100vh; }
  .app-ui .modal-body { padding: 16px; }
  .app-ui .modal-body > form > .modal-footer,
  .app-ui .modal-body > .modal-footer { margin: 16px -16px -16px; }
  .app-ui .modal-dialog-scrollable .modal-body > form > .modal-footer,
  .app-ui .modal-dialog-scrollable .modal-body > .modal-footer { bottom: -16px; }
  .app-ui .modal-footer { flex-direction: column-reverse; padding: 12px 16px; }
  .app-ui .modal-footer > .btnModSave,
  .app-ui .modal-footer > .btnModClose,
  .app-ui .modal-footer > .btn { width: 100%; }
}

/* -------- Onglets defilants -------------------------------------------- */
.app-ui .nav-tabs,
.app-ui .nav-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--au-line);
  gap: 2px;
}

.app-ui .nav-tabs::-webkit-scrollbar,
.app-ui .nav-pills::-webkit-scrollbar { height: 4px; }
.app-ui .nav-tabs::-webkit-scrollbar-thumb,
.app-ui .nav-pills::-webkit-scrollbar-thumb { background: var(--au-line-strong); border-radius: 2px; }

.app-ui .nav-tabs .nav-link {
  white-space: nowrap;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--au-muted);
  font-size: var(--au-fs-3);
  font-weight: 600;
  padding: 10px 14px;
  min-height: var(--au-tap);
}

.app-ui .nav-tabs .nav-link:hover { color: var(--au-heading); border-bottom-color: var(--au-line-strong); }
.app-ui .nav-tabs .nav-link.active { color: var(--au-heading); background: transparent; border-bottom-color: var(--au-gold); }

/* Onglets pleine largeur au bureau, defilants sur mobile */
.app-ui .nav-tabs .nav-item { flex: 1 1 auto; min-width: 0; }

@media (max-width: 767px) {
  .app-ui .nav-tabs .nav-item { flex: 0 0 auto; }
  .app-ui .nav-tabs .nav-link { padding: 10px 12px; font-size: 12.5px; }
}

.app-ui .nav-pills { border-bottom: 0; }
.app-ui .nav-pills .nav-link { white-space: nowrap; color: var(--au-muted); font-size: var(--au-fs-3); font-weight: 600; }
.app-ui .nav-pills .nav-link.active { background: var(--au-ink); color: var(--au-on-brand); }

/* -------- Tables (mode bureau) ------------------------------------------ */
.app-ui .table {
  font-size: var(--au-fs-3);
  color: var(--au-text);
  margin-bottom: 0;
  border-color: var(--au-line);
  font-variant-numeric: tabular-nums lining-nums;
  vertical-align: middle;
}

.app-ui .table > thead > tr > th {
  background: var(--au-soft);
  color: var(--au-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--au-line-strong);
  vertical-align: middle;
}

.app-ui .table > tbody > tr > td { padding: 10px 12px; border-color: var(--au-line); }
.app-ui .table > tbody > tr:hover > td { background-color: var(--au-hover); }
.app-ui .table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: transparent; box-shadow: none; }
.app-ui .table-striped > tbody > tr:nth-of-type(even) > * { background-color: var(--au-stripe); }
.app-ui .table th[data-sortable], .app-ui .table th.sortable { cursor: pointer; user-select: none; }
.app-ui .table th.sorting_asc, .app-ui .table th.sorting_desc { color: var(--au-heading); }

.app-ui .table-responsive { border-radius: var(--au-radius); }

/* Montant sorti d'un bloc colore : chiffres nus */
.app-ui .table .au-figure {
  display: inline;
  padding: 0;
  background: none !important;
  color: var(--au-text) !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}

.app-ui .au-empty {
  text-align: center;
  color: var(--au-muted);
  padding: 28px 12px;
  font-size: var(--au-fs-3);
}

/* Sous-table (tables enfants du DataLoader) */
.app-ui .child-table-container {
  background: var(--au-soft) !important;
  border-top: 1px solid var(--au-line);
  border-radius: 0 0 var(--au-radius) var(--au-radius);
  padding: 14px 16px !important;
}

.app-ui .child-table-container h6 {
  font-size: var(--au-fs-3);
  font-weight: 600;
  color: var(--au-heading);
}

/* ==========================================================================
   3. Tables en cartes (< 992px)
   ========================================================================== */
@media screen and (max-width: 991.98px) {
  .app-ui table.au-cards {
    border: 0;
    background: transparent;
  }

  .app-ui table.au-cards > thead { display: none; }

  .app-ui table.au-cards,
  .app-ui table.au-cards > tbody,
  .app-ui table.au-cards > tbody > tr,
  .app-ui table.au-cards > tbody > tr > td { display: block; width: 100%; }

  .app-ui table.au-cards > tbody > tr {
    position: relative;
    background: var(--au-card);
    border: 1px solid var(--au-line);
    border-radius: var(--au-radius);
    margin-bottom: 10px;
    padding: 10px 12px 6px;
    box-shadow: var(--au-shadow-1);
  }

  .app-ui table.au-cards > tbody > tr:hover > td { background: transparent; }
  .app-ui table.au-cards.table-striped > tbody > tr:nth-of-type(even) > * { background-color: transparent; }

  .app-ui table.au-cards > tbody > tr > td {
    border: 0;
    border-bottom: 1px dashed var(--au-line);
    padding: 7px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
    min-height: 0;
    background: transparent;
  }

  .app-ui table.au-cards > tbody > tr > td:last-child { border-bottom: 0; }

  .app-ui table.au-cards > tbody > tr > td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    max-width: 45%;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--au-muted);
    padding-top: 2px;
  }

  .app-ui table.au-cards > tbody > tr > td:not([data-label])::before { content: none; }

  /* Cellule d'index : pastille en coin */
  .app-ui table.au-cards > tbody > tr > td.au-cell-index {
    position: absolute;
    top: 10px;
    right: 12px;
    width: auto;
    padding: 0;
    border: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--au-muted);
    display: block;
  }

  .app-ui table.au-cards > tbody > tr > td.au-cell-index::before { content: none; }

  /* Premiere cellule utile : titre de la carte */
  .app-ui table.au-cards > tbody > tr > td.au-cell-title {
    display: block;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    color: var(--au-heading);
    padding: 2px 44px 9px 0;
    border-bottom: 1px solid var(--au-line);
    margin-bottom: 2px;
  }

  .app-ui table.au-cards > tbody > tr > td.au-cell-title::before {
    display: block;
    flex: none;
    max-width: none;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 700;
  }

  /* Cellule d'actions : barre en pied de carte */
  .app-ui table.au-cards > tbody > tr > td.au-cell-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    text-align: left;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--au-line);
    border-bottom: 0;
  }

  .app-ui table.au-cards > tbody > tr > td.au-cell-actions::before { content: none; }
  .app-ui table.au-cards > tbody > tr > td.au-cell-actions .btn,
  .app-ui table.au-cards > tbody > tr > td.au-cell-actions .btnPage { min-height: 38px; }
  .app-ui table.au-cards > tbody > tr > td.au-cell-actions .au-actions { justify-content: flex-start; }

  /* Ligne « aucun enregistrement » / erreur : pas de mise en carte */
  .app-ui table.au-cards > tbody > tr.au-row-plain { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .app-ui table.au-cards > tbody > tr.au-row-plain > td { display: block; text-align: center; border: 0; }
  .app-ui table.au-cards > tbody > tr.au-row-plain > td::before { content: none; }

  /* Ligne technique (sous-table depliee) : pleine largeur */
  .app-ui table.au-cards > tbody > tr.au-row-child { padding: 0; border: 0; background: transparent; box-shadow: none; margin-bottom: 10px; }
  .app-ui table.au-cards > tbody > tr.au-row-child > td { display: block; padding: 0; border: 0; text-align: left; }
  .app-ui table.au-cards > tbody > tr.au-row-child > td::before { content: none; }

  .app-ui .table-responsive { overflow-x: visible; }
}

/* ==========================================================================
   4. Pagination numerotee
   ========================================================================== */
.app-ui .au-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--au-line);
}

.app-ui .au-pager__size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--au-fs-4);
  color: var(--au-muted);
  white-space: nowrap;
}

.app-ui .au-pager__size select {
  min-height: 36px;
  padding: 5px 26px 5px 10px;
  font-size: var(--au-fs-4);
  color: var(--au-text);
  border: 1px solid var(--au-line-strong);
  border-radius: var(--au-radius);
  background-color: var(--au-card);
  width: auto;
}

.app-ui .au-pager__count {
  font-size: var(--au-fs-4);
  color: var(--au-muted);
  font-variant-numeric: tabular-nums;
}

.app-ui .au-pager__count strong { color: var(--au-text); font-weight: 600; }

.app-ui .au-pager__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.app-ui .au-pager__btn {
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--au-fs-4);
  font-weight: 600;
  color: var(--au-text);
  background: var(--au-card);
  border: 1px solid var(--au-line-strong);
  border-radius: var(--au-radius);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font-variant-numeric: tabular-nums;
}

.app-ui .au-pager__btn:hover:not(:disabled):not(.is-active) {
  background: var(--au-soft);
  border-color: var(--au-muted);
  color: var(--au-heading);
}

.app-ui .au-pager__btn.is-active {
  background: var(--au-ink);
  border-color: var(--au-ink);
  color: var(--au-on-brand);
  cursor: default;
}

.app-ui .au-pager__btn:disabled { opacity: 0.4; cursor: not-allowed; }

.app-ui .au-pager__gap {
  min-width: 22px;
  text-align: center;
  color: var(--au-muted);
  font-size: var(--au-fs-4);
  user-select: none;
}

.app-ui .au-pager.is-hidden { display: none; }

@media (max-width: 767px) {
  .app-ui .au-pager { justify-content: center; gap: 8px 10px; }
  .app-ui .au-pager__size { order: 3; }
  .app-ui .au-pager__count { order: 1; flex: 1 1 100%; text-align: center; }
  .app-ui .au-pager__nav { order: 2; margin: 0 auto; }
  .app-ui .au-pager__btn.au-pager__num { display: none; }
  .app-ui .au-pager__btn.au-pager__num.is-active { display: inline-flex; }
  .app-ui .au-pager__gap { display: none; }
}

/* ==========================================================================   5. Page d'accueil : styles dans assets/css/app-home.css (charge par la vue)   ========================================================================== */
/* Pages qui chargent encore dashboard.css : neutraliser les degrades */
.app-ui .dashboard-welcome,
.app-ui .about-card .about-header {
  background: var(--au-ink);
  box-shadow: none;
  border-radius: var(--au-radius);
}

.app-ui .dashboard-welcome::before,
.app-ui .dashboard-welcome::after { display: none; }

.app-ui .about-card { border: 1px solid var(--au-line); border-radius: var(--au-radius); box-shadow: none; }
.app-ui .about-card .about-header { border-radius: var(--au-radius) var(--au-radius) 0 0; }
.app-ui .feature-item { background: var(--au-soft); border: 1px solid var(--au-line); border-left: 3px solid var(--au-ink); }
.app-ui .feature-item:hover { background: var(--au-ink-soft); border-left-color: var(--au-gold); }
.app-ui .feature-item .feature-icon { background: var(--au-ink-soft); color: var(--au-heading); }
.app-ui .feature-item:hover .feature-icon { background: var(--au-gold-soft); color: var(--au-gold); }
.app-ui .stat-card { border: 1px solid var(--au-line); border-radius: var(--au-radius); box-shadow: none; }

/* Panneaux « db-* » de caisse.central, paiement et certains rapports */
.app-ui .db-section-header { gap: 10px; margin-bottom: 14px; }
.app-ui .db-section-header .section-icon {
  width: 34px; height: 34px; border-radius: var(--au-radius);
  background: var(--au-brand-fill); color: var(--au-on-brand); font-size: 17px;
}
.app-ui .db-section-header h5 { font-size: var(--au-fs-2); font-family: var(--au-font); color: var(--au-heading); }
.app-ui .db-section-header h5 span { color: var(--au-muted); }

.app-ui .db-table-panel,
.app-ui .db-solde-card,
.app-ui .db-stats-panel,
.app-ui .db-transaction-card {
  border: 1px solid var(--au-line);
  border-radius: var(--au-radius);
  box-shadow: none;
}

.app-ui .db-solde-card:hover { transform: none; box-shadow: none; }
.app-ui .db-solde-card .solde-accent { height: 3px; background: var(--au-ink); }
.app-ui .db-solde-card.solde-cdf .solde-accent { background: var(--au-gold); }
.app-ui .db-solde-card .card-body { padding: 20px; }
.app-ui .db-solde-card .solde-label { font-size: 11px; color: var(--au-muted); }
.app-ui .db-solde-card .solde-value { font-size: 25px; color: var(--au-heading); font-variant-numeric: tabular-nums; }
.app-ui .db-solde-card .solde-date { color: var(--au-muted); }
.app-ui .db-solde-card .solde-icon { width: 52px; height: 52px; border-radius: var(--au-radius); font-size: 24px; }
.app-ui .db-solde-card .solde-icon-usd { background: var(--au-ink-soft); color: var(--au-heading); }
.app-ui .db-solde-card .solde-icon-cdf { background: var(--au-gold-soft); color: var(--au-gold); }

.app-ui .db-table-panel .table-header {
  background: var(--au-card);
  border-bottom: 1px solid var(--au-line);
  padding: 12px 18px;
}
.app-ui .db-table-panel .table-header i { color: var(--au-gold); font-size: 16px; }
.app-ui .db-table-panel .table-header h6 { color: var(--au-heading); font-size: var(--au-fs-3); }
.app-ui .db-table-panel .table-header h6 span { color: var(--au-muted); }
.app-ui .db-table-panel table thead th {
  background: var(--au-soft); color: var(--au-muted); font-size: 11px;
  padding: 10px 12px; border-bottom: 1px solid var(--au-line-strong);
}
.app-ui .db-table-panel table tbody td { padding: 10px 12px; font-size: var(--au-fs-3); color: var(--au-text); border-bottom-color: var(--au-line); }
.app-ui .db-table-panel table tbody tr:hover { background: var(--au-hover); }
.app-ui .db-table-panel .member-avatar { border-radius: var(--au-radius); background: var(--au-ink); }
.app-ui .db-table-panel .member-avatar.avatar-alt { background: var(--au-gold); }
.app-ui .db-table-panel .score-bar span { color: var(--au-heading); }

.app-ui .operation-badge-debit { background: var(--au-green-soft) !important; color: var(--au-green) !important; }
.app-ui .operation-badge-credit { background: var(--au-red-soft) !important; color: var(--au-red) !important; }
.app-ui .operation-badge-valide { background: var(--au-green-soft) !important; color: var(--au-green) !important; }
.app-ui .operation-badge-attente { background: var(--au-warn-soft) !important; color: var(--au-warn) !important; }

/* ==========================================================================
   6. Rapports - la feuille de registre
   --------------------------------------------------------------------------
   Les pages de rapport ne sont pas une pile de cartes : ce sont des extraits
   de registre. Une seule feuille reglee, des intercalaires en haut, un
   bordereau de criteres, puis l'extrait avec sa reglure, son rail de numeros
   et ses totaux soulignes d'un double filet (convention comptable).
   L'or ne sert qu'a marquer une chose a la fois : l'intercalaire actif et
   l'intitule de section.
   ========================================================================== */

.app-ui.au-report-page {
  --rg-filet: var(--au-line);
  --rg-filet-fort: var(--au-line-strong);
  --rg-rail: var(--au-soft);
}

/* La feuille : une seule surface reglee, sans ombre ni cartes imbriquees */
.app-ui .card.au-sheet {
  background: var(--au-card);
  border: 1px solid var(--rg-filet-fort);
  border-radius: 4px;
  box-shadow: none;
}

.app-ui .card.au-sheet > .card-body { padding: 0; }

/* -------- Intercalaires ------------------------------------------------- */
.app-ui .au-sheet .nav-tabs, .au-report-page .card .nav-tabs {
  gap: 0;
  padding: 0 6px;
  border-bottom: 1px solid var(--rg-filet-fort);
  background: linear-gradient(180deg, var(--au-surface-2) 0%, var(--au-soft) 100%);
}

/* Des intercalaires se suivent : ils ne s'etirent pas sur toute la largeur */
.au-report-page .nav-tabs .nav-item,
.au-report-page .nav-tabs .nav-item.flex-fill { flex: 0 0 auto !important; }
.au-report-page .nav-tabs .nav-link.w-100 { width: auto !important; }

.au-report-page .nav-tabs .nav-link {
  position: relative;
  top: 1px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  padding: 11px 16px;
  min-height: 42px;
  font-size: var(--au-fs-3);
  font-weight: 600;
  color: var(--au-muted);
  background: transparent;
}

.au-report-page .nav-tabs .nav-link:hover { color: var(--au-heading); background: var(--au-sidebar-text-2); }

.au-report-page .nav-tabs .nav-link.active {
  background: var(--au-card);
  border-color: var(--rg-filet-fort);
  border-top: 2px solid var(--au-gold);
  color: var(--au-heading);
  padding-top: 10px;
}

.au-report-page .tab-content { padding: 0; }

/* -------- Bordereau de criteres ----------------------------------------- */
.app-ui .au-filters {
  border: 0;
  border-bottom: 1px solid var(--rg-filet-fort);
  border-radius: 0;
  background: transparent;
  margin: 0;
}

.app-ui .au-filters__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px 0;
  background: transparent;
  border: 0;
}

.app-ui .au-filters__title {
  display: block;
  font-size: var(--au-fs-2);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--au-heading);
}

.app-ui .au-filters__title i { display: none; }

.app-ui .au-filters__count {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--au-gold);
  font-size: var(--au-fs-4);
  font-weight: 600;
}

.app-ui .au-filters__toggle {
  margin-left: auto;
  padding: 4px 0;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--au-muted);
  font-size: var(--au-fs-4);
  font-weight: 600;
}

.app-ui .au-filters__toggle:hover {
  background: transparent;
  color: var(--au-heading);
  border-bottom-color: var(--au-gold);
}

.app-ui .au-filters__body { padding: 12px 20px 0; }
.app-ui .au-filters.is-collapsed .au-filters__body { display: none; }

/* La grille de criteres : des colonnes separees par un filet, comme un bordereau */
.app-ui .au-filters__body form.row {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  border-top: 1px solid var(--rg-filet);
}

.app-ui .au-filters__body form.row > [class*="col-"] {
  padding: 12px 18px 12px 0;
  border-bottom: 1px solid var(--rg-filet);
}

.app-ui .au-filters .form-label {
  margin-bottom: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--au-muted);
}

.app-ui .au-filters .form-control,
.app-ui .au-filters .form-select,
.app-ui .au-filters button.form-select {
  min-height: 38px;
  padding: 7px 11px;
  border-color: var(--rg-filet-fort);
  border-radius: 4px;
  background-color: var(--au-card);
  font-size: var(--au-fs-3);
}

.app-ui .au-filters__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 0 -20px;
  padding: 14px 20px;
  background: transparent;
  border: 0;
  border-bottom: 0;
}

.app-ui .au-filters__actions .btnPage,
.app-ui .au-filters__actions .btnModClose { min-height: 40px; padding: 8px 18px; }

@media (max-width: 575px) {
  .app-ui .au-filters__head,
  .app-ui .au-filters__body { padding-left: 14px; padding-right: 14px; }
  .app-ui .au-filters__actions { margin: 0 -14px; padding: 12px 14px; }
  .app-ui .au-filters__actions > .btnPage,
  .app-ui .au-filters__actions > .btnModClose { flex: 1 1 auto; }
}

/* -------- Titre de l'extrait -------------------------------------------- */
.app-ui .au-report__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 20px;
  margin: 0;
  padding: 18px 20px 14px;
  background: transparent;
  border: 0;
  border-bottom: 3px double var(--rg-filet-fort);
  border-radius: 0;
}

.app-ui .au-report__ident { min-width: 0; }

.app-ui .au-report__title {
  display: block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--au-heading);
  line-height: 1.2;
}

.app-ui .au-report__meta {
  display: block;
  margin-top: 3px;
  font-size: var(--au-fs-3);
  color: var(--au-muted);
  font-variant-numeric: tabular-nums;
}

.app-ui .au-report__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.app-ui .au-report__actions .btnPage { min-height: 40px; padding: 8px 18px; }

@media (max-width: 575px) {
  .app-ui .au-report__bar { padding: 14px; }
  .app-ui .au-report__actions { margin-left: 0; flex: 1 1 100%; }
  .app-ui .au-report__actions > * { flex: 1 1 auto; }
}

/* -------- L'extrait ------------------------------------------------------ */
.app-ui .au-report__results { padding: 0 20px 20px; }

@media (max-width: 575px) { .app-ui .au-report__results { padding: 0 14px 16px; } }

/* Bandeau de chiffres : des colonnes separees par un filet, pas des tuiles */
.app-ui .au-report__results > .alert:first-child {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rg-filet-fort);
  padding: 0;
  margin: 0 0 18px;
  color: inherit;
  border-radius: 0;
}

.app-ui .au-report__results > .alert:first-child > .row {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  text-align: left !important;
}

.app-ui .au-report__results > .alert:first-child > .row > [class*="col-"] {
  flex: 1 1 170px;
  width: auto;
  max-width: none;
  padding: 14px 20px 16px 0;
  margin-right: 20px;
  border-right: 1px solid var(--rg-filet);
  font-size: 21px;
  font-weight: 700;
  color: var(--au-heading);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.app-ui .au-report__results > .alert:first-child > .row > [class*="col-"]:last-child {
  border-right: 0;
  margin-right: 0;
}

.app-ui .au-report__results > .alert:first-child > .row > [class*="col-"] strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--au-muted);
}

.app-ui .au-report__results > .alert:first-child > .row > [class*="col-"] small {
  display: inline;
  margin-left: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--au-muted) !important;
}

/* Sections de l'extrait : un intitule souligne d'or, pas une carte */
.app-ui .au-report__results .card {
  background: transparent;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
  margin: 0 0 26px;
}

.app-ui .au-report__results .card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: transparent !important;
  border: 0;
  border-bottom: 2px solid var(--au-gold);
  padding: 0 0 7px;
  margin-bottom: 0;
  color: var(--au-heading) !important;
  font-size: var(--au-fs-2);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-ui .au-report__results .card-header i { color: var(--au-gold); }

.app-ui .au-report__results .card-header .badge {
  background: transparent !important;
  border: 0;
  padding: 0;
  color: var(--au-muted) !important;
  font-size: var(--au-fs-4);
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.app-ui .au-report__results .card-body { padding: 0; }

/* La reglure */
.app-ui .au-report__results .table {
  margin: 0;
  border: 0;
  font-size: var(--au-fs-3);
}

.app-ui .au-report__results .table > thead > tr > th,
.app-ui .au-report__results thead.table-primary th,
.app-ui .au-report__results .table-primary > tr > th {
  background: transparent !important;
  color: var(--au-muted) !important;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 9px 12px;
  border: 0 !important;
  border-bottom: 1px solid var(--rg-filet-fort) !important;
}

.app-ui .au-report__results .table > tbody > tr > td {
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--rg-filet);
  background: transparent;
}

.app-ui .au-report__results .table > tbody > tr:hover > td { background: var(--au-hover); }
.app-ui .au-report__results .table-striped > tbody > tr:nth-of-type(even) > * { background-color: transparent; }

/* Rail des numeros de ligne (uniquement quand la table reste une table) */
@media screen and (min-width: 992px) {
  .app-ui .au-report__results .table > thead > tr > th:first-child,
  .app-ui .au-report__results .table > tbody > tr > td:first-child {
    width: 46px;
    text-align: center;
    background: var(--rg-rail);
    border-right: 1px solid var(--rg-filet);
    color: var(--au-muted);
    font-size: 12px;
  }
}

/* Totaux : double filet, jamais un bandeau colore */
.app-ui .au-report__results .table tfoot td,
.app-ui .au-report__results .table tfoot th {
  background: transparent;
  border: 0;
  border-top: 3px double var(--rg-filet-fort);
  padding: 10px 12px;
  font-weight: 700;
  color: var(--au-heading);
}

.app-ui .au-report__results .table td { font-variant-numeric: tabular-nums lining-nums; }

/* Pagination de l'extrait : la barre commune, posee sous le tableau */
.app-ui .au-report__results tr.au-row-hidden { display: none !important; }

.app-ui .au-report__pager .au-pager {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--rg-filet);
}

/* Pied de section : arrete des comptes */
.app-ui .au-report__results > .d-flex:last-child {
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  padding: 12px 0 0;
  border-top: 3px double var(--rg-filet-fort);
  background: transparent;
  font-size: var(--au-fs-4);
  color: var(--au-muted);
}

.app-ui .au-report__results > .d-flex:last-child small { font-size: var(--au-fs-4); }

/* Rien a etablir : une feuille reglee mais vierge */
.app-ui .au-report__results > .alert-info:only-child {
  display: block;
  padding: 44px 20px;
  text-align: center;
  color: var(--au-muted);
  font-size: var(--au-fs-3);
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, var(--rg-filet) 27px 28px);
  border: 1px solid var(--rg-filet);
  border-radius: 3px;
}

.app-ui .au-report__results > .alert-danger:only-child {
  display: block;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--au-red-border);
  border-left: 3px solid var(--au-red);
  background: var(--au-red-soft);
  color: var(--au-red-text);
  border-radius: 3px;
}

/* Chargement */
.app-ui .au-report__results > .text-center.p-4 { padding: 44px 20px !important; color: var(--au-muted); }


/* ==========================================================================
   8. Coque : recherche globale, alertes, bascule de theme, menu reduit
   ========================================================================== */

/* -------- Bouton icone de la barre superieure --------------------------- */
.au-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--au-radius);
  background: transparent;
  color: var(--au-muted);
  font-size: 17px;
  cursor: pointer;
  transition: background var(--au-dur-1) var(--au-ease),
              color var(--au-dur-1) var(--au-ease),
              border-color var(--au-dur-1) var(--au-ease);
}

.au-icon-btn:hover,
.au-icon-btn[aria-expanded="true"] {
  background: var(--au-ink-soft);
  border-color: var(--au-ink-border);
  color: var(--au-ink-text);
}

.au-icon-btn__count {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--au-radius-pill);
  background: var(--app-danger);
  color: var(--app-text-on-primary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* -------- Recherche globale --------------------------------------------- */
.au-search-global {
  position: relative;
  flex: 1 1 320px;
  max-width: 420px;
  margin-left: 18px;
}

.au-search-global__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--au-faint);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.au-search-global__input {
  width: 100%;
  height: 38px;
  padding: 8px 62px 8px 34px;
  font-family: inherit;
  font-size: var(--au-fs-3);
  color: var(--au-text);
  background: var(--au-soft);
  border: 1px solid transparent;
  border-radius: var(--au-radius);
  transition: background var(--au-dur-1) var(--au-ease),
              border-color var(--au-dur-1) var(--au-ease),
              box-shadow var(--au-dur-1) var(--au-ease);
}

.au-search-global__input::placeholder { color: var(--au-faint); }

.au-search-global__input:focus {
  outline: none;
  background: var(--au-card);
  border-color: var(--au-ink-2);
  box-shadow: var(--au-focus-ring);
}

.au-search-global__kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border: 1px solid var(--au-line-strong);
  border-radius: 4px;
  background: var(--au-card);
  color: var(--au-faint);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
}

.au-search-global__input:focus ~ .au-search-global__kbd { display: none; }

.au-search-global__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1003;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  background: var(--au-card);
  border: 1px solid var(--au-line);
  border-radius: var(--au-radius);
  box-shadow: var(--au-shadow-2);
}

.au-search-global__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--au-radius);
  color: var(--au-text);
  font-size: var(--au-fs-3);
  text-decoration: none;
  cursor: pointer;
}

.au-search-global__item i { color: var(--au-gold); font-size: 15px; flex: 0 0 auto; }
.au-search-global__item small { margin-left: auto; color: var(--au-muted); font-size: 11.5px; }
.au-search-global__item:hover,
.au-search-global__item.is-active { background: var(--au-ink-soft); color: var(--au-ink-text); }
.au-search-global__item mark { background: var(--au-gold-soft); color: var(--au-gold-text); padding: 0 1px; border-radius: 2px; }

.au-search-global__empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--au-muted);
  font-size: var(--au-fs-3);
}

@media (max-width: 991px) { .au-search-global { display: none; } }

/* -------- Alertes -------------------------------------------------------- */
.au-alerts { width: 320px; padding: 0; overflow: hidden; }

.au-alerts__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--au-line);
  font-size: var(--au-fs-3);
  font-weight: 700;
  color: var(--au-heading);
}

.au-alerts__head small { color: var(--au-muted); font-weight: 500; font-size: 11.5px; }

.au-alerts__item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--au-line);
  color: var(--au-text);
  text-decoration: none;
}

.au-alerts__item:last-child { border-bottom: 0; }
.au-alerts__item:hover { background: var(--au-soft); }
.au-alerts__item i { font-size: 16px; line-height: 1.3; flex: 0 0 auto; }
.au-alerts__item.is-danger i { color: var(--au-red); }
.au-alerts__item.is-warning i { color: var(--au-warn); }
.au-alerts__item.is-info i { color: var(--au-info); }
.au-alerts__item strong { display: block; font-size: var(--au-fs-3); color: var(--au-heading); }
.au-alerts__item small { display: block; margin-top: 1px; font-size: 11.5px; color: var(--au-muted); }

.au-alerts__empty {
  padding: 26px 14px;
  text-align: center;
  color: var(--au-muted);
  font-size: var(--au-fs-3);
}

.au-alerts__empty i { display: block; margin-bottom: 6px; font-size: 22px; color: var(--au-green); }

/* -------- Zone basse du menu lateral ------------------------------------- */
.sidebar { display: flex; flex-direction: column; }
.sidebar-nav { flex: 1 1 auto; }

.sidebar-foot {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--au-sidebar-line);
  display: grid;
  gap: 2px;
}

.sidebar-foot__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--au-radius);
  background: transparent;
  color: var(--au-sidebar-text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--au-dur-1) var(--au-ease), color var(--au-dur-1) var(--au-ease);
}

.sidebar-foot__btn i { font-size: 15px; flex: 0 0 auto; }
.sidebar-foot__btn:hover { background: var(--app-sidebar-hover); color: var(--app-text); }
.sidebar-foot__btn.is-danger:hover { background: var(--app-danger-soft); color: var(--app-danger-text); }

/* -------- Menu reduit (icones seules) ------------------------------------ */
@media (min-width: 1200px) {
  body.au-mini .sidebar { width: var(--au-sidebar-w-mini); padding-left: 8px; padding-right: 8px; }
  body.au-mini #main,
  body.au-mini #footer { margin-left: var(--au-sidebar-w-mini); }
  body.au-mini #header .logo { width: var(--au-sidebar-w-mini); }
  body.au-mini #header .logo span { display: none; }

  body.au-mini .sidebar-nav .nav-link > span,
  body.au-mini .sidebar-nav .nav-link .bi-chevron-down,
  body.au-mini .sidebar-foot__btn span,
  body.au-mini .sidebar-nav .nav-heading { display: none; }

  body.au-mini .sidebar-nav .nav-link,
  body.au-mini .sidebar-foot__btn { justify-content: center; padding-left: 8px; padding-right: 8px; }
  body.au-mini .sidebar-nav .nav-link i,
  body.au-mini .sidebar-foot__btn i { margin-right: 0; font-size: 18px; }

  /* En mode reduit, un sous-menu ne s affiche qu en panneau flottant */
  body.au-mini .sidebar-nav .nav-content { display: none; }

  body.au-mini [data-au-sidebar-mini] i { transform: rotate(180deg); }
}


/* -------- Sections du menu lateral --------------------------------------- */
.sidebar-nav .sidebar-section {
  padding: 16px 12px 6px;
  color: var(--au-sidebar-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  list-style: none;
}

.sidebar-nav .sidebar-section:first-child { padding-top: 4px; }

/* -------- Pastilles de menu ---------------------------------------------- */
.sidebar-nav .nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--app-info);
  color: var(--app-text-on-primary);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.sidebar-nav .nav-badge--danger { background: var(--au-red); }
.sidebar-nav .nav-badge--warning { background: var(--app-warning); color: #231C05; }
.sidebar-nav .nav-badge--info { background: var(--au-info); }

/* La pastille precede le chevron : elle ne pousse plus la fleche hors cadre */
.sidebar-nav .nav-link .nav-badge + .bi-chevron-down { margin-left: 8px !important; }
.sidebar-nav .nav-content .nav-badge { height: 17px; min-width: 19px; }

/* -------- Portee des donnees --------------------------------------------- */
.au-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin-right: 6px;
  padding: 0 11px;
  border: 1px solid var(--au-line);
  border-radius: 999px;
  background: var(--au-surface-2);
  color: var(--au-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.au-scope i { font-size: 13px; }

.au-scope.is-global {
  border-color: var(--au-ink-border);
  background: var(--au-ink-soft);
  color: var(--au-ink-text);
}

/* -------- Action rapide -------------------------------------------------- */
.au-quick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  margin-right: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--au-radius);
  background: var(--au-ink);
  color: var(--au-on-brand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--au-dur-1) var(--au-ease),
              box-shadow var(--au-dur-1) var(--au-ease);
}

.au-quick i { font-size: 15px; }
.au-quick:hover,
.au-quick[aria-expanded="true"] { background: var(--au-ink-2); box-shadow: var(--au-shadow-brand); }
.au-quick:focus-visible { outline: 2px solid var(--au-gold); outline-offset: 2px; }

.au-quick__menu {
  min-width: 258px;
  padding: 6px;
  border: 1px solid var(--au-line);
  border-radius: var(--au-radius);
  background: var(--au-card);
  box-shadow: var(--au-shadow-2);
}

.au-quick__head {
  padding: 6px 10px 8px;
  color: var(--au-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.au-quick__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--au-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--au-dur-1) var(--au-ease), color var(--au-dur-1) var(--au-ease);
}

.au-quick__item i { color: var(--au-gold); font-size: 15px; }
.au-quick__item:hover { background: var(--au-ink-soft); color: var(--au-ink-text); }
.au-quick__item:focus-visible { outline: 2px solid var(--au-ink-2); outline-offset: -2px; }

/* -------- Info-bulles du menu reduit ------------------------------------- */
@media (min-width: 1200px) {
  body.au-mini .sidebar-nav .sidebar-section {
    visibility: hidden;
    height: 12px;
    padding: 0;
    font-size: 0;
    letter-spacing: 0;
    overflow: hidden;
  }
  body.au-mini .sidebar-nav .nav-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    margin: 0;
    min-width: 17px;
    height: 16px;
    padding: 0 4px;
    font-size: 9.5px;
  }
  body.au-mini .sidebar-nav .nav-item { position: relative; }

  /* L'info-bulle est un element unique en position fixe (app-shell.js) :
     elle echappe ainsi au defilement du menu qui la rognerait. */
}

/* -------- Etats de chargement (squelettes) ------------------------------- */
.au-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--au-soft);
  border-radius: 4px;
  color: transparent !important;
}

.au-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--au-hover), transparent);
  animation: auGlisse 1.3s infinite;
}

@keyframes auGlisse { to { transform: translateX(100%); } }

.au-skeleton-line { height: 12px; margin: 6px 0; }
.au-skeleton-line.is-court { width: 45%; }

/* -------- Apparition des cartes ------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .app-ui .card,
  .app-ui .au-report__bar,
  .app-ui .au-filters {
    /* « backwards » et non « both » : une animation maintenue apres sa fin
       garde une transformation, qui enferme les menus deroulants de la carte
       et laisse la carte suivante passer par-dessus. */
    animation: auMonte var(--au-dur-3) var(--au-ease) backwards;
  }
}

/* Fondu seul : une transformation, meme passagere, sert de reference aux
   menus deroulants en position fixe et les decalerait ou les enfermerait. */
@keyframes auMonte {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   9. Divers
   ========================================================================== */
.app-ui .spinner-border.text-primary { color: var(--au-heading) !important; }
.app-ui hr { border-color: var(--au-line); opacity: 1; }
.app-ui .text-muted { color: var(--au-muted) !important; }
.app-ui .small, .app-ui small { font-size: 11.5px; }

.app-ui :focus-visible {
  outline: 2px solid var(--au-ink-2);
  outline-offset: 2px;
}

@media print {
  .sidebar, #header, #footer, .back-to-top, .app-ui .au-toolbar, .app-ui .au-pager { display: none !important; }
  #main { margin: 0 !important; padding: 0 !important; }
}

/* -------- Info-bulle du menu reduit -------------------------------------- */
.au-tip {
  position: fixed;
  z-index: 1100;
  padding: 6px 10px;
  border-radius: 5px;
  background: var(--app-brand-dark);
  color: var(--app-text-on-brand);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.96);
  transition: opacity var(--au-dur-1) var(--au-ease), transform var(--au-dur-1) var(--au-ease);
  box-shadow: var(--au-shadow-2);
}

.au-tip.is-visible { opacity: 1; transform: translateY(-50%) scale(1); }

/* ==========================================================================
   NAVIGATION SANS RECHARGEMENT
   --------------------------------------------------------------------------
   La coque reste montee : seule la zone #app-content change. L'attente se
   signale par un filet de progression et, si elle se prolonge, par un voile
   pose uniquement sur le contenu.
   ========================================================================== */
#app-content {
  position: relative;
  min-height: 40vh;
}

/* Filet de progression, cale sous la barre haute */
.app-progress {
  position: fixed;
  top: var(--app-topbar-h);
  left: 0;
  z-index: 1003;
  display: block;
  width: 0;
  height: 2px;
  background: var(--app-primary);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  pointer-events: none;
}

.app-progress.is-active {
  opacity: 1;
  animation: appProgresse 900ms var(--app-ease) forwards;
}

.app-progress.is-done {
  width: 100%;
  opacity: 0;
  transition: width 120ms linear, opacity 300ms linear 120ms;
}

@keyframes appProgresse {
  0%   { width: 0; }
  55%  { width: 62%; }
  100% { width: 86%; }
}

@media (min-width: 1200px) {
  .app-progress { left: var(--app-sidebar-w); width: 0; }
  body.au-mini .app-progress { left: var(--app-sidebar-w-mini); }
}

/* Voile leger : le contenu s'estompe sans masquer la coque */
#app-content.is-waiting > *:not(.app-progress) {
  opacity: 0.45;
  filter: saturate(0.6);
  transition: opacity var(--app-dur) var(--app-ease), filter var(--app-dur) var(--app-ease);
  pointer-events: none;
}

#app-content.is-waiting::after {
  content: "";
  position: absolute;
  top: 96px;
  left: 50%;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  border: 3px solid var(--app-border);
  border-top-color: var(--app-primary);
  border-radius: 50%;
  animation: appTourne 0.75s linear infinite;
  z-index: 2;
}

@keyframes appTourne { to { transform: rotate(360deg); } }

/* Page en preparation : masquee jusqu'a l'arrivee de ses donnees initiales,
   un seul indicateur reste visible (voir app-pjax.js, revelerQuandPret).
   Garde-fou sans script : la page se montre d'elle-meme apres 6 s. */
#app-content.is-preparing > *:not(.app-progress) {
  opacity: 0;
  pointer-events: none;
  animation: appReveleSecours 0s linear 6s forwards;
}

#app-content.is-preparing::after {
  animation: appTourne 0.75s linear infinite, appMasqueSecours 0s linear 6s forwards;
}

@keyframes appReveleSecours { to { opacity: 1; pointer-events: auto; } }
@keyframes appMasqueSecours { to { visibility: hidden; } }

/* Apparition du nouveau contenu */
@media (prefers-reduced-motion: no-preference) {
  /* « backwards » : aucune transformation ne subsiste apres l'apparition
     (sinon les menus en position fixe seraient enfermes dans #main) */
  #app-content:not(.is-loading) > #main { animation: appEntre var(--app-dur-slow) var(--app-ease) backwards; }
}

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

/* Le preloader plein ecran du modele n'a plus lieu d'etre une fois la coque
   affichee : la navigation se signale desormais dans la zone de contenu. */
#preloader { display: none !important; }

/* ==========================================================================
   MENU LATERAL : TETE FIXE, LISTE DEFILANTE, PIED FIXE
   --------------------------------------------------------------------------
   Seule la liste des modules defile. Le bouton de reduction en haut et la
   zone « Profil / Deconnexion » en bas restent visibles quelle que soit la
   hauteur de l'ecran ou le navigateur.
   ========================================================================== */
#sidebar.sidebar {
  display: flex;
  flex-direction: column;
  overflow: visible;             /* le bouton de reduction depasse du filet */
  padding: 0;
}

.sidebar-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 12px 6px;
}

/* Bouton rond de reduction, a la maniere de la maquette */
.sidebar-reduce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--app-sidebar-line);
  border-radius: 50%;
  background: var(--app-surface);
  color: var(--app-sidebar-text-2);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease),
              border-color var(--app-dur-fast) var(--app-ease);
}

.sidebar-reduce:hover {
  background: var(--app-sidebar-active-bg);
  border-color: var(--app-primary);
  color: var(--app-primary);
}

.sidebar-reduce:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.sidebar-reduce i { transition: transform var(--app-dur) var(--app-ease); }

/* La liste : unique zone defilante */
#sidebar .sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 12px 12px;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--app-border-strong) transparent;
}

#sidebar .sidebar-nav::-webkit-scrollbar { width: 6px; }
#sidebar .sidebar-nav::-webkit-scrollbar-thumb {
  background-color: var(--app-border-strong);
  border-radius: 3px;
}

/* Le pied reste colle en bas, jamais emporte par le defilement */
#sidebar .sidebar-foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--app-sidebar-line);
  background: var(--app-sidebar-bg);
}

#sidebar .sidebar-foot__btn { min-height: var(--app-tap); }

/* -------- Menu reduit ---------------------------------------------------- */
@media (min-width: 1200px) {
  body.au-mini .sidebar-head { justify-content: center; padding-left: 8px; padding-right: 8px; }
  body.au-mini .sidebar-reduce i { transform: rotate(180deg); }
  body.au-mini #sidebar .sidebar-nav { padding-left: 8px; padding-right: 8px; }
  body.au-mini #sidebar .sidebar-foot { padding-left: 8px; padding-right: 8px; }
}

/* ==========================================================================
   FICHE PROFIL
   ========================================================================== */
.au-profil .modal-header {
  padding: var(--app-space-4) var(--app-space-5);
  border-bottom: 1px solid var(--app-border);
}

.au-profil .modal-title {
  font-size: var(--app-fs-h3);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--app-text);
}

.au-profil .modal-body { padding: var(--app-space-5); }

.au-profil__identite {
  display: flex;
  align-items: center;
  gap: var(--app-space-3);
  padding-bottom: var(--app-space-4);
  margin-bottom: var(--app-space-4);
  border-bottom: 1px solid var(--app-border);
}

.au-profil__identite img {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--app-primary-soft);
}

.au-profil__identite strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--app-text);
}

.au-profil__identite span {
  font-size: var(--app-fs-tiny);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--app-text-muted);
}

.au-profil__actions { display: grid; gap: 8px; }

.au-profil__action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--app-tap);
  padding: 11px 13px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  color: var(--app-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--app-dur-fast) var(--app-ease),
              border-color var(--app-dur-fast) var(--app-ease);
}

.au-profil__action:hover { background: var(--app-surface-2); border-color: var(--app-primary); }
.au-profil__action:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }

.au-profil__action > span:nth-child(2) { flex: 1; min-width: 0; }
.au-profil__action strong { display: block; font-size: var(--app-fs-label); font-weight: 600; }
.au-profil__action small { display: block; font-size: var(--app-fs-tiny); color: var(--app-text-muted); }
.au-profil__action > .bi-chevron-right { font-size: 13px; color: var(--app-text-muted); }

.au-profil__icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--app-primary-soft);
  color: var(--app-primary-soft-text);
  font-size: 16px;
}

/* ==========================================================================
   GLISSEMENT TACTILE
   --------------------------------------------------------------------------
   Pendant le geste, le tiroir suit le doigt : la transition est neutralisee
   par le script, puis retablie au relachement pour un calage fluide.
   ========================================================================== */
@media (max-width: 1199.98px) {
  #sidebar.sidebar { transition: left var(--app-dur-slow) var(--app-ease), transform var(--app-dur-slow) var(--app-ease); }
  .app-backdrop { transition: opacity var(--app-dur-slow) var(--app-ease), visibility var(--app-dur-slow) var(--app-ease); }
}

/* ==========================================================================
   BOUTON DE REDUCTION DANS LA BARRE HAUTE
   ========================================================================== */
.au-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid transparent;
  border-radius: var(--app-radius);
  background: transparent;
  color: var(--app-text-secondary);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--app-dur-fast) var(--app-ease),
              color var(--app-dur-fast) var(--app-ease),
              border-color var(--app-dur-fast) var(--app-ease);
}

.au-menu-btn:hover {
  background: var(--app-primary-soft);
  border-color: var(--app-primary-soft-border);
  color: var(--app-primary-soft-text);
}

.au-menu-btn:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.au-menu-btn i { font-size: 19px; }

/* ==========================================================================
   SOUS-MENU FLOTTANT DU MENU REDUIT
   --------------------------------------------------------------------------
   Panneau pose en position fixe par app-shell.js : il echappe au defilement
   de la liste et reste entierement visible a l'ecran.
   ========================================================================== */
@media (min-width: 1200px) {
  body.au-mini .sidebar-nav .nav-content.is-flyout {
    display: block;
    position: fixed;
    z-index: 1010;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--app-border);
    border-left: 0;
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-md);
    animation: auFlyout var(--app-dur-fast) var(--app-ease) both;
  }

  body.au-mini .sidebar-nav .nav-content.is-flyout a {
    min-height: 38px;
    padding: 8px 12px;
    color: var(--app-text);
    white-space: nowrap;
  }

  body.au-mini .sidebar-nav .nav-content.is-flyout a:hover {
    background: var(--app-surface-2);
    color: var(--app-text);
  }

  body.au-mini .sidebar-nav .nav-content.is-flyout a.active {
    background: var(--app-primary-soft);
    color: var(--app-primary-soft-text);
  }

  body.au-mini .sidebar-nav .nav-content.is-flyout a i {
    color: var(--app-text-muted);
    background-color: var(--app-text-muted);
  }

  body.au-mini .sidebar-nav .nav-content.is-flyout a:hover i,
  body.au-mini .sidebar-nav .nav-content.is-flyout a.active i {
    color: var(--app-primary);
    background-color: var(--app-primary);
  }

  /* La pastille reste lisible dans le panneau */
  body.au-mini .sidebar-nav .nav-content.is-flyout .nav-badge {
    position: static;
    margin-left: auto;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    font-size: 10.5px;
  }
}

@keyframes auFlyout {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   BOUTON DE REDUCTION : UNIQUE CONTROLE, DANS LA BARRE HAUTE
   --------------------------------------------------------------------------
   Sur ordinateur il reduit le menu aux icones ; sous 1200 px il ouvre et
   referme le tiroir. L icone indique l etat courant.
   ========================================================================== */
.au-menu-btn { display: inline-flex; }

/* Le bloc logo se cale sur son contenu : le bouton reste pres de la marque */
#header > .d-flex:first-child {
  justify-content: flex-start;
  gap: 4px;
}

#header .logo {
  width: auto;
  min-width: 0;
  max-width: 40vw;
  padding-right: 8px;
}

/* Ordinateur : le bloc logo occupe la largeur du menu et le bouton se pose
   a cheval sur la bordure du menu lateral, dans l axe de sa barre de
   defilement. Il suit la largeur du menu, deplie ou reduit. */
@media (min-width: 1200px) {
  #header > .d-flex:first-child {
    width: calc(var(--au-sidebar-w) - 16px);
    flex: 0 0 auto;
  }
  body.au-mini #header > .d-flex:first-child { width: calc(var(--au-sidebar-w-mini) - 16px); }

  #header .logo,
  body.au-mini #header .logo { width: auto; max-width: 100%; }

  #header .au-menu-btn {
    position: absolute;
    top: 50%;
    left: var(--au-sidebar-w);
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    transform: translate(-50%, -50%);
    border-color: var(--app-border);
    border-radius: 50%;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.15));
    z-index: 2;
    transition: left var(--app-dur-slow) var(--app-ease),
                background var(--app-dur-fast) var(--app-ease),
                color var(--app-dur-fast) var(--app-ease),
                border-color var(--app-dur-fast) var(--app-ease);
  }
  body.au-mini #header .au-menu-btn { left: var(--au-sidebar-w-mini); }
  #header .au-menu-btn i { font-size: 15px; }

  #header .au-search-global { margin-left: 26px; }
}

/* ==========================================================================
   COMPOSANTS TIERS ALIGNES SUR LE DESIGN SYSTEM
   --------------------------------------------------------------------------
   SweetAlert2, dselect et les menus deroulants de la barre haute arrivent
   avec leurs propres couleurs. On les rebranche sur les jetons --app-* pour
   qu'ils suivent le mode clair comme le mode sombre.
   ========================================================================== */

/* -------- Menus deroulants : plus d'aplat blanc au survol ---------------- */
.dropdown-menu {
  background: var(--app-surface);
  border-color: var(--app-border);
  color: var(--app-text);
}

.dropdown-menu .dropdown-item,
#header .header-nav .profile .dropdown-item {
  color: var(--app-text);
  background: transparent;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus,
.dropdown-menu .dropdown-item.active,
#header .header-nav .profile .dropdown-item:hover,
#header .header-nav .profile .dropdown-item:focus {
  background-color: var(--app-primary-soft);
  color: var(--app-primary-soft-text);
}

/* La sortie de session garde sa teinte d'avertissement */
.dropdown-menu .dropdown-item.text-danger:hover,
.dropdown-menu .dropdown-item.text-danger:focus,
#header .header-nav .profile .dropdown-item.text-danger:hover {
  background-color: var(--app-danger-soft);
  color: var(--app-danger-text) !important;
}

.dropdown-menu .dropdown-item i,
#header .header-nav .profile .dropdown-item i { color: inherit; }
.dropdown-divider { border-top-color: var(--app-border); }
.dropdown-header { color: var(--app-text-secondary); }

/* -------- dselect --------------------------------------------------------- */
.dselect-clear,
.dropdown .form-select {
  background-color: var(--app-input-bg);
  border-color: var(--app-input-border);
  color: var(--app-text);
}

.dropdown .form-select:focus {
  border-color: var(--app-primary);
  box-shadow: var(--app-focus-ring);
}

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

.dselect-items {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--app-border-strong) transparent;
}

.dselect-items .dropdown-item {
  padding: 8px 14px;
  min-height: 38px;
  font-size: var(--app-fs-small);
  white-space: normal;
}

.dselect-items .dropdown-item.active {
  background-color: var(--app-primary-solid);
  color: var(--app-text-on-primary);
}

.dselect-no-results { padding: 12px 14px; color: var(--app-text-muted); font-size: var(--app-fs-small); }
.dselect-note { padding: 6px 14px 8px; border-top: 1px solid var(--app-border); color: var(--app-text-muted); font-size: var(--app-fs-tiny); }

/* Le champ de recherche du menu deroulant */
.dropdown-menu .form-control {
  background: var(--app-input-bg);
  border-color: var(--app-input-border);
  color: var(--app-text);
}

.dropdown-menu .form-control:focus {
  border-color: var(--app-primary);
  box-shadow: var(--app-focus-ring);
}

.dropdown-menu .form-control::placeholder { color: var(--app-text-muted); }

/* Etiquettes du mode multiple */
.dselect-tag {
  background: var(--app-primary-soft);
  color: var(--app-primary-soft-text);
  border: 1px solid var(--app-primary-soft-border);
  border-radius: var(--app-radius-sm);
}

.dselect-tag-remove { color: inherit; opacity: 0.7; }
.dselect-tag-remove:hover { opacity: 1; }

/* -------- dselect : structure (assets/js/dselect.js, app-select.js) -------
   Le select natif reste dans le document, invisible mais focalisable : le
   navigateur peut ainsi signaler une liste obligatoire laissee vide. Il est
   sorti du flux et se place au coin du declencheur. */
select.dselect-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden;
}

.dselect-wrapper { position: relative; min-width: 0; }

.dselect-wrapper > .form-select {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.25rem;
  width: 100%;
  min-height: calc(1.5em + 0.75rem + 2px);
  text-align: left;
  overflow: hidden;
}
.dselect-wrapper > .form-select:disabled { cursor: not-allowed; }
.dselect-wrapper > .form-select.dselect-clearable { padding-right: 3.25rem; }

.dselect-label,
.dselect-placeholder {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mode multiple : les etiquettes passent a la ligne */
select[multiple].dselect-native + .dselect-wrapper > .form-select { flex-wrap: wrap; overflow: visible; }
.dselect-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  font-size: 0.85em;
  line-height: 1.5;
}
.dselect-tag-remove { cursor: pointer; flex: 0 0 auto; }

/* Menu : positionne en fixed par Popper, largeur calee sur le declencheur */
.dselect-wrapper .dropdown-menu {
  width: auto;
  min-width: 12rem;
  max-width: min(92vw, 560px);
  padding: 6px;
}
.dselect-wrapper .dropdown-menu > .flex-column { gap: 6px; }
.dselect-wrapper .dselect-search { min-height: 36px; padding: 6px 10px; font-size: inherit; }
.dselect-wrapper .dropdown-header { padding: 6px 14px 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.dselect-wrapper .dropdown-header ~ .dropdown-item { padding-left: 22px; }
.dselect-items .dropdown-item.disabled,
.dselect-items .dropdown-item:disabled { opacity: 0.55; }

.dselect-clear {
  position: absolute;
  top: 50%;
  right: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  transform: translateY(-50%);
  color: var(--app-text-muted);
  background: transparent;
}
.dselect-clear svg { width: 10px; height: 10px; }
.dselect-clear:hover { color: var(--app-text); }
.dselect-wrapper [data-dselect-text=""] ~ .dselect-clear { display: none; }

/* Validation Bootstrap reportee sur le declencheur */
.was-validated select.dselect-native:invalid + .dselect-wrapper > .form-select,
select.dselect-native.is-invalid + .dselect-wrapper > .form-select {
  border-color: var(--bs-form-invalid-border-color, var(--app-danger));
}
.was-validated select.dselect-native:invalid + .dselect-wrapper > .form-select:focus,
.was-validated select.dselect-native:invalid + .dselect-wrapper > .form-select.show,
select.dselect-native.is-invalid + .dselect-wrapper > .form-select:focus {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb, 217, 92, 92), 0.25);
}
.was-validated select.dselect-native:valid + .dselect-wrapper > .form-select,
select.dselect-native.is-valid + .dselect-wrapper > .form-select {
  border-color: var(--bs-form-valid-border-color, var(--app-success));
}
.was-validated select.dselect-native:invalid ~ .invalid-feedback,
select.dselect-native.is-invalid ~ .invalid-feedback { display: block; }

/* Dans un groupe de saisie (montant + devise, recherche + filtre...) */
.input-group > .dselect-wrapper {
  flex: 1 1 auto;
  width: 1%;
}
.input-group > .dselect-wrapper[style*="width"] { flex: 0 1 auto; width: 100%; }
.input-group > .dselect-wrapper:focus-within { z-index: 5; }
.input-group > .dselect-wrapper > .form-select { border-radius: 0; height: 100%; }
.input-group > select.dselect-native:first-child + .dselect-wrapper > .form-select {
  border-top-left-radius: var(--bs-border-radius);
  border-bottom-left-radius: var(--bs-border-radius);
}
.input-group > .dselect-wrapper:last-child > .form-select,
.input-group.has-validation > .dselect-wrapper:nth-last-child(2) > .form-select {
  border-top-right-radius: var(--bs-border-radius);
  border-bottom-right-radius: var(--bs-border-radius);
}
.input-group-sm > .dselect-wrapper > .form-select { min-height: calc(1.5em + 0.5rem + 2px); padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.875rem; }

/* Pagination : liste compacte du nombre de lignes */
.au-pager__size .dselect-wrapper { width: auto; min-width: 76px; }
.app-ui .au-pager__size .dselect-wrapper > .form-select { min-height: 36px; padding-top: 5px; padding-bottom: 5px; font-size: var(--au-fs-4); }
.au-pager__size .dselect-wrapper .dropdown-menu { min-width: 76px; }

/* -------- SweetAlert2 ----------------------------------------------------- */
.swal2-container { backdrop-filter: none; }

.swal2-popup {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  color: var(--app-text);
  font-family: var(--app-font);
  box-shadow: var(--app-shadow-lg);
}

.swal2-title { color: var(--app-text); font-weight: 700; letter-spacing: -0.015em; }
.swal2-html-container { color: var(--app-text-secondary); }
.swal2-footer { border-top-color: var(--app-border); color: var(--app-text-secondary); }
.swal2-close { color: var(--app-text-muted); }
.swal2-close:hover { color: var(--app-danger); }

.swal2-input,
.swal2-textarea,
.swal2-select,
.swal2-file {
  border: 1px solid var(--app-input-border);
  border-radius: var(--app-radius);
  background: var(--app-input-bg);
  color: var(--app-text);
  box-shadow: none;
}

.swal2-input:focus,
.swal2-textarea:focus,
.swal2-select:focus {
  border-color: var(--app-primary);
  box-shadow: var(--app-focus-ring);
}

.swal2-validation-message {
  background: var(--app-danger-soft);
  color: var(--app-danger-text);
}

/* Boutons : memes regles que le reste de l'application */
.swal2-styled {
  border-radius: var(--app-radius);
  font-family: var(--app-font);
  font-size: var(--app-fs-body);
  font-weight: 600;
  box-shadow: none;
}

.swal2-styled.swal2-confirm {
  background-color: var(--app-primary-solid) !important;
  color: var(--app-text-on-primary);
}

.swal2-styled.swal2-confirm:hover { background-color: var(--app-primary-solid-hover) !important; }

.swal2-styled.swal2-deny { background-color: var(--app-danger) !important; color: var(--app-text-on-primary); }

.swal2-styled.swal2-cancel {
  background-color: var(--app-surface-2) !important;
  border: 1px solid var(--app-border);
  color: var(--app-text) !important;
}

.swal2-styled.swal2-cancel:hover { background-color: var(--app-surface-3) !important; }
.swal2-styled:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; box-shadow: none; }

/* Pictogrammes : teintes du systeme */
.swal2-icon.swal2-success { border-color: var(--app-success-border); color: var(--app-success); }
.swal2-icon.swal2-success [class^="swal2-success-line"] { background-color: var(--app-success); }
.swal2-icon.swal2-success .swal2-success-ring { border-color: var(--app-success-border); }
.swal2-icon.swal2-error { border-color: var(--app-danger-border); color: var(--app-danger); }
.swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background-color: var(--app-danger); }
.swal2-icon.swal2-warning { border-color: var(--app-warning-border); color: var(--app-warning); }
.swal2-icon.swal2-info { border-color: var(--app-info-border); color: var(--app-info); }
.swal2-icon.swal2-question { border-color: var(--app-primary-soft-border); color: var(--app-primary); }

.swal2-loader { border-color: var(--app-primary) transparent var(--app-primary) transparent; }
.swal2-timer-progress-bar { background: var(--app-primary); }
.swal2-progress-steps .swal2-progress-step { background: var(--app-primary-solid); }
.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step ~ .swal2-progress-step,
.swal2-progress-steps .swal2-progress-step-line { background: var(--app-surface-3); }


/* ==========================================================================
   RETOUR VISUEL DES ACTIONS (assets/js/app-busy.js)
   --------------------------------------------------------------------------
   Bouton : le libelle devient transparent et un rond de sa couleur tourne
   au centre, la taille du bouton ne bouge pas. Lien : un petit rond suit
   le libelle. Dans les deux cas un second clic est refuse.
   ========================================================================== */
.app-busy {
  cursor: progress !important;
  pointer-events: none;
}

.app-busy--pos { position: relative; }

.app-busy--overlay {
  color: transparent !important;
  text-shadow: none !important;
}
.app-busy--overlay > :not(.app-busy__spin) { visibility: hidden; }

.app-busy__spin {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.125em;
  animation: appBusyTourne 0.7s linear infinite;
}

.app-busy--overlay > .app-busy__spin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.1em;
  height: 1.1em;
  margin: -0.55em 0 0 -0.55em;
  color: var(--app-busy-color, currentColor);
  border-color: var(--app-busy-color, currentColor);
  border-right-color: transparent;
  visibility: visible;
}

.app-busy--inline > .app-busy__spin {
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.5em;
  opacity: 0.85;
}

.app-busy--input { opacity: 0.65; }

/* Bouton de bascule du theme : ses deux icones (et libelles) sont dans la page,
   le theme pose avant le rendu (head.php) choisit lequel montrer. Aucun script
   ne touche au bouton au chargement : il ne clignote jamais. */
html[data-bs-theme="dark"] .app-theme-clair,
html:not([data-bs-theme="dark"]) .app-theme-sombre { display: none !important; }

/* Bouton Ladda demarre apres l'indicateur generique : un seul rond, celui de Ladda */
.ladda-button[data-loading] > .app-busy__spin { display: none; }
.ladda-button[data-loading].app-busy--overlay > .ladda-spinner { visibility: visible; }

/* Element clique devenu invisible (menu referme) : barre fine en haut de l'ecran */
.app-busy-barre {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2000;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.app-busy-barre.is-active { opacity: 1; }
.app-busy-barre::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  border-radius: 3px;
  background: var(--app-primary);
  animation: appBusyBarre 1.1s ease-in-out infinite;
}

@keyframes appBusyTourne {
  to { transform: rotate(360deg); }
}

@keyframes appBusyBarre {
  to { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .app-busy__spin { animation-duration: 1.6s; }
  .app-busy-barre::before { animation-duration: 2.4s; }
}
/* -------- En-tete des pages de rapport ----------------------------------- */
/* Les pages de rapport reprennent la salutation du poste de pilotage
   (app-dash.css) ; il reste a lui donner la respiration des autres pages. */
.app-ui .rap-entete { margin-bottom: var(--app-space-4); }
.app-ui .rap-entete + .section,
.app-ui .rap-entete + .row { margin-top: 0; }

/* -------- dselect : panneau telephone (assets/js/dselect.js, ouvrirFeuille) ----
   Sur un telephone, la liste ne s'ouvre plus sous le champ (cachee par le
   clavier virtuel) mais en panneau cale en haut de la zone visible. Le script
   pose --dselect-haut et --dselect-hauteur d'apres visualViewport et les met a
   jour quand le clavier s'ouvre ou se ferme. Pendant l'ouverture, le menu est
   deplace hors de l'habillage (dans .modal ou body) : ces regles ne dependent
   donc pas de .dselect-wrapper. Les !important l'emportent sur la position
   calculee par Popper (styles en ligne). */
.dselect-entete { display: none; }

.dropdown-menu.dselect-feuille {
  position: fixed !important;
  inset: auto !important;
  top: var(--dselect-haut, 8px) !important;
  left: 8px !important;
  right: 8px !important;
  bottom: auto !important;
  transform: none !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: var(--dselect-hauteur, 80vh);
  margin: 0 !important;
  padding: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1095;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius, 12px);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-lg);
  font-size: 1rem;
}
.dselect-feuille > .flex-column { flex: 1 1 auto; min-height: 0; gap: 8px; }
.dselect-feuille .dselect-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--app-border);
}
.dselect-feuille .dselect-titre {
  font-weight: 600;
  color: var(--app-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dselect-feuille .dselect-fermer { flex: 0 0 auto; padding: 10px; }
[data-bs-theme="dark"] .dselect-feuille .dselect-fermer { filter: invert(1) grayscale(100%) brightness(200%); }
/* Recherche : 16 px au moins, sinon iOS agrandit la page a la saisie */
.dselect-feuille .dselect-search { font-size: 16px; min-height: 44px; flex: 0 0 auto; }
.dselect-feuille .dselect-items {
  max-height: none !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.dselect-feuille .dselect-items .dropdown-item { min-height: 44px; font-size: 0.95rem; padding-left: 0.625rem; padding-right: 0.625rem; }

.dselect-voile {
  position: fixed;
  inset: 0;
  z-index: 1094;
  background: rgba(15, 23, 42, 0.45);
}
.dselect-voile[hidden] { display: none; }
