/* =====================================================================================
   RH-1 — TRÉSORERIE DU PERSONNEL.

   ⚠️⚠️ TOUS les sélecteurs sont préfixés « rh- » et AUCUN conteneur partagé n'est stylé.
   La leçon T-UI est fraîche : styler `.btn-filtres` puis `.crud-toolbar-actions` a cassé DEUX
   FOIS des écrans que la tranche ne touchait pas (le bouton « Filtres » de toutes les listes,
   puis l'écran Commissions dont les champs de date se sont recouverts). Un sélecteur partagé
   couple autant qu'un composant partagé.

   ⚠️ `thead { top: 0 }` et JAMAIS 64px : les tables de la fiche vivent dans un conteneur à
   défilement propre, où `position: sticky` se cale sur LUI. Un `top: 64px` y poserait l'en-tête
   64 px sous le haut du tableau, EN PERMANENCE par-dessus la première ligne — c'est le défaut
   qui a masqué une ligne sur deux des états par commercial (retour terrain n°1).
   ===================================================================================== */

.rh-page {
    max-width: 1280px;
    margin: 0 auto;
}

.rh-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.rh-title {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    margin: 2px 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rh-head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- Badge « Sans charges » : DISCRET, gris neutre, jamais une alerte -------------
   Ne pas déclarer de charges sociales est le cas MAJORITAIRE du marché cible : le badge
   informe, il ne signale pas une anomalie. Et il n'a pas de pendant « Avec charges » —
   l'autre cas se lit à la fiche. */
.rh-badge-charges {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--slate);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    vertical-align: middle;
    margin-left: 6px;
}

.rh-cin {
    font-size: 11.5px;
    color: var(--slate);
    margin-left: 8px;
}

.rh-lien {
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.rh-lien:hover {
    color: var(--teal-dark);
    text-decoration: underline;
}

/* ---- Mode de rémunération ---- */
.rh-mode {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 2px 8px;
    margin-right: 8px;
}

.rh-mode-mensuel {
    color: var(--blue);
    background: var(--blue-soft);
}

.rh-mode-horaire {
    color: var(--amber);
    background: var(--amber-soft);
}

/* ---- Nature d'un mouvement (avance / crédit) ---- */
.rh-nature {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 2px 8px;
}

.rh-nature-avance {
    color: var(--teal-dark);
    background: var(--teal-soft);
}

.rh-nature-credit {
    color: var(--blue);
    background: var(--blue-soft);
}

/* ⚠️ Un compte courant NÉGATIF est NORMAL en RH-1 (le dû des bulletins n'existe pas encore) :
   il est mis en évidence, jamais en ROUGE d'alerte — ce serait dire qu'il y a un problème. */
.rh-negatif {
    color: var(--slate);
    font-weight: 600;
}

/* ---- Compte courant, sur la fiche ---- */
.rh-cc-solde {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    margin: 4px 0 2px;
}

.rh-cc-formule {
    font-size: 11.5px;
    color: var(--slate);
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

.rh-cc-note {
    font-size: 12px;
    line-height: 1.45;
    color: var(--slate);
    background: var(--paper);
    border-left: 3px solid var(--teal);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
}

.rh-cc-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- Sous-textes explicatifs (doctrine, ce que l'écran ne sait pas encore) ---- */
.rh-sous-texte {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--slate);
    margin-top: 4px;
}

.rh-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink);
}

.rh-mini {
    padding: 3px 10px;
    font-size: 12px;
}

/* ---- Historique de la fiche : conteneur à défilement PROPRE ---- */
.rh-hist-wrap {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
}

.rh-hist thead th {
    position: sticky;
    top: 0;   /* ⚠️ 0, JAMAIS 64px — voir l'en-tête de ce fichier. */
    background: var(--thead-bg);
    z-index: 1;
}

/* ---- Tuiles de la vue transverse ---- */
.rh-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rh-kpi {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rh-kpi-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--slate);
}

.rh-kpi-val {
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .rh-head {
        flex-direction: column;
        align-items: stretch;
    }

    .rh-head-actions > * {
        flex: 1 1 auto;
    }

    .rh-title {
        font-size: 22px;
    }

    .rh-cc-solde {
        font-size: 22px;
    }
}
