/* === Paie vacataires — charte des outils Spekty (bandeau marine, cf. Synthèses / integrations) === */
:root {
    --marine: #1f2c54;
    --marine-2: #24325d;
    --marine-3: #2e4272;
    --bleu: #3d92d1;
    --ok: #198754;
    --warn: #b7791f;
    --ko: #dc3545;
    --muted: #6c757d;
    --bord: #dee2e6;
    --fond-carte: #fff;
    --gris-ligne: #eceff3;
    --pico-font-size: 15px;
}
html, body { background: #f5f7fa; }
body.auth-pending .app-header, body.auth-pending main { display: none; }
#auth-gate { display: none; text-align: center; padding: 18vh 1rem; color: var(--muted); }
body.auth-pending #auth-gate { display: block; }

/* --- En-tête --- */
.app-header {
    background: var(--marine); border-bottom: 3px solid var(--bleu);
    box-shadow: 0 2px 12px rgba(0,0,0,.18); margin-bottom: 1.2rem;
    box-sizing: border-box; height: 60px; display: flex; align-items: center; padding: 0 22px;
    position: sticky; top: 0; z-index: 1000;
}
.app-header nav { width: 100%; align-items: center;
    --pico-nav-element-spacing-vertical: .25rem; --pico-nav-element-spacing-horizontal: .5rem; }
.app-header nav li { padding-top: 4px; padding-bottom: 4px; }
.app-brand { display: flex; align-items: center; gap: .65rem; }
.app-brand-logo-img { height: 34px; width: auto; display: block; }
.app-brand-name { color: rgba(255,255,255,.72); font-size: 13px; font-weight: 500;
    padding-left: .6rem; border-left: 1px solid rgba(255,255,255,.28); }
.app-version { color: rgba(255,255,255,.5); font-size: 10px; }
.app-header .nav-link, .app-header .nav-dd-toggle { white-space: nowrap; font-size: 14px; padding: 4px 6px;
    color: #e7ecf6 !important; opacity: .82; font-weight: 500; text-decoration: none; cursor: pointer; }
.app-header .nav-link:hover, .app-header .nav-dd-toggle:hover { color: #fff !important; opacity: 1; }
.app-header .nav-link.active { color: #fff !important; opacity: 1; font-weight: 700;
    text-decoration: underline; text-decoration-color: var(--bleu); text-decoration-thickness: 2px;
    text-underline-offset: 6px; }
.nav-dropdown { position: relative; }
.nav-dd-menu { position: absolute; top: 100%; left: 0; margin: .3rem 0 0; padding: .3rem; list-style: none;
    min-width: 200px; background: var(--marine-2); border: 1px solid rgba(255,255,255,.15); border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0,0,0,.35); display: none; z-index: 1200; }
.nav-dropdown:hover .nav-dd-menu, .nav-dropdown:focus-within .nav-dd-menu, .nav-dropdown.open .nav-dd-menu { display: block; }
.nav-dropdown:has(.nav-link.active) > .nav-dd-toggle { color: #fff !important; opacity: 1; font-weight: 700; }
.app-header .nav-dd-menu li { display: block; margin: 0; padding: 0; }
.app-header .nav-dd-menu li[hidden], .app-header li[hidden] { display: none !important; }
.app-header .nav-dd-menu .nav-link { display: block; padding: 8px 12px; margin: 1px 0; border-radius: 6px; white-space: nowrap; }
.app-header .nav-dd-menu .nav-link:hover, .app-header .nav-dd-menu .nav-link.active { background: var(--marine-3); text-decoration: none; }
.user-menu .nav-dd-menu { left: auto; right: 0; min-width: 170px; }
.user-menu:hover .nav-dd-menu { display: none; }
.user-menu.open .nav-dd-menu { display: block; }
.user-info { color: rgba(255,255,255,.9); font-size: 13px; }
.role-badge { display: inline-block; padding: .1rem .5rem; border-radius: .3rem; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em; margin-left: .4rem; background: rgba(255,255,255,.16); color: #fff; }
.role-badge.role-admin { background: var(--bleu); }
.role-badge.role-paie { background: #6f42c1; }
.logout-link { color: #ffc2c2 !important; }
.env-badge { background: #b7791f; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }

/* --- Pages --- */
main.container-fluid { padding: 0 22px 3rem; max-width: 1500px; margin: 0 auto; }
.page[hidden] { display: none !important; }
.page h2 { margin: .2rem 0 .8rem; font-size: 1.35rem; color: var(--marine); }
.page h3 { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--marine); }
.sous-titre { color: var(--muted); font-size: .88rem; margin: -.5rem 0 1rem; }
.carte { background: var(--fond-carte); border: 1px solid var(--bord); border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.barre { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.barre > * { margin: 0 !important; }
.barre input[type=search], .barre select { width: auto; min-width: 12rem; padding: .35rem .6rem; height: auto; font-size: .9rem; }
.barre .espace { flex: 1; }
button, [role=button] { font-size: .9rem; padding: .4rem .9rem; }
button.petit, a.petit[role=button] { font-size: .8rem; padding: .2rem .55rem; }
button.lien { background: none; border: none; color: var(--bleu); padding: 0 .2rem; cursor: pointer; }
button.lien:hover { text-decoration: underline; }
button.danger { background: var(--ko); border-color: var(--ko); }
.chips { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--bord); background: #fff; border-radius: 999px; padding: .2rem .75rem; font-size: .82rem;
    cursor: pointer; color: #333; user-select: none; }
.chip.on { background: var(--marine); color: #fff; border-color: var(--marine); }
.compteur { color: var(--muted); font-size: .85rem; }

/* --- Tableaux --- */
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--bord); border-radius: 6px; background: #fff; }
table.grille { width: 100%; border-collapse: collapse; margin: 0; font-size: .84rem; }
table.grille th { position: sticky; top: 0; background: #eef2f8; color: var(--marine); font-weight: 600; z-index: 1;
    white-space: nowrap; cursor: pointer; padding: .4rem .5rem; border-bottom: 1px solid var(--bord); }
table.grille th.nosort { cursor: default; }
table.grille td { padding: .3rem .5rem; border-bottom: 1px solid var(--gris-ligne); vertical-align: middle; }
table.grille tr:hover td { background: #f7f9fc; }
table.grille td.num, table.grille th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grille td.act { white-space: nowrap; text-align: right; }
table.grille tr.gris td { background: #e9ecef; color: #6c757d; }
table.grille tr.exclue td { text-decoration: line-through; color: #999; }
table.grille tr.retouchee td:first-child { box-shadow: inset 3px 0 0 #6f42c1; }
table.grille tr.manuelle td:first-child { box-shadow: inset 3px 0 0 var(--bleu); }
table.grille tr.ecart td { background: #fdecee; }
table.grille td.fort { font-weight: 700; color: var(--marine); }
td.surligne { background: #fff3cd !important; font-weight: 700; }
.vide { color: var(--muted); text-align: center; padding: 2rem; }

/* --- Badges & alertes --- */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.b-a_integrer { background: #e7f1ff; color: #084298; }
.b-differee { background: #fff3cd; color: #856404; }
.b-hors_paie { background: #e2e3e5; color: #41464b; }
.b-integree { background: #d1e7dd; color: #0f5132; }
.b-brouillon { background: #fff3cd; color: #856404; }
.b-verrouillee { background: #d1e7dd; color: #0f5132; }
.b-programme { background: #e7f1ff; color: #084298; }
.b-envoye { background: #d1e7dd; color: #0f5132; }
.b-erreur { background: #f8d7da; color: #842029; }
.b-annule { background: #e2e3e5; color: #41464b; }
.pastille { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.c-vert { background: #2e9e5b; } .c-bleu { background: #3d7fd1; } .c-orange { background: #e8892a; }
.alerte { border-radius: 6px; padding: .6rem .9rem; margin: 0 0 .8rem; font-size: .9rem; border: 1px solid; }
.alerte.info { background: #e7f1ff; border-color: #b6d4fe; color: #084298; }
.alerte.warn { background: #fff3cd; border-color: #ffe69c; color: #664d03; }
.alerte.ko { background: #f8d7da; border-color: #f5c2c7; color: #842029; }
.alerte.ok { background: #d1e7dd; border-color: #badbcc; color: #0f5132; }
.alerte ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.alerte li { list-style: disc; margin: 0; }

/* --- Génération paie --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--bord); border-radius: 8px; padding: .5rem .8rem; }
.kpi .v { font-size: 1.15rem; font-weight: 700; color: var(--marine); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .75rem; color: var(--muted); }
.kpi.attention { border-color: #e8892a; background: #fff8ef; }
.etape { background: #fff; border: 1px solid var(--bord); border-radius: 8px; margin-bottom: .8rem; }
.etape > header { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; cursor: pointer; }
.etape > header .num { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; font-size: .85rem; background: #e9ecef; color: #555; flex: none; }
.etape.fait > header .num { background: var(--ok); color: #fff; }
.etape.obsolete > header .num { background: #e8892a; color: #fff; }
.etape.bloque > header .num { background: var(--ko); color: #fff; }
.etape > header .titre { font-weight: 600; color: var(--marine); }
.etape > header .etat { color: var(--muted); font-size: .82rem; margin-left: auto; text-align: right; }
.etape > .corps { padding: 0 1rem 1rem 3.5rem; }
.etape.ferme > .corps { display: none; }
.depot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.depot input[type=file] { width: auto; margin: 0; font-size: .85rem; }
.meta { color: var(--muted); font-size: .8rem; }

/* --- Modale --- */
dialog article { max-width: 760px; width: 96vw; }
dialog article.large { max-width: 1100px; }
dialog article header { margin-bottom: .6rem; }
dialog .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
dialog .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
dialog label { font-size: .85rem; margin-bottom: .15rem; }
dialog input, dialog select, dialog textarea { margin-bottom: .6rem !important; padding: .4rem .6rem; font-size: .9rem; }
dialog footer { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
dialog .erreur { color: var(--ko); font-size: .88rem; min-height: 1.2em; }

#flash { position: fixed; top: 70px; right: 1rem; z-index: 3000; display: flex; flex-direction: column; gap: .4rem; }
.flash { padding: .65rem 1.1rem; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); max-width: 460px;
    font-size: .9rem; font-weight: 500; transition: opacity .3s; }
.flash.success { background: #d1e7dd; color: #0f5132; } .flash.error { background: #f8d7da; color: #842029; }
.flash.info { background: #cfe2ff; color: #084298; } .flash.warning { background: #fff3cd; color: #664d03; }
#chargement { position: fixed; inset: 0; background: rgba(255,255,255,.55); z-index: 2500; display: grid; place-items: center; }
#chargement[hidden] { display: none; }

/* --- Guide --- */
.guide details { background: #fff; border: 1px solid var(--bord); border-radius: 6px; margin-bottom: .5rem; padding: 0 .9rem; }
.guide summary { padding: .6rem 0; font-weight: 600; color: var(--marine); }
.guide details[open] { padding-bottom: .6rem; }
.guide p, .guide li { font-size: .92rem; }
.guide code { font-size: .85em; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46rem; }

.depot-zone { display: grid; place-items: center; text-align: center; border: 2px dashed #9aa7c2; border-radius: 10px;
    padding: 1.6rem 1rem; margin: .6rem 0 1rem; background: #f7f9fc; cursor: pointer; color: var(--marine); font-size: .95rem; }
.depot-zone.survol { border-color: var(--bleu); background: #e7f1ff; }

table.grille td.a-copier { cursor: copy; }
table.grille td.copiee, table.grille tr.gris td.copiee, table.grille tr:hover td.copiee { background: #cfe6ff !important; }

/* Séparateurs verticaux entre colonnes (tous les tableaux) */
table.grille th, table.grille td { border-right: 1px solid #e1e6ee; }
table.grille th { border-right-color: #d3dae6; }
table.grille th:last-child, table.grille td:last-child { border-right: none; }

.b-historique { background: #e2e3e5; color: #41464b; }
