/* Historique activité — 4004. Palette « Ardoise et cuivre » : ardoise #2F4F4F, cuivre #B8703F.
   Les variables --vert et --vert-fonce portent la couleur d’accent (cuivre), le nom est resté pour ne pas tout renommer. */
:root {
  --fond: #f5f3f0;
  --surface: #ffffff;
  --surface-2: #f0ece7;
  --texte: #22282a;
  --texte-2: #625d57;
  --texte-3: #8f8981;
  --bord: #e3ded8;
  --ardoise: #2F4F4F;
  --vert: #B8703F;
  --vert-fonce: #96582D;
  --orange: #e8a33d;
  --rouge: #c8553d;
  --bleu: #4a90c2;
  --gris: #b3ada6;
  --s-salaires: #2F4F4F;
  --s-ft: #B8703F;
  --s-cg: #D9B25F;
  --s-divers: #b3ada6;
  --ombre: 0 1px 2px rgba(20, 30, 40, .06), 0 4px 16px rgba(20, 30, 40, .06);
  --rayon: 10px;
  --entete: #2F4F4F;
  --entete-actif: rgba(184,112,63,.38);
  --entete-actif-texte: #fff;
  --logo: #B8703F;
  --logo-texte: #fff;
  --primaire: #2F4F4F;
  --primaire-survol: #3c6262;
  --primaire-texte: #fff;
  --puce-actif-texte: #fff;
  --pub-texte: #b07418;
  --login-fond: #1d2d2d;
  color-scheme: light;
}
/* Mode sombre « Nuit et ambre ». assets/theme.js pose data-theme="sombre" :
   selon l’appareil par défaut, ou selon le bouton ☾ / ☀ de l’en-tête (choix mémorisé). */
:root[data-theme="sombre"] {
  --fond: #141414;
  --surface: #1d1d1d;
  --surface-2: #262626;
  --texte: #eeeae4;
  --texte-2: #a8a29a;
  --texte-3: #7a756f;
  --bord: #2e2e2e;
  --ardoise: #8fa3ad;
  --s-salaires: #8fa3ad;
  --vert: #E8A33D;
  --vert-fonce: #F0B45A;
  --s-ft: #E8A33D;
  --s-cg: #C77B5B;
  --s-divers: #6b6560;
  --ombre: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  --entete: #0c0c0c;
  --entete-actif: rgba(232,163,61,.22);
  --entete-actif-texte: #F0B45A;
  --logo: #E8A33D;
  --logo-texte: #141414;
  --primaire: #E8A33D;
  --primaire-survol: #F0B45A;
  --primaire-texte: #141414;
  --puce-actif-texte: #141414;
  --pub-texte: #E8A33D;
  --login-fond: #0c0c0c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--vert-fonce); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- en-tête ---------- */
.entete { background: var(--entete); color: #fff; position: sticky; top: 0; z-index: 20; }
.entete-int { max-width: 1320px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; min-height: 58px; }
.marque { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; white-space: nowrap; }
.logo { background: var(--logo); color: var(--logo-texte); font-weight: 700; padding: 3px 8px; border-radius: 4px; letter-spacing: .04em; font-size: .9rem; }
.marque-titre { font-weight: 600; font-size: 1.05rem; }
.nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.nav a { color: rgba(255,255,255,.78); text-decoration: none; padding: 8px 9px; border-radius: 6px; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.actif { color: var(--entete-actif-texte); background: var(--entete-actif); }
.nav .deconnexion { margin-left: auto; font-weight: 400; color: rgba(255,255,255,.6); }
.menu-bouton { display: none; margin-left: 0; order: 3; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; font-size: 1.1rem; padding: 4px 10px; cursor: pointer; }
.bouton-theme { order: 2; flex: 0 0 auto; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; font-size: 1rem; line-height: 1; width: 34px; height: 32px; cursor: pointer; }
.bouton-theme:hover { background: rgba(255,255,255,.1); }
.bouton-theme:focus-visible { outline: 2px solid var(--vert); outline-offset: 2px; }
.login .bouton-theme { margin-left: auto; color: var(--texte-2); border-color: var(--bord); }
.login .bouton-theme:hover { background: var(--surface-2); }
@media (max-width: 1260px) {
  .menu-bouton { display: block; }
  .bouton-theme { margin-left: auto; }
  .nav { display: none; position: absolute; top: 58px; left: 0; right: 0; background: var(--entete); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
  .nav.ouvert { display: flex; }
  .nav .deconnexion { margin-left: 0; }
}

/* ---------- mise en page ---------- */
.contenu { max-width: 1240px; width: 100%; margin: 0 auto; padding: 28px 16px 48px; flex: 1; outline: none; }
.titre-page { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.titre-page p { margin: 0; color: var(--texte-2); }
.grille { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g-3, .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g-3, .g-4 { grid-template-columns: 1fr; } }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 20px; min-width: 0; }
.carte + .carte, .section + .section { margin-top: 16px; }
.carte .carte { box-shadow: none; background: var(--surface-2); border-color: transparent; padding: 14px 16px; }
.carte .grille > .carte + .carte { margin-top: 0; }
html, body { overflow-x: hidden; }
.section { margin-top: 28px; }
.carte-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.carte-titre h2 { margin: 0; }
.sous { color: var(--texte-2); font-size: .86rem; }
.legende-note { color: var(--texte-3); font-size: .8rem; margin-top: 10px; }

/* ---------- indicateurs ---------- */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { color: var(--texte-2); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-valeur { font-size: 1.7rem; font-weight: 700; color: var(--texte); font-variant-numeric: tabular-nums; }
.kpi-detail { color: var(--texte-3); font-size: .85rem; }
.kpi-valeur.vert { color: var(--vert-fonce); }
.kpi-valeur.rouge { color: var(--rouge); }

.periode { display: grid; grid-template-columns: 190px 1fr; gap: 28px; align-items: center; }
@media (max-width: 640px) { .periode { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.anneau { position: relative; width: 190px; height: 190px; }
.anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anneau .centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.anneau .centre b { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.anneau .centre span { color: var(--texte-2); font-size: .85rem; margin-top: 4px; }
.faits { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 24px; }
.fait b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.fait span { color: var(--texte-2); font-size: .82rem; }

/* ---------- barres de progression ---------- */
.barre { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.barre > i { display: block; height: 100%; background: var(--vert); border-radius: 4px; }
.barre.manque > i { background: var(--orange); }

/* ---------- tableaux ---------- */
.tableau-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--bord); white-space: nowrap; }
th { color: var(--texte-2); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface); position: sticky; top: 0; }
th.triable { cursor: pointer; user-select: none; }
th.triable:hover { color: var(--texte); }
th .fleche { opacity: .6; margin-left: 3px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 700; border-top: 2px solid var(--bord); border-bottom: none; }
td.texte { white-space: normal; min-width: 220px; color: var(--texte-2); font-size: .84rem; }
tr.cliquable { cursor: pointer; }
tr.detail td { background: var(--surface-2); white-space: normal; }
.vide { color: var(--texte-3); }

/* ---------- pastilles ---------- */
.pastille { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--texte-2); }
.p-Série { background: rgba(47,79,79,.12); color: var(--ardoise); }
.p-Film { background: rgba(74,144,194,.15); color: var(--bleu); }
.p-Pub { background: rgba(232,163,61,.17); color: var(--pub-texte); }
.p-Documentaire { background: rgba(184,112,63,.15); color: var(--vert-fonce); }
.p-Autre { background: var(--surface-2); color: var(--texte-2); }
.marqueur { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.m-verif { background: var(--orange); }
.m-corrige { background: var(--vert); }
.m-propose { background: var(--bleu); }

/* ---------- filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filtres input[type=search], .filtres select {
  font: inherit; font-size: .9rem; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 7px; background: var(--surface); color: var(--texte); min-height: 38px;
}
.filtres input[type=search] { flex: 1 1 240px; }
.puces { display: flex; gap: 6px; flex-wrap: wrap; }
.puce { font: inherit; font-size: .82rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--bord); background: var(--surface); color: var(--texte-2); cursor: pointer; min-height: 34px; }
.puce.actif { background: var(--ardoise); border-color: var(--ardoise); color: var(--puce-actif-texte); }
.case { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--texte-2); cursor: pointer; }
.resume-filtre { color: var(--texte-2); font-size: .88rem; margin: 0 0 10px; }
.resume-filtre b { color: var(--texte); }

/* ---------- graphiques ---------- */
.graphe { width: 100%; }
.graphe svg { display: block; width: 100%; height: auto; overflow: visible; }
.graphe .axe text { fill: var(--texte-3); font-size: 11px; }
.graphe .grille-l { stroke: var(--bord); stroke-width: 1; }
.graphe .barre-g { transition: opacity .15s; }
.graphe .barre-g:hover, .graphe .barre-g.survol { opacity: .78; }
.graphe .ligne-g { fill: none; stroke-width: 2.5; }
.graphe .point-g { stroke: var(--surface); stroke-width: 2; }
.graphe .seuil { stroke: var(--rouge); stroke-dasharray: 4 4; stroke-width: 1.5; }
.graphe .seuil-texte { fill: var(--rouge); font-size: 11px; font-weight: 600; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: .84rem; color: var(--texte-2); }
.legende span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.infobulle { position: fixed; z-index: 50; pointer-events: none; background: #1f2a30; color: #fff; font-size: .82rem; padding: 8px 10px; border-radius: 7px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 280px; }
.infobulle b { display: block; margin-bottom: 3px; }
.infobulle .ib-l { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.infobulle .ib-l i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- divers ---------- */
.selecteur-annee { display: flex; gap: 6px; flex-wrap: wrap; }
.liste-courte { list-style: none; padding: 0; margin: 0; }
.liste-courte li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--bord); }
.liste-courte li:last-child { border-bottom: none; }
.liste-courte .l-titre { font-weight: 600; }
.liste-courte .l-sous { color: var(--texte-3); font-size: .82rem; }
.liste-courte .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.frise { position: relative; padding-left: 22px; }
.frise::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--bord); }
.frise-el { position: relative; padding: 0 0 18px; }
.frise-el::before { content: ''; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--vert); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--bord); }
.frise-el.approx::before { background: var(--orange); }
.frise-el.inconnue::before { background: var(--gris); }
.frise-el h3 { margin: 0; }
.frise-el p { margin: 2px 0 0; color: var(--texte-2); font-size: .86rem; }
.alerte { background: rgba(232,163,61,.12); border: 1px solid rgba(232,163,61,.4); color: var(--texte); border-radius: 8px; padding: 10px 14px; font-size: .88rem; }
.chargement { color: var(--texte-2); }
.pied { text-align: center; color: var(--texte-3); font-size: .8rem; padding: 18px 16px 28px; }

/* ---------- connexion ---------- */
.page-login { background: var(--login-fond); align-items: center; justify-content: center; }
.login { width: min(380px, calc(100% - 32px)); background: var(--surface); border-radius: 12px; padding: 34px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.35); margin: auto; }
.login-marque { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--texte-2); margin-bottom: 22px; }
.login h1 { font-size: 1.35rem; margin-bottom: 4px; }
.login-sous { color: var(--texte-2); font-size: .88rem; margin: 0 0 22px; }
.login label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.login input[type=password] { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 7px; background: var(--surface); color: var(--texte); margin-bottom: 16px; }
.login button { width: 100%; font: inherit; font-weight: 700; padding: 11px; border: none; border-radius: 7px; background: var(--primaire); color: var(--primaire-texte); cursor: pointer; }
.login button:hover { background: var(--logo); color: var(--logo-texte); }
.login button:disabled { opacity: .5; cursor: not-allowed; }
.login-erreur { background: rgba(200,85,61,.1); color: var(--rouge); border-radius: 7px; padding: 9px 12px; font-size: .88rem; margin: 0 0 16px; }

@media (max-width: 640px) {
  .contenu { padding-top: 20px; }
  h1 { font-size: 1.35rem; }
  .kpi-valeur { font-size: 1.4rem; }
  .carte { padding: 16px; }
}
@media print {
  .entete, .pied, .filtres { display: none; }
  body { background: #fff; }
  .carte { box-shadow: none; break-inside: avoid; }
}

/* ---------- saisie ---------- */
.bouton { font: inherit; font-size: .88rem; font-weight: 600; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); cursor: pointer; min-height: 38px; white-space: nowrap; }
.bouton:hover { border-color: var(--texte-3); }
.bouton.primaire { background: var(--primaire); border-color: var(--primaire); color: var(--primaire-texte); }
.bouton.primaire:hover { background: var(--primaire-survol); border-color: var(--primaire-survol); }
.bouton.danger { color: var(--rouge); border-color: rgba(200,85,61,.4); }
.bouton.danger:hover { background: rgba(200,85,61,.08); }
.bouton.petit { min-height: 30px; padding: 4px 10px; font-size: .8rem; }
.bouton:disabled { opacity: .5; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.lien-edit { background: none; border: none; color: var(--texte-3); cursor: pointer; font-size: .95rem; padding: 0 4px; }
.lien-edit:hover, tr:hover .lien-edit, li:hover .lien-edit, .frise-el:hover .lien-edit { color: var(--vert-fonce); }
li.cliquable, .frise-el.cliquable { cursor: pointer; }
li.cliquable:hover { background: var(--surface-2); }
.frise-el.cliquable:hover h3 { color: var(--vert-fonce); }

.saisie-rapide .rapide { display: flex; flex-wrap: wrap; gap: 8px; }
.saisie-rapide select, .saisie-rapide input { font: inherit; font-size: .95rem; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 7px; background: var(--surface); color: var(--texte); min-height: 40px; }
.saisie-rapide select { flex: 1 1 220px; }
.saisie-rapide input { flex: 1 1 140px; max-width: 220px; }
@media (max-width: 520px) { .saisie-rapide input { max-width: none; } .saisie-rapide .rapide .bouton { flex: 1 1 100%; } }

.dialogue { border: none; border-radius: 12px; padding: 0; width: min(680px, calc(100% - 24px)); max-height: calc(100vh - 24px); background: var(--surface); color: var(--texte); box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.dialogue::backdrop { background: rgba(15, 25, 28, .55); }
.form header { padding: 20px 22px 6px; }
.form header h2 { margin: 0; }
.form header .sous { margin: 4px 0 0; }
.champs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 12px 22px; }
.champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.champ.large { grid-column: 1 / -1; }
.champ label { font-size: .82rem; font-weight: 600; color: var(--texte-2); }
.champ small { color: var(--texte-3); font-size: .76rem; }
.champ input, .champ select, .champ textarea { font: inherit; font-size: .95rem; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 7px; background: var(--surface); color: var(--texte); width: 100%; }
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: 2px solid rgba(184,112,63,.45); border-color: var(--vert); }
.champ-case label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--texte); padding-top: 6px; cursor: pointer; }
.champ-case input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--primaire); }
.form-erreur { margin: 4px 22px 0; background: rgba(200,85,61,.1); color: var(--rouge); border-radius: 7px; padding: 8px 12px; font-size: .88rem; }
.form footer { display: flex; gap: 8px; padding: 14px 22px 20px; flex-wrap: wrap; }
.form footer .espace { flex: 1; }
@media (max-width: 560px) { .champs { grid-template-columns: 1fr; } .form footer .bouton { flex: 1 1 auto; } .form footer .espace { display: none; } }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: #1f2a30; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: .9rem; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: opacity .2s, transform .2s; z-index: 60; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.erreur { background: var(--rouge); }.a-bulle { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
