@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500;1,600&display=swap');

/* --- DESIGN SYSTEM PREMIUM : FONCIÈRE BELVÉDÈRE --- */
:root {
  --gl-sage-dark: #1A2E1E;
  --gl-gold: #C9A84C;
  --gl-gold-dark: #A8873A;
  --gl-gold-light: #FBF5E6;
  --gl-sage-light: #EAF2EC;
  --gl-text-muted: #9AA89E;
  --gl-border: #E4E2DC;
  --gl-bg-light: #FAFAF8;
  --gl-shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
}

/* Layout & Header */
/* Charte 2026 : en-tête de page figé + titre serif (aligné sur .gl-head) */
.gl-page-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 30px; background: white; border-bottom: 1px solid var(--gl-border); position: sticky; top: 0; z-index: 40; transition: box-shadow 0.2s ease; }
.gl-page-header.is-stuck { box-shadow: var(--gl-shadow-stuck); }
.gl-page-title { font-family: var(--gl-serif); font-size: 34px; font-weight: 600; line-height: 1.05; color: var(--gl-sage-dark); margin: 0; }
.gl-page-sub { font-size: 13px; color: var(--gl-text-muted); margin-top: 6px; }

/* KPIs */
.gl-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0 30px; margin-bottom: 24px; }
.gl-kpi-card { background: white; border: 1px solid var(--gl-border); border-radius: 12px; padding: 20px; }
.gl-kpi-label { font-size: 11px; font-weight: 700; color: var(--gl-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.gl-kpi-value { font-size: 24px; font-weight: 700; color: var(--gl-sage-dark); margin: 8px 0; }

/* Filtres & Chips */
.gl-filterbar { display: flex; align-items: center; gap: 10px; padding: 16px 30px; background: #fff; border-bottom: 1px solid var(--gl-border); }
.gl-chip { padding: 6px 12px; border-radius: 20px; background: #f3f4f1; border: 1px solid var(--gl-border); font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.gl-chip-active { background: var(--gl-gold-light); border-color: var(--gl-gold); color: var(--gl-gold-dark); }

/* Table Advanced */
.gl-user-cell { display: flex; align-items: center; gap: 12px; }
.gl-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gl-sage-dark); color: var(--gl-gold); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.gl-soc-bullets { display: flex; gap: 4px; }
.gl-soc-b { width: 20px; height: 20px; border-radius: 4px; background: var(--gl-sage-light); color: var(--gl-sage-dark); font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* Matrice de Permissions PRO */
.gl-perm-table { width: 100%; border-collapse: collapse; }
.gl-perm-table thead th { background: var(--gl-bg-light); padding: 12px; font-size: 10px; font-weight: 700; color: var(--gl-text-muted); text-transform: uppercase; text-align: center; border-bottom: 1px solid var(--gl-border); }
.gl-perm-mod-info { display: flex; align-items: center; gap: 12px; text-align: left; padding-left: 20px; }
.gl-perm-check { width: 24px; height: 24px; border-radius: 6px; border: 2px solid #ddd; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.gl-perm-check.on { background: #4A7C59; border-color: #1A2E1E; color: white; }
.gl-perm-check.partial { background: var(--gl-gold-light); border-color: var(--gl-gold); color: var(--gl-gold-dark); }

/* Sidebar Widgets */
.gl-side-card { background: white; border: 1px solid var(--gl-border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.gl-switch-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--gl-border); }

/* --- MODULO PARAMETRAGE PREMIUM --- */
.gl-param-tabs { display:flex; gap:4px; border-bottom:2px solid #E4E2DC; margin-bottom:20px; }
.gl-param-tab {
  padding:12px 22px; font-size:13px; font-weight:600; color:#9AA89E;
  cursor:pointer; border:none; background:transparent;
  border-bottom:2px solid transparent; margin-bottom:-2px;
  display:flex; align-items:center; gap:8px; transition:all .15s;
}
.gl-param-tab:hover { color:#5C6B60; }
.gl-param-tab.active { color:#A8873A; border-bottom-color:#C9A84C; font-weight:700; }
.gl-param-panel { display:none; }
.gl-param-panel.active { display:block; }

.gl-roles-layout { display:grid; grid-template-columns:300px 1fr; gap:20px; }
.gl-role-card {
  background:#fff; border:1.5px solid #E4E2DC; border-radius:12px;
  padding:15px; cursor:pointer; transition:all .2s; margin-bottom:10px;
}
.gl-role-card.active { border-color:#C9A84C; background:#FBF5E6; box-shadow: 0 4px 15px rgba(201,168,76,0.1); }
.gl-role-name { font-size:14px; font-weight:700; color:var(--gl-sage-dark); display:flex; align-items:center; gap:8px; }
.gl-role-desc { font-size:11px; color:#666; margin-top:5px; }

.gl-perm-table { width:100%; border-collapse:collapse; }
.gl-perm-table th { padding:12px; font-size:10px; font-weight:700; color:#999; text-transform:uppercase; background:#f9f9f7; border-bottom:1px solid #eee; }
.gl-perm-table td { padding:12px; border-bottom:1px solid #f5f5f5; text-align:center; }
.gl-perm-mod { display:flex; align-items:center; gap:12px; text-align:left; }
.gl-perm-mod-ico { width:32px; height:32px; background:#f0f3f0; display:flex; align-items:center; justify-content:center; border-radius:8px; }

.gl-perm-check { 
    width:22px; height:22px; border-radius:6px; border:2px solid #ddd; 
    display:inline-flex; align-items:center; justify-content:center; 
    cursor:pointer; transition: .2s; font-size: 14px;
}
.gl-perm-check.active { background: var(--gl-gold); border-color: var(--gl-gold); color: white; }
.gl-perm-check.active::after { content: '✓'; }

/* Charte Sauge & Or - Bailyo */

:root {
    /* Palette Sauge & Or */
    --gl-sidebar: #0D1F12;
    --gl-text: #1A2E1E;
    --gl-green-dark: #1A2E1E;
    --gl-green-mid: #4A7C59;
    --gl-sidebar-text: #7FA88A;
    
    --gl-primary: #C9A84C;
    --gl-primary-dark: #A8873A;
    --gl-primary-border: #E8D4A0;
    --gl-primary-light: #FBF5E6;
    
    --gl-bg: #FAFAF8;
    --gl-surface: #FFFFFF;
    --gl-border: #E4E2DC;
    --gl-text-2: #5C6B60;
    
    /* Sémantiques */
    --gl-success: #15803D;
    --gl-warning: #B45309;
    --gl-danger: #DC2626;
    --gl-info: #1D4ED8;
    
    /* Typographie */
    --gl-font: 'Outfit', -apple-system, 'Segoe UI', sans-serif;
    --gl-font-mono: 'Courier New', monospace;
    
    /* Rayons */
    --gl-radius-sm: 4px;
    --gl-radius: 8px;
    --gl-radius-lg: 12px;
    --gl-radius-xl: 16px;
    
    /* Ombres */
    --gl-shadow-1: 0 1px 4px rgba(0,0,0,0.05);
    --gl-shadow-2: 0 2px 8px rgba(201,168,76,0.15);
    --gl-shadow-3: 0 8px 40px rgba(0,0,0,0.15);

    /* --- Charte 2026 : titres serif + ossature sticky --- */
    --gl-serif: 'Cormorant Garamond', Georgia, serif;
    --gl-shadow-stuck: 0 8px 20px -10px rgba(13,31,18,0.22);
    --gl-top-kpi: 0px;    /* renseigné dynamiquement par la page (hauteur en-tête) */
    --gl-top-thead: 0px;  /* renseigné dynamiquement (en-tête + KPI) */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--gl-font);
    background-color: var(--gl-bg);
    color: var(--gl-text);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LAYOUT GLOBAL
   ========================================================================== */

.gl-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.gl-sidebar {
    width: 260px;
    background-color: var(--gl-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden; /* le défilement est délégué à .gl-sidebar-nav */
    z-index: 100;
}

/* --- En-tête FIGÉ : logo + société active + exercice actif --- */
.gl-sidebar-head {
    flex-shrink: 0;
    padding: 24px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.gl-sidebar-brandrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.gl-sidebar-collapse {
    margin-left: auto;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--gl-sidebar-text);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.gl-sidebar-collapse:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.gl-sidebar-collapse:focus-visible {
    outline: 2px solid var(--gl-primary);
    outline-offset: 2px;
}
.gl-sidebar-selects {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.gl-sidebar-sel label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: var(--gl-sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    opacity: 0.8;
}
.gl-sel-box {
    position: relative;
    display: flex;
    align-items: center;
}
.gl-sel-ico {
    position: absolute;
    left: 12px;
    font-size: 14px;
    color: var(--gl-primary);
    pointer-events: none;
    z-index: 1;
}
.gl-sel-caret {
    position: absolute;
    right: 12px;
    font-size: 10px;
    color: var(--gl-sidebar-text);
    opacity: 0.7;
    pointer-events: none;
}
.gl-sidebar-sel select {
    width: 100%;
    height: 40px;
    padding: 8px 28px 8px 34px;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: white;
    font-family: var(--gl-font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* --- Zone SCROLLABLE : navigation --- */
.gl-sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 16px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.gl-sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.gl-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.gl-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.gl-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}
.gl-nav-section {
    font-size: 10px;
    font-weight: 700;
    color: #5C6B60;
    padding: 20px 20px 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
}
.gl-nav-section:first-child {
    padding-top: 10px;
}

/* --- Pied FIGÉ : compte --- */
.gl-sidebar-foot {
    flex-shrink: 0;
    padding: 10px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Compat : ancien scroll global (inoffensif si présent) */
.gl-sidebar::-webkit-scrollbar {
    width: 6px;
}
.gl-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.gl-sidebar-logo {
    font-size: 18px;
    font-weight: 800;
    color: var(--gl-primary);
    margin: 0;
    padding: 0;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
}
/* Logo Bailyo : symbole (SVG) + « Bailyo » + « Gestion locative » (texte réel,
   lisible à la taille de la barre ; couleurs reprises du lockup inverse) */
.gl-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
    overflow: visible;
}
.gl-brand-mark {
    display: block;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
}
.gl-brand-txt {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1;
}
.gl-brand-txt b {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 27px;
    font-weight: 600;
    color: #F6F2E9;
    letter-spacing: 0.005em;
}
.gl-brand-txt small {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #C9A86A;
    margin-top: 4px;
    white-space: nowrap;
}

/* Sélecteur de société global dans la sidebar */
.gl-sidebar-company-select select {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    padding: 8px 24px 8px 32px !important;
    transition: all 0.25s ease !important;
}
.gl-sidebar-company-select select:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(201, 168, 76, 0.5) !important;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.2) !important;
}
.gl-sidebar-company-select select:focus {
    border-color: var(--gl-primary) !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 12px rgba(201, 168, 76, 0.3) !important;
}

/* Sélecteur d'exercice global dans la sidebar */
.gl-sidebar-exercice-select select {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.25s ease !important;
}
.gl-sidebar-exercice-select select:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(201, 168, 76, 0.5) !important;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.2) !important;
}
.gl-sidebar-exercice-select select:focus {
    border-color: var(--gl-primary) !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 12px rgba(201, 168, 76, 0.3) !important;
}

.gl-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--gl-sidebar-text);
    text-decoration: none;
    border-radius: var(--gl-radius);
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.gl-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.gl-nav-item.active {
    background-color: rgba(201, 168, 76, 0.15);
    color: var(--gl-primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--gl-primary);
}

.gl-nav-ico {
    flex-shrink: 0;
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.gl-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   BARRE LATÉRALE — MODE RÉDUIT (rail d'icônes, écrans larges uniquement)
   ========================================================================== */
@media (min-width: 901px) {
    .gl-layout.gl-collapsed .gl-sidebar {
        width: 76px;
    }
    .gl-layout.gl-collapsed .gl-main {
        margin-left: 76px;
        width: calc(100% - 76px);
    }
    .gl-collapsed .gl-brand-txt,
    .gl-collapsed .gl-nav-label,
    .gl-collapsed .gl-sidebar-sel label,
    .gl-collapsed .gl-sel-caret {
        display: none;
    }
    .gl-collapsed .gl-sidebar-brandrow {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        margin-bottom: 14px;
    }
    .gl-collapsed .gl-sidebar-collapse {
        margin-left: 0;
    }
    .gl-collapsed .gl-sidebar-head {
        padding: 24px 10px 14px;
    }
    .gl-collapsed .gl-sidebar-nav {
        padding: 8px 8px 12px;
    }
    .gl-collapsed .gl-sidebar-foot {
        padding: 10px 8px 16px;
    }
    .gl-collapsed .gl-nav-item {
        justify-content: center;
        padding: 10px 0;
        gap: 0;
    }
    .gl-collapsed .gl-nav-section {
        height: 1px;
        padding: 8px 0 0;
        margin: 6px 8px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
        font-size: 0;
        letter-spacing: 0;
    }
    .gl-collapsed .gl-sidebar-sel select {
        padding: 0 !important;
        color: transparent !important;
        text-align: center;
    }
    .gl-collapsed .gl-sel-ico {
        left: 0;
        right: 0;
        margin: 0 auto;
        text-align: center;
    }
}

/* ==========================================================================
   BARRE LATÉRALE — BARRE SUPÉRIEURE MOBILE + VOILE
   ========================================================================== */
.gl-mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    align-items: center;
    gap: 12px;
    height: 54px;
    padding: 0 16px;
    background: var(--gl-surface, #fff);
    border-bottom: 1px solid var(--gl-border, #E4E2DC);
}
.gl-mobile-burger {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--gl-border, #E4E2DC);
    background: var(--gl-bg, #F5F4EF);
    color: var(--gl-sidebar);
    font-size: 17px;
    cursor: pointer;
}
.gl-mobile-burger:focus-visible {
    outline: 2px solid var(--gl-primary);
    outline-offset: 2px;
}
.gl-mobile-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gl-text, #1C2620);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gl-mobile-brand {
    margin-left: auto;
    font-size: 14px;
    font-weight: 800;
    color: var(--gl-primary);
}
.gl-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 10, 0.5);
    opacity: 0;
    pointer-events: none; /* invisible = ne capte pas les taps tant que le tiroir est fermé */
    transition: opacity 0.3s ease;
    z-index: 99;
}

/* ==========================================================================
   BARRE LATÉRALE — MOBILE (tiroir masqué + hamburger)
   ========================================================================== */
@media (max-width: 900px) {
    .gl-sidebar {
        width: 280px !important;
        transform: translateX(-100%);
        box-shadow: 6px 0 30px rgba(0, 0, 0, 0.4);
    }
    .gl-sidebar.gl-open {
        transform: translateX(0);
    }
    .gl-main {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .gl-mobile-topbar {
        display: flex;
    }
    .gl-sidebar-collapse {
        display: none;
    }
    .gl-sidebar-overlay {
        display: block;
    }
    .gl-drawer-open .gl-sidebar-overlay {
        opacity: 1;
        pointer-events: auto; /* actif seulement quand le tiroir est ouvert, pour le fermer au tap */
    }
}

.gl-main {
    flex: 1;
    margin-left: 260px;
    width: calc(100% - 260px);
    min-width: 0;
    min-height: 100vh;
    padding: 32px;
    background-color: var(--gl-bg);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.gl-header h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--gl-text);
}

/* ==========================================================================
   BOUTONS
   ========================================================================== */

.btn-gl, .gl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--gl-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--gl-font);
    white-space: nowrap;
    text-decoration: none;
}

.gl-btn-primary {
    background: var(--gl-primary);
    color: var(--gl-sidebar);
}

.btn-gl-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-gl-primary {
    background: var(--gl-primary);
    color: var(--gl-sidebar);
}
.btn-gl-primary:hover {
    background: var(--gl-primary-dark);
}
.btn-gl-primary:focus {
    box-shadow: 0 0 0 3px rgba(201,168,76,0.25);
    outline: none;
}

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

.btn-gl-info {
    background: #F3F4F1;
    color: var(--gl-info);
    border-color: #E4E2DC;
}
.btn-gl-info:hover {
    background: #E4E2DC;
}

.btn-gl-secondary {
    background: white;
    color: var(--gl-text);
    border-color: var(--gl-border);
}
.btn-gl-secondary:hover {
    border-color: var(--gl-primary);
    color: var(--gl-primary-dark);
}

.btn-gl-ghost {
    background: transparent;
    color: var(--gl-text-2);
}
.btn-gl-ghost:hover {
    background: #F3F4F1;
    color: var(--gl-text);
}

.btn-gl-danger {
    background: white;
    color: var(--gl-danger);
    border-color: #FEE2E2;
}
.btn-gl-danger:hover {
    background: #FEF2F2;
    border-color: var(--gl-danger);
}

.btn-gl-danger-solid {
    background: var(--gl-danger);
    color: white;
}

.btn-gl-cancel {
    background: #F3F4F1;
    color: var(--gl-text-2);
}

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

/* ==========================================================================
   FORMULAIRES
   ========================================================================== */

/* Grilles de champs de formulaires */
.gl-field-grid, .gl-field-grid-3 {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}
.gl-field-grid {
    grid-template-columns: repeat(2, 1fr);
}
.gl-field-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.gl-field-grid > .gl-field, .gl-field-grid-3 > .gl-field {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .gl-field-grid, .gl-field-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.gl-field {
    margin-bottom: 16px;
}

.gl-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--gl-text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.gl-required {
    color: var(--gl-danger);
    margin-left: 2px;
}

.gl-input, .gl-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-family: var(--gl-font);
    background: white;
    border: 1px solid #D0CEC6;
    border-radius: var(--gl-radius);
    color: var(--gl-text);
    transition: all 0.2s ease;
    outline: none;
}

.gl-input:focus, .gl-select:focus {
    border-color: var(--gl-primary);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

.gl-input-error {
    border-color: var(--gl-danger);
}

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

.gl-help {
    font-size: 11px;
    color: #9AA89E;
    margin-top: 4px;
}

.gl-search {
    position: relative;
    display: flex;
    align-items: center;
}

.gl-search-icon {
    position: absolute;
    left: 10px;
    font-size: 12px;
    color: #9AA89E;
}

.gl-search input {
    padding-left: 32px;
    width: 100%;
    height: 34px;
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius);
    font-size: 13px;
    outline: none;
}

/* Checkbox custom */
.gl-cb {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--gl-primary);
}

/* ==========================================================================
   COMPOSANTS UI
   ========================================================================== */

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

/* Badges */
.badge-gl {
    display: inline-flex;
    padding: 3px 9px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-gl-actif { background: #DCFCE7; color: #15803D; }
.badge-gl-revision { background: #FEF3C7; color: #B45309; }
.badge-gl-impaye { background: #FEE2E2; color: #DC2626; }
.badge-gl-resilie { background: #F3F4F1; color: #5C6B60; }
.badge-gl-franchise { background: #DBEAFE; color: #1D4ED8; }

/* Tableaux */
.gl-table-wrapper {
    background: white;
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius-lg);
    overflow: hidden;
}

.gl-table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #FBFBFA;
    border-bottom: 1px solid var(--gl-border);
}

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

.gl-table {
    width: 100%;
    border-collapse: collapse;
}

.gl-th {
    background: #FBFBFA;
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 700;
    color: #9AA89E;
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid var(--gl-border);
}

.gl-th-right { text-align: right; }

.gl-td {
    padding: 9px 14px;
    font-size: 12px;
    border-bottom: 1px solid #F3F4F1;
}

.gl-tr:hover {
    background: #F5F4F0;
}

.gl-tr-selected {
    background: var(--gl-primary-light);
}

.gl-td-strong {
    font-weight: 600;
    color: var(--gl-text);
}

.gl-td-right { text-align: right; }
.gl-td-amount { font-family: var(--gl-font-mono); }

/* KPI */
.gl-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.gl-kpi-card {
    background: white;
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius-lg);
    padding: 16px 18px;
    box-shadow: var(--gl-shadow-1);
}

.gl-kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: #9AA89E;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Charte 2026 : valeur KPI alignée sur .gl-kpi-tile (30px / 600) */
.gl-kpi-value {
    font-size: 30px;
    font-weight: 600;
    color: var(--gl-sage-dark);
    margin: 8px 0 4px;
}

.gl-kpi-trend {
    font-size: 11px;
    font-weight: 600;
}

.gl-trend-up { color: var(--gl-success); }
.gl-trend-down { color: var(--gl-danger); }

/* Alerts */
.gl-alert {
    padding: 12px 16px;
    border-radius: var(--gl-radius);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.gl-alert-icon { font-weight: bold; }
.gl-alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FEF3C7; }
.gl-alert-success { background: #F0FDF4; color: #166534; border: 1px solid #DCFCE7; }
.gl-alert-danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FEE2E2; }
.gl-alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #DBEAFE; }

/* Pagination */
.gl-pagination {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 4px;
}

.gl-pagination-info {
    font-size: 11px;
    color: #9AA89E;
    margin-right: auto;
}

.gl-page-btn {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gl-border);
    border-radius: 6px;
    background: white;
    font-size: 12px;
    cursor: pointer;
}

.gl-page-btn.active {
    background: var(--gl-primary);
    border-color: var(--gl-primary);
    color: var(--gl-sidebar);
    font-weight: 700;
}

/* ==========================================================================
   LAYOUT LOGIN
   ========================================================================== */

.login-page {
    display: flex;
    min-height: 100vh;
    background: var(--gl-bg);
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, #0D1F12 0%, #1A2E1E 100%);
    color: white;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(201,168,76,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-logo-sq {
    width: 40px;
    height: 40px;
    background: var(--gl-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gl-sidebar);
    font-weight: 800;
    font-size: 18px;
}

.login-logo-text {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.login-logo-sub {
    font-size: 11px;
    color: var(--gl-sidebar-text);
    margin-top: -2px;
}

.login-logo-img {
    display: block;
    height: 72px;
    width: auto;
    margin-left: -8px; /* aligne le symbole sur le texte (marge interne du SVG) */
}
.login-form-logo {
    display: none;
    height: 64px;
    width: auto;
    margin: 0 0 24px -7px;
}

.login-hero {
    max-width: 500px;
}

.login-hero h1 {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
}

.login-hero h1 span {
    color: var(--gl-primary);
}

.login-hero p {
    font-size: 15px;
    color: var(--gl-sidebar-text);
    line-height: 1.6;
    margin-bottom: 40px;
}

.login-features {
    list-style: none;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.login-features li .check {
    color: var(--gl-primary);
    font-weight: bold;
}

.login-right {
    width: 50%;
    max-width: 600px;
    background: var(--gl-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

/* Petit écran : le panneau marque est masqué, le logo clair passe au-dessus du formulaire */
@media (max-width: 900px) {
    .login-left { display: none; }
    .login-form-logo { display: block; }
    .login-right { width: 100%; max-width: none; padding: 32px 24px; }
}

.login-header {
    margin-bottom: 32px;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--gl-text);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gl-text-2);
    font-size: 14px;
}

.login-footer-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 24px;
}

.login-link {
    color: var(--gl-primary-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 32px 0;
    color: #E4E2DC;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E4E2DC;
}

.sso-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sso-btn {
    background: white;
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gl-text);
    cursor: pointer;
    transition: all 0.2s;
}

.sso-btn:hover {
    background: #FBFBFA;
    border-color: #D0CEC6;
}

.login-bottom-text {
    margin-top: 40px;
    text-align: center;
    font-size: 12px;
    color: var(--gl-text-2);
}

.login-copyright {
    margin-top: 16px;
    text-align: center;
    font-size: 10px;
    color: #9AA89E;
}

/* Masquage des filtres de société et d'exercice locaux redondants */
#global-societe-filter,
#filter-societe,
#filterSociete,
#filter-exercice,
#filterExercice,
#filterYear,
label[for="filter-societe"],
label[for="filter-exercice"] {
    display: none !important;
}

/* ==========================================================================
   MODALE VISITE GUIDÉE (ONBOARDING PRODUCT TOUR)
   ========================================================================== */
.gl-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 18, 0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.gl-tour-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 1040px;
    height: 600px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--gl-border);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gl-tour-overlay.open .gl-tour-modal {
    transform: scale(1);
}

.gl-tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--gl-border);
    position: relative;
}

.gl-tour-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3.5px;
    background: #EAE8E2;
}

.gl-tour-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #C9A84C, #A8873A);
    transition: width 0.3s ease;
}

.gl-tour-body {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.gl-tour-left {
    background: #FAF9F6;
    border-right: 1px solid var(--gl-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.gl-tour-left-intro {
    background: linear-gradient(155deg, #1A2E1E 0%, #112015 100%);
    color: #ffffff;
    padding: 32px 28px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    overflow-y: auto;
}

.gl-tour-agenda-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0 0 4px 0;
}

.gl-tour-agenda-sub {
    font-size: 13px;
    color: #A0B0A2;
    margin: 0 0 20px 0;
}

.gl-tour-agenda-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #E2ECE4;
    transition: background 0.2s;
}

.gl-tour-agenda-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #C9A84C;
    color: #C9A84C;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.gl-tour-img-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--gl-border);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.gl-tour-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.gl-tour-right {
    padding: 28px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
    overflow-y: auto;
}

.gl-tour-step-badge {
    font-size: 11px;
    font-weight: 800;
    color: #A8873A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.gl-tour-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #1A2E1E;
    margin: 0 0 12px 0;
    line-height: 1.25;
}

.gl-tour-desc {
    font-size: 13px;
    color: #4A554D;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.gl-tour-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.gl-tour-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #1A2E1E;
    line-height: 1.45;
}

.gl-tour-check-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FBF5E6;
    color: #A8873A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    margin-top: 1px;
}

.gl-tour-guide-card {
    background: #FAF8F3;
    border: 1px solid #EADBBA;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: auto;
}

.gl-tour-guide-label {
    font-size: 10px;
    font-weight: 800;
    color: #7D6B40;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.gl-tour-guide-name {
    font-size: 13px;
    font-weight: 700;
    color: #1A2E1E;
    margin-bottom: 6px;
}

.gl-tour-guide-link {
    color: #A8873A;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color 0.2s;
}

.gl-tour-guide-link:hover {
    color: #1A2E1E;
}

.gl-tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #FAF9F6;
    border-top: 1px solid var(--gl-border);
}

.gl-tour-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gl-tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D6D4CC;
    cursor: pointer;
    transition: all 0.25s ease;
}

.gl-tour-dot.active {
    width: 24px;
    border-radius: 4px;
    background: #A8873A;
}

.gl-tour-dot:hover:not(.active) {
    background: #9AA89E;
}

@media (max-width: 900px) {
    .gl-tour-body {
        grid-template-columns: 1fr;
        grid-template-rows: 240px 1fr;
    }
    .gl-tour-modal {
        height: 90vh;
    }
}

/* ==========================================================================
   COUCHE RESPONSIVE GLOBALE — CONTENU DES MODULES (mobile / tablette ≤ 900px)
   La sidebar passe en tiroir ; le contenu doit se réagencer sur toute la
   largeur. Beaucoup de styles étant définis localement dans les pages
   (chargés après ce fichier), on cible avec un !important limité au mobile.
   ========================================================================== */
@media (max-width: 900px) {
    /* Garde-fou anti-débordement horizontal (clip = pas de conteneur de
       défilement, donc la barre supérieure sticky reste fonctionnelle) */
    .gl-main { max-width: 100vw; overflow-x: clip; }

    /* En-tête de page : titre + actions empilés */
    .gl-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px !important;
    }
    .gl-page-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .gl-page-title { font-size: 20px !important; }

    /* Barres de filtres / outils : passage à la ligne */
    .gl-filterbar,
    .gl-table-toolbar {
        flex-wrap: wrap;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    .gl-filterbar > *,
    .gl-table-toolbar > * { min-width: 0; }
    .gl-toolbar-right { margin-left: 0; }
    .gl-filterbar .gl-select,
    .gl-filterbar .gl-input,
    .gl-filterbar select,
    .gl-filterbar input {
        flex: 1 1 160px;
        min-width: 0;
        max-width: 100%;
    }

    /* Grilles : réduction du nombre de colonnes */
    .gl-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    .gl-field-grid,
    .gl-field-grid-3 { grid-template-columns: 1fr !important; }

    /* Onglets : défilement horizontal plutôt que débordement */
    .gl-param-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    .gl-param-tab,
    .gl-tab-btn { flex-shrink: 0; }

    /* Tableaux : se réajustent à la largeur, débordement défilable */
    .gl-table-wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .gl-card { overflow-x: auto; }
    .gl-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .gl-th, .gl-td { padding: 8px 10px; }

    /* Modales : quasi plein écran, défilables */
    .gl-modal-container {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px) !important;
        margin: 12px !important;
        overflow-y: auto !important;
    }
    .gl-modal-body { max-height: none !important; }
    .gl-modal-footer { flex-wrap: wrap; }
    .gl-modal-footer .gl-btn { flex: 1 1 auto; }
}

/* ==========================================================================
   SYSTÈME CANONIQUE 2026 — CHARTE UI PARTAGÉE (référence : module Utilisateurs)
   Classes 100% nouvelles (aucune collision avec l'existant). Ajoutées en fin de
   fichier volontairement : priorité de cascade maximale, zéro interférence.
   Le figeage (sticky) est OPT-IN via .gl-table--sticky / la classe .gl-head.
   ========================================================================== */

/* --- En-tête de page : bloc unique figé (fil d'ariane + titre + actions + onglets) --- */
.gl-head {
    background: var(--gl-surface);
    border-bottom: 1px solid var(--gl-border);
    padding: 20px 30px 0;
    position: sticky;
    top: 0;
    z-index: 40;
    transition: box-shadow 0.2s ease;
}
.gl-head.is-stuck { box-shadow: var(--gl-shadow-stuck); }
.gl-crumb { font-size: 11.5px; color: var(--gl-muted, #9AA89E); letter-spacing: 0.02em; }
.gl-crumb b { color: var(--gl-text-2); font-weight: 500; }
.gl-titlerow {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 8px;
}
.gl-title {
    font-family: var(--gl-serif);
    font-weight: 600;
    font-size: 34px;
    line-height: 1.05;
    margin: 0;
    color: var(--gl-sage-dark);
}
.gl-lede { color: var(--gl-text-2); font-size: 13px; margin-top: 6px; }
.gl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Onglets canoniques : soulignement doré + pastille de comptage --- */
.gl-tabs {
    display: flex;
    gap: 24px;
    margin-top: 14px;
    border-bottom: 1px solid var(--gl-border);
}
.gl-tab {
    border: 0;
    background: none;
    padding: 12px 0 14px;
    font-family: var(--gl-font);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--gl-text-2);
    display: flex;
    align-items: center;
    gap: 9px;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
}
.gl-tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: transparent;
}
.gl-tab:hover { color: var(--gl-sage-dark); }
.gl-tab.active { color: var(--gl-sage-dark); font-weight: 600; }
.gl-tab.active::after { background: var(--gl-primary); }
.gl-tab .gl-tab-count {
    font-size: 11px;
    font-weight: 600;
    background: #F4F3EE;
    color: var(--gl-text-2);
    padding: 2px 8px;
    border-radius: 20px;
}
.gl-tab.active .gl-tab-count { background: var(--gl-primary-light); color: var(--gl-primary-dark); }

/* --- Rangée KPI canonique figeable (.gl-kpi-row : nom distinct de l'ancien .gl-kpi-grid) --- */
.gl-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.gl-kpi-row.is-sticky {
    position: sticky;
    top: var(--gl-top-kpi);
    z-index: 30;
    background: var(--gl-bg);
    padding: 16px 30px;
    margin: 0 -30px 20px;
    transition: box-shadow 0.2s ease;
}
.gl-kpi-row.is-sticky.is-stuck { box-shadow: var(--gl-shadow-stuck); }

/* Figeage KPI pour les grilles legacy .gl-kpi-grid (enfant direct d'un conteneur haut) */
.gl-kpi-grid.is-sticky {
    position: sticky;
    top: var(--gl-top-kpi);
    z-index: 30;
    background: var(--gl-bg);
    padding-top: 14px;
    padding-bottom: 14px;
    transition: box-shadow 0.2s ease;
}
.gl-kpi-grid.is-sticky.is-stuck { box-shadow: var(--gl-shadow-stuck); }

/* Figeage des KPI « bespoke » (sociétés .so-kpis, indices .kpi-row, paramétrage .up-kpis) */
.so-kpis.is-sticky, .up-kpis.is-sticky, .kpi-row.is-sticky {
    position: sticky;
    top: var(--gl-top-kpi);
    z-index: 30;
    transition: box-shadow 0.2s ease;
}
/* Grilles à cartes séparées : fond de bande pour masquer le contenu qui défile dessous */
.up-kpis.is-sticky, .kpi-row.is-sticky {
    background: var(--gl-bg);
    padding-top: 12px;
    padding-bottom: 12px;
}
.so-kpis.is-sticky.is-stuck, .up-kpis.is-sticky.is-stuck, .kpi-row.is-sticky.is-stuck { box-shadow: var(--gl-shadow-stuck); }

.gl-kpi-tile {
    background: var(--gl-surface);
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius-lg);
    padding: 16px 18px;
    box-shadow: var(--gl-shadow-1);
}
.gl-kpi-tile.on { background: var(--gl-primary-light); border-color: var(--gl-primary-border); }
.gl-kpi-tile .lab {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    color: var(--gl-muted, #9AA89E);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.gl-kpi-tile .v {
    font-size: 30px;
    font-weight: 600;
    line-height: 1;
    color: var(--gl-sage-dark);
    margin: 10px 0 6px;
}
.gl-kpi-tile .v small { font-size: 14px; color: var(--gl-muted, #9AA89E); font-weight: 500; }
.gl-kpi-tile .h { font-size: 12px; color: var(--gl-text-2); }
.gl-kpi-tile .h.warn { color: var(--gl-warning); }

/* --- Tableau : figeage OPT-IN de l'en-tête de colonnes et du pied de totaux --- */
.gl-table--sticky thead th {
    position: sticky;
    top: var(--gl-top-thead);
    background: var(--gl-bg-light, #FBFBFA); /* fond opaque obligatoire une fois figé */
    z-index: 5;
}
.gl-table--sticky tfoot td {
    position: sticky;
    bottom: 0;
    background: var(--gl-primary-light);
    border-top: 2px solid var(--gl-primary-border);
    font-weight: 700;
    color: var(--gl-sage-dark);
    z-index: 4;
}

@media (max-width: 900px) {
    .gl-head { padding-left: 16px; padding-right: 16px; }
    .gl-title { font-size: 28px; }
    .gl-tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .gl-tab { flex-shrink: 0; }
    .gl-kpi-row { grid-template-columns: 1fr 1fr; }
    .gl-kpi-row.is-sticky { padding-left: 16px; padding-right: 16px; margin-left: -16px; margin-right: -16px; }
}

