/* ============================================================================
   BACK OFFICE GESTION - Feuille de style globale
   Reprend le theme opaddock (vert emeraude, slate, Inter, radius, ombres).
   Layout : sidebar fixe + topbar + contenu. 100% responsive.
   ============================================================================ */

:root {
    --primary-50:     #ecfdf5;
    --primary-100:    #d1fae5;
    --primary-200:    #a7f3d0;
    --primary-300:    #6ee7b7;
    --primary-light:  #34d399;
    --primary:        #10b981;
    --primary-rgb:    16,185,129;
    --primary-dark:   #059669;
    --primary-darker: #047857;
    --primary-800:    #065f46;
    --primary-900:    #064e3b;

    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --amber-50:  #fffbeb;  --amber-100: #fef3c7; --amber-500: #f59e0b; --amber-700: #b45309;
    --red-50:    #fef2f2;  --red-100:   #fee2e2; --red-500:   #ef4444; --red-700:   #b91c1c;
    --blue-50:   #eff6ff;  --blue-100:  #dbeafe; --blue-500:  #3b82f6; --blue-700:  #1d4ed8;

    --shadow-soft: 0 4px 12px rgba(15,23,42,.05);
    --shadow-md:   0 10px 30px rgba(15,23,42,.08);
    --shadow-lg:   0 20px 50px rgba(15,23,42,.12);
    --ease:        cubic-bezier(0.25,0.46,0.45,0.94);

    --sidebar-w: 264px;
    --topbar-h:  64px;
}

* { box-sizing: border-box; }

/* ============================================================================
   `hidden` DOIT VRAIMENT CACHER (25/09/2026)
   ----------------------------------------------------------------------------
   L'attribut HTML `hidden` n'est qu'une regle `[hidden] { display: none }` de la
   feuille de style DU NAVIGATEUR. N'importe quelle regle d'AUTEUR la bat -- une
   simple classe suffit. Donc un element qui porte `display: flex` dans cette
   feuille reste VISIBLE quoi que fasse `el.hidden = true` : le JavaScript croit
   l'avoir cache, l'ecran montre le contraire, et rien ne le signale.

   C'est le defaut signale le 25/09/2026 sur « Devis, factures & avoirs » :
   `.g-infini-charge` et `.g-infini-err` portent `display: flex`, si bien que la
   liste affichait EN MEME TEMPS « Chargement... », le bouton « Reessayer » et
   « Fin de la liste · 22 documents ». Aucun chargement n'etait en cours, aucune
   erreur ne s'etait produite : les deux blocs n'avaient jamais ete caches.

   Ce n'etait pas la premiere fois -- `style_fiche.css` porte deja un
   `.fic-tab-warn[hidden] { display: none; }`, le meme piege rustine au cas par
   cas. Une garde par composant se re-oublie au suivant (CLAUDE.md 00a) : la
   regle vit ici, une fois, et couvre les ~10 ecrans du back-office qui
   basculent des elements par `hidden`.

   `!important` est ici LEGITIME et necessaire : il doit gagner contre toute
   regle d'auteur presente ET future, y compris plus specifique. C'est la seule
   facon d'obtenir le comportement que l'attribut est cense avoir.
   Pour montrer un element, on lui RETIRE `hidden` -- on ne lui pose pas un
   `display` par-dessus.
   ============================================================================ */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--slate-800);
    background: var(--slate-50);
    -webkit-font-smoothing: antialiased;
    font-size: 14.5px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--slate-900); font-weight: 700; }

/* ============================== SHELL ============================== */
.g-shell { display: flex; min-height: 100vh; }

/* ============================== SIDEBAR ============================== */
.g-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--slate-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    z-index: 60;
}
.g-sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--slate-100);
}
.g-logo { display: flex; align-items: center; gap: 11px; }
.g-logo-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; display: grid; place-items: center; font-size: 21px;
    box-shadow: 0 6px 16px rgba(var(--primary-rgb),.32);
}
.g-logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.g-logo-text strong { font-size: 16px; color: var(--slate-900); letter-spacing: -.3px; }
.g-logo-text small { font-size: 11px; color: var(--primary-dark); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.g-sidebar-close { display: none; background: none; border: none; font-size: 22px; color: var(--slate-400); cursor: pointer; }

.g-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.g-nav-group { margin-bottom: 14px; }
.g-nav-group-title {
    display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .7px; color: var(--slate-400); padding: 8px 12px 4px;
}
.g-nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 11px; margin: 1px 0;
    color: var(--slate-600); font-weight: 500; font-size: 14px;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.g-nav-link i { font-size: 20px; color: var(--slate-400); transition: color .15s; width: 22px; text-align: center; }
.g-nav-link:hover { background: var(--slate-100); color: var(--slate-900); }
.g-nav-link:hover i { color: var(--slate-600); }
.g-nav-link.is-active { background: var(--primary-50); color: var(--primary-darker); font-weight: 600; }
.g-nav-link.is-active i { color: var(--primary); }

.g-sidebar-foot {
    border-top: 1px solid var(--slate-100);
    padding: 12px 14px; display: flex; align-items: center; gap: 10px;
}
.g-user-mini { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.g-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.g-avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.g-user-mini-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.g-user-mini-text strong { font-size: 13.5px; color: var(--slate-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-user-mini-text small { font-size: 11.5px; color: var(--slate-400); }
.g-logout {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: grid; place-items: center; color: var(--slate-500);
    background: var(--slate-100); font-size: 18px; transition: .15s;
}
.g-logout:hover { background: var(--red-100); color: var(--red-700); }

.g-sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 55;
    background: rgba(255,255,255,.35); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.g-sidebar-backdrop.open { display: block; }

/* ============================== MAIN ============================== */
.g-main {
    flex: 1; min-width: 0; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
}
.g-topbar {
    height: var(--topbar-h); position: sticky; top: 0; z-index: 40;
    background: rgba(255,255,255,.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--slate-200);
    display: flex; align-items: center; gap: 14px; padding: 0 24px;
}
.g-burger { display: none; background: none; border: none; font-size: 24px; color: var(--slate-700); cursor: pointer; padding: 4px; }
.g-topbar-title { font-size: 18px; font-weight: 700; flex: 1; letter-spacing: -.3px; }
.g-topbar-actions { display: flex; align-items: center; gap: 14px; }
.g-topbar-user { display: flex; align-items: center; gap: 9px; }
.g-topbar-user-name { font-size: 13.5px; font-weight: 600; color: var(--slate-700); }

.g-content { padding: 26px 28px 60px; max-width: 1340px; width: 100%; }

/* ============================== PAGE HEADER ============================== */
.g-page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.g-page-head-text h2 { font-size: 24px; letter-spacing: -.5px; }
.g-page-head-text p { margin: 5px 0 0; color: var(--slate-500); font-size: 14px; }

/* ============================== BUTTONS ============================== */
.g-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 11px; border: 1.5px solid transparent;
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: .15s var(--ease); white-space: nowrap;
}
.g-btn i { font-size: 18px; }
.g-btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(var(--primary-rgb),.28); }
.g-btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.g-btn-ghost { background: #fff; border-color: var(--slate-200); color: var(--slate-700); }
.g-btn-ghost:hover { border-color: var(--slate-300); background: var(--slate-50); }
.g-btn-danger { background: var(--red-500); color: #fff; }
.g-btn-danger:hover { background: var(--red-700); }
.g-btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.g-btn-icon { padding: 9px; width: 38px; height: 38px; }
.g-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ============================== CARDS ============================== */
.g-card {
    background: #fff; border: 1px solid var(--slate-200); border-radius: 16px;
    box-shadow: var(--shadow-soft);
}
.g-card-pad { padding: 22px; }
.g-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--slate-100);
}
.g-card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 9px; }
.g-card-head h3 i { color: var(--primary); font-size: 20px; }

/* ============================== STAT CARDS ============================== */
.g-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.g-stat {
    background: #fff; border: 1px solid var(--slate-200); border-radius: 16px;
    padding: 18px 20px; box-shadow: var(--shadow-soft); display: flex; align-items: center; gap: 16px;
}
.g-stat-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.g-stat-icon.green { background: var(--primary-50); color: var(--primary-dark); }
.g-stat-icon.amber { background: var(--amber-50); color: var(--amber-700); }
.g-stat-icon.red   { background: var(--red-50); color: var(--red-700); }
.g-stat-icon.blue  { background: var(--blue-50); color: var(--blue-700); }
.g-stat-icon.slate { background: var(--slate-100); color: var(--slate-600); }
.g-stat-body { min-width: 0; }
.g-stat-value { font-size: 26px; font-weight: 800; color: var(--slate-900); letter-spacing: -1px; line-height: 1; }
.g-stat-label { font-size: 13px; color: var(--slate-500); margin-top: 4px; }

/* ============================== TOOLBAR / FILTERS ============================== */
.g-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.g-search {
    position: relative; flex: 1; min-width: 220px; max-width: 420px;
}
.g-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--slate-400); font-size: 19px; }
.g-search input {
    width: 100%; padding: 11px 14px 11px 42px; border: 1.5px solid var(--slate-200);
    border-radius: 11px; font-family: inherit; font-size: 14px; background: #fff; color: var(--slate-800);
}
.g-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); }
.g-filter {
    padding: 11px 14px; border: 1.5px solid var(--slate-200); border-radius: 11px;
    font-family: inherit; font-size: 14px; background: #fff; color: var(--slate-700); cursor: pointer;
}
.g-filter:focus { outline: none; border-color: var(--primary); }
/* Variante COURTE, pour un champ dont on sait qu'il porte deux ou trois signes
   (debut de code postal). A la largeur des autres filtres, il laisserait croire
   qu'on y saisit une adresse entiere. `text-align` centre la saisie courte, qui
   flotterait sinon a gauche d'un champ presque vide. */
.g-filter-cp { width: 108px; text-align: center; cursor: text; }
.g-filter-cp::placeholder { text-align: center; font-size: 13px; }

/* ============================== TABLE ============================== */
.g-table-wrap { background: #fff; border: 1px solid var(--slate-200); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-soft); }
.g-table-scroll { overflow-x: auto; }
.g-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.g-table thead th {
    text-align: left; padding: 13px 18px; font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--slate-500); background: var(--slate-50); border-bottom: 1px solid var(--slate-200);
    white-space: nowrap;
}
.g-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); vertical-align: middle; }
.g-table tbody tr:last-child td { border-bottom: none; }
.g-table tbody tr { transition: background .12s; }
.g-table tbody tr:hover { background: var(--slate-50); }
.g-table .g-td-strong { font-weight: 600; color: var(--slate-900); }
.g-table .g-td-right { text-align: right; }
.g-table .g-td-sub { font-size: 12.5px; color: var(--slate-400); }
.g-row-link { cursor: pointer; }

/* ============================== BADGES ============================== */
.g-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.g-badge i { font-size: 13px; }
.g-badge.green { background: var(--primary-50); color: var(--primary-darker); }
.g-badge.amber { background: var(--amber-50); color: var(--amber-700); }
.g-badge.red   { background: var(--red-50); color: var(--red-700); }
.g-badge.blue  { background: var(--blue-50); color: var(--blue-700); }
.g-badge.slate { background: var(--slate-100); color: var(--slate-600); }

/* ============================== FORMS ============================== */
.g-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.g-field { display: flex; flex-direction: column; gap: 6px; }
.g-field.full { grid-column: 1 / -1; }
.g-label { font-size: 13px; font-weight: 600; color: var(--slate-700); }
.g-label .g-opt { color: var(--slate-400); font-weight: 400; }
.g-input, .g-textarea, .g-select-native {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--slate-200); border-radius: 11px;
    font-family: inherit; font-size: 14px; background: #fff; color: var(--slate-800); transition: .15s;
}
.g-textarea { resize: vertical; min-height: 90px; }
.g-input:focus, .g-textarea:focus, .g-select-native:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); }
.g-form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.g-hint { font-size: 12.5px; color: var(--slate-400); }

/* ============================== EMPTY STATE ============================== */
.g-empty { text-align: center; padding: 56px 20px; color: var(--slate-400); }
.g-empty i { font-size: 46px; color: var(--slate-300); margin-bottom: 12px; display: block; }
.g-empty p { margin: 0; font-size: 15px; }

/* ============================== PAGINATION ============================== */
.g-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.g-pagination-info { font-size: 13px; color: var(--slate-500); }
.g-pagination-btns { display: flex; gap: 8px; }

/* ============================================================================
   SCROLL INFINI DES LISTES (apps/gestion/js/gestion_infinite.js)
   ----------------------------------------------------------------------------
   Le pied remplace le bandeau « Page N / M » : il dit ce qui est charge, ce qui
   reste, et -- surtout -- quand le chargement a ECHOUE. Un scroll infini muet se
   lit « il n'y a plus rien » : c'est le defaut qu'on corrige, pas une gene.
   ========================================================================== */
.g-infini-pied {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    flex-wrap: wrap; min-height: 30px; margin-top: 14px;
    font-size: 13px; color: var(--slate-500);
}
.g-infini-charge { display: flex; align-items: center; gap: 9px; }
.g-infini-spin {
    width: 15px; height: 15px; flex: 0 0 15px; border-radius: 50%;
    border: 2px solid var(--slate-200); border-top-color: var(--primary);
    animation: g-infini-tourne .7s linear infinite;
}
@keyframes g-infini-tourne { to { transform: rotate(360deg); } }
/* Une animation qui tourne en boucle est exactement ce que `prefers-reduced-
   motion` vise : on garde un temoin visible, on arrete la rotation. */
@media (prefers-reduced-motion: reduce) {
    .g-infini-spin { animation: none; border-top-color: var(--primary); opacity: .65; }
}
.g-infini-err {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    padding: 9px 14px; border-radius: 12px;
    background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
}
.g-infini-compte { color: var(--slate-400); }
.g-infini-sentinelle { height: 1px; }

/* « Tout afficher » : le bouton dit COMBIEN il va charger avant de le faire. */
.g-infini-tout { display: flex; justify-content: center; margin-top: 12px; }

/* ============================== FICHE (detail) ============================== */
.g-detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.g-detail-side { position: sticky; top: calc(var(--topbar-h) + 18px); display: flex; flex-direction: column; gap: 18px; }
.g-info-list { display: flex; flex-direction: column; }
.g-info-row { display: flex; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--slate-100); font-size: 14px; }
.g-info-row:last-child { border-bottom: none; }
.g-info-row .g-info-k { width: 150px; flex-shrink: 0; color: var(--slate-500); font-weight: 500; }
.g-info-row .g-info-v { color: var(--slate-900); font-weight: 500; word-break: break-word; }
.g-section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--slate-400); font-weight: 700; margin: 4px 0 2px; }

/* Bandeau alerte (validation opaddock, etc.) */
.g-alert { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: 14px; margin-bottom: 20px; }
.g-alert i { font-size: 24px; margin-top: 1px; }
.g-alert-text { flex: 1; }
.g-alert-text strong { display: block; font-size: 15px; margin-bottom: 2px; }
.g-alert-text p { margin: 0; font-size: 13.5px; opacity: .9; }
.g-alert.amber { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }
.g-alert.red { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-100); }
.g-alert.green { background: var(--primary-50); color: var(--primary-darker); border: 1px solid var(--primary-100); }
.g-alert.blue { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }

/* --- Bascule de vues / onglets de rubrique ----------------------------------
   LE composant segmente du back-office. Il existait en DEUX exemplaires le
   22/09/2026 : `.g-tabs` employe par les factures de prelevement mais ecrit
   NULLE PART (donc rendu en boutons bruts), et une bascule locale a l'agenda.
   Un seul ici, et les deux ecrans s'en servent (§00a).

   Ce n'est PAS un groupe de boutons : c'est un choix unique, et il doit se lire
   comme tel -- un fond commun, et l'element actif detache en blanc. Trois
   boutons cote a cote ne diraient pas lequel est en cours. */
.g-tabs {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--slate-100); border-radius: 12px;
    margin-bottom: 16px; max-width: 100%; flex-wrap: wrap;
}
.g-tab {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 14px; border-radius: 9px;
    font-size: 13.5px; font-weight: 600; color: var(--slate-600);
    text-decoration: none; white-space: nowrap; border: 0; background: none;
    font-family: inherit; cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.g-tab i { font-size: 17px; }
.g-tab:hover { color: var(--slate-900); }
/* L'onglet courant ne se clique pas : un lien qui recharge la page ou l'on est
   deja ne fait que la faire clignoter. */
.g-tab.est-actif {
    background: #fff; color: var(--primary-dark);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
    pointer-events: none;
}

/* ============================== RESPONSIVE ============================== */
@media (max-width: 1024px) {
    .g-detail-grid { grid-template-columns: 1fr; }
    .g-detail-side { position: static; }
}
@media (max-width: 860px) {
    .g-sidebar { transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
    .g-sidebar.open { transform: translateX(0); }
    .g-sidebar-close { display: block; }
    .g-main { margin-left: 0; }
    .g-burger { display: block; }
    .g-content { padding: 20px 16px 56px; }
    .g-form-grid { grid-template-columns: 1fr; }
    .g-topbar-user-name { display: none; }
}
@media (max-width: 520px) {
    .g-page-head-text h2 { font-size: 21px; }
    .g-stat-value { font-size: 23px; }
    .g-content { padding: 16px 12px 50px; }
}

/* ============================== AUTH (login / setup) ============================== */
.g-auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, var(--primary-50), var(--slate-50)); }
.g-auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--slate-200);
    border-radius: 22px; box-shadow: var(--shadow-lg); padding: 34px 32px; }
.g-auth-logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 22px; }
.g-auth-logo .g-logo-mark { width: 46px; height: 46px; font-size: 24px; }
.g-auth-logo strong { font-size: 20px; letter-spacing: -.4px; }
.g-auth-title { text-align: center; font-size: 21px; margin-bottom: 6px; }
.g-auth-sub { text-align: center; color: var(--slate-500); font-size: 14px; margin-bottom: 26px; }
.g-auth-card .g-field { margin-bottom: 16px; }
.g-auth-card .g-btn-primary { width: 100%; padding: 12px; }
.g-auth-error { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-100);
    border-radius: 11px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 18px; display: flex; align-items: center; gap: 9px; }

/* ============================================================================
   UI POLISH GLOBAL - inputs, selects, icones, cartes (toute l'app gestion)
   ============================================================================ */

/* --- Selects natifs : chevron SVG custom + padding pour la fleche --- */
.g-select-native, .g-filter, select.g-input {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 38px !important; cursor: pointer;
}
.g-select-native:hover, .g-filter:hover { border-color: var(--slate-300); }

/* --- Inputs : transition + hover + focus plus doux --- */
.g-input, .g-textarea, .g-select-native, .g-filter, .g-search input {
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.g-input:hover, .g-textarea:hover { border-color: var(--slate-300); }
.g-input::placeholder, .g-textarea::placeholder { color: var(--slate-400); }

/* --- Champ avec icone a gauche --- */
.g-input-icon { position: relative; }
.g-input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--slate-400); font-size: 18px; pointer-events: none; transition: color .15s; }
.g-input-icon > .g-input { padding-left: 40px; }
.g-input-icon:focus-within > i { color: var(--primary); }

/* --- Label avec icone --- */
.g-label i { font-size: 15px; color: var(--slate-400); margin-right: 3px; vertical-align: -2px; }

/* --- Date inputs : icone calendrier teintee --- */
input[type="date"].g-input::-webkit-calendar-picker-indicator,
input[type="date"].g-filter::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; transition: opacity .15s; }
input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* --- Boutons : leger relief + active --- */
.g-btn { letter-spacing: .1px; }
.g-btn:active { transform: translateY(0) scale(.985); }
.g-btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.g-btn-ghost:hover i { color: var(--primary); }

/* --- Cartes : ombre + survol --- */
.g-card { transition: box-shadow .2s ease, transform .2s ease; }

/* --- Lignes de tableau : survol plus marque + curseur --- */
.g-table tbody tr.g-row-link { transition: background .12s ease; }
.g-table tbody tr.g-row-link:hover { background: var(--primary-50); }

/* --- Badges : pleins, arrondis, icone alignee --- */
.g-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; letter-spacing: .1px; }
.g-badge i { font-size: 14px; }

/* --- Toolbar : aere --- */
.g-toolbar { gap: 10px; align-items: center; flex-wrap: wrap; }

/* --- Scrollbar fine (webkit) --- */
.g-table-scroll::-webkit-scrollbar, .eqm-modal-body::-webkit-scrollbar { height: 9px; width: 9px; }
.g-table-scroll::-webkit-scrollbar-thumb, .eqm-modal-body::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }

/* --- Titres de section --- */
.g-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); margin: 18px 0 10px; display: flex; align-items: center; gap: 7px; }
.g-section-title::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(var(--primary), var(--primary-dark)); }

/* ============================================================================
   DEMANDES DE DEMO -- carte de correspondance client (modal de validation)
   ----------------------------------------------------------------------------
   La carte n'est pas un lien vers la fiche : c'est une ACTION, elle rattache la
   demande a ce client. Elle doit donc se comporter comme un bouton -- surlignage
   au survol, focus visible -- et non comme un bloc de texte.
   ========================================================================== */
.g-demo-dup {
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.g-demo-dup:hover {
    border-color: var(--primary, #10b981);
    background: var(--primary-50, #ecfdf5);
    box-shadow: 0 2px 10px rgba(var(--primary-rgb, 16 185 129), .12);
}
.g-demo-dup:focus-visible {
    outline: 2px solid var(--primary, #10b981);
    outline-offset: 2px;
}
/* Le lien « Ouvrir la fiche » reste une issue secondaire : il ne doit pas
   ressembler a l'action principale. */
.g-demo-dup a {
    color: var(--slate-500, #64748b);
}
.g-demo-dup a:hover {
    color: var(--primary-dark, #059669);
}

/* ============================================================================
   CINQ COMPOSANTS QUI ÉTAIENT EMPLOYÉS SANS JAMAIS AVOIR ÉTÉ ÉCRITS
   ----------------------------------------------------------------------------
   Trois écrans du back-office — Statistiques EquiQuiz, Audience des sites et
   Factures des prélèvements — utilisaient `.g-kpis`, `.g-kpi-n`, `.g-kpi-l`,
   `.g-card-head-sub` et `.g-empty-sub`. Aucune de ces cinq classes n'avait la
   moindre règle : les chiffres clés s'affichaient donc en texte courant dans
   une boîte blanche, et le sous-titre d'une rubrique en gris de paragraphe.
   Le défaut ne lève rien — la page s'affiche, simplement sans style.

   Les règles vivent ICI, dans la feuille partagée, et pas dans chaque page :
   un quatrième écran qui reprendra ce markup sera correct sans rien ajouter.
   ========================================================================== */

/* --- Barre de filtres d'un écran -------------------------------------------
   Le markup de ces pages est `<label>Libellé<input></label>` : le libellé est
   un simple nœud de texte, sans élément pour le porter. On le met donc en
   forme par le `label` lui-même plutôt que d'exiger la réécriture de chaque
   champ — toute la barre devient correcte d'un coup, et une page qui ajoute un
   filtre demain n'a rien de plus à faire que de l'écrire comme les autres. */
.g-filters {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 14px 16px; align-items: end; padding: 18px 20px;
}
/* `label` et non `> label` : certaines barres enveloppent un champ dans un
   `<div>` pour lui adjoindre une note. `:not(.eqm-chk)` protège les cases à
   cocher, qui ont leur propre composant (§17) et sont en ligne, pas en colonne. */
.g-filters label:not(.eqm-chk) {
    display: flex; flex-direction: column; gap: 6px; min-width: 0;
    font-size: 13px; font-weight: 600; color: var(--slate-700);
}
.g-filters input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.g-filters select {
    width: 100%; padding: 10px 13px; border: 1.5px solid var(--slate-200);
    border-radius: 11px; font-family: inherit; font-size: 14px; font-weight: 500;
    background: #fff; color: var(--slate-800);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.g-filters input:hover, .g-filters select:hover { border-color: var(--slate-300); }
.g-filters input:focus, .g-filters select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
}
/* Même chevron que partout ailleurs (cf. « UI POLISH GLOBAL » plus haut) :
   un select natif non habillé jure à côté des champs texte voisins. */
.g-filters select {
    -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
    padding-right: 36px;
}
.g-filters input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer; opacity: .5; transition: opacity .15s;
}
.g-filters input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }
/* Le bouton ne porte pas de libellé au-dessus : sans cette hauteur il flotte
   au-dessus de la ligne des champs au lieu de s'aligner dessus. Et `justify-self`
   l'empêche de s'étirer sur toute une colonne `1fr` — il deviendrait alors la
   chose la plus large de l'écran, avant les données (constat de l'écran des
   factures de prélèvement, qui compensait par un `<div>` enveloppant). */
.g-filters > .g-btn, .g-filters > div > .g-btn { height: 42px; justify-self: start; }
.g-filters > .g-btn { align-self: end; }
/* Le champ de RECHERCHE merite deux colonnes : c'est celui ou l'on tape une
   phrase, la ou les voisins portent une date ou un choix. A largeur egale, il
   tronque le nom du client des le premier mot. */
.g-filters .g-f-grow { grid-column: span 2; }
@media (max-width: 640px) { .g-filters .g-f-grow { grid-column: auto; } }
.g-filters .g-btn:not(.g-btn-ghost):not(.g-btn-danger):not(.g-btn-primary) {
    color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), .26);
}
.g-filters .g-btn:not(.g-btn-ghost):not(.g-btn-danger):hover { transform: translateY(-1px); }

/* --- Tuiles de chiffres clés ------------------------------------------------
   Variante compacte de `.g-stat` (sans badge d'icône), pour les bandeaux de
   six à huit indicateurs où une icône par tuile n'apporte rien. Les valeurs
   typographiques sont volontairement CELLES de `.g-stat-value` / `-label` :
   deux tailles différentes pour le même rôle se verraient d'un écran à l'autre. */
.g-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 14px; margin-bottom: 16px;
}
.g-kpis > .g-card { padding: 16px 18px; }
.g-kpi-n {
    font-size: 26px; font-weight: 800; color: var(--slate-900);
    letter-spacing: -1px; line-height: 1.1;
}
.g-kpi-l { font-size: 13px; color: var(--slate-500); margin-top: 5px; }

/* --- Sous-titre d'une rubrique ---------------------------------------------
   `margin-left: auto` le pousse à droite MÊME si le titre n'est pas enveloppé
   dans un `<h3>` : sans cela, un titre resté en nœud de texte devient un
   troisième élément flex et `space-between` le renvoie au milieu de la barre —
   c'est exactement ce que montrait l'écran des statistiques EquiQuiz. */
.g-card-head-sub {
    margin-left: auto; text-align: right; flex-shrink: 0;
    font-size: 12.5px; font-weight: 500; color: var(--slate-400); line-height: 1.35;
}

/* --- Deuxième ligne d'un état vide ------------------------------------------
   `.g-empty p` impose 15px : on cible donc `p.g-empty-sub` pour gagner en
   spécificité sans recourir à `!important`. */
.g-empty p.g-empty-sub {
    margin-top: 8px; font-size: 13px; color: var(--slate-400); max-width: 46ch;
    margin-left: auto; margin-right: auto;
}

@media (max-width: 640px) {
    .g-filters { grid-template-columns: 1fr; padding: 16px; }
    .g-kpis    { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .g-kpi-n   { font-size: 22px; }
}

/* ============================================================================
   LIEN VERS LA FICHE D'UN COMPTE, depuis n'importe quelle liste
   ----------------------------------------------------------------------------
   Il doit se voir comme un lien SANS crier : dans une colonne de noms, un
   soulignement permanent sur chaque ligne fait un mur de traits. Le nom reste
   en couleur de texte, et le soulignement vient au survol.
   ========================================================================== */
.g-lien-compte { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--slate-300); }
.g-lien-compte:hover,
.g-lien-compte:focus-visible { color: var(--primary-dark); border-bottom-color: var(--primary); }
.g-lien-compte:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
