/* paiex — interface web. Styles artisanaux, aucune dépendance externe.
 *
 * Parti pris : l'écran est un DOSSIER, pas un tableau de bord. Ce qui MANQUE
 * pour produire un bulletin doit se voir avant ce qui est déjà saisi — c'est la
 * seule chose sur laquelle on dépense de la couleur et du gras. Les identifiants
 * (SIREN, SIRET, NIR, IDCC) sont composés en chiffres tabulaires groupés, comme
 * sur les documents de paie. Le reste se tait.
 */

:root {
  --bleu: #1b4965;          /* identité produit */
  --bleu-clair: #5fa8d3;    /* survol et focus uniquement */
  --encre: #17323f;         /* texte : un noir qui tire vers le bleu pétrole */
  --encre-douce: #5a7180;   /* libellés, mentions secondaires */
  --papier: #ffffff;
  --fond: #f2f5f6;
  --trait: #dbe2e6;
  --trait-fort: #b9c6cd;
  --ambre: #a16207;         /* à compléter */
  --ambre-fond: #fffbeb;
  --vert: #15803d;
  --rouge: #b91c1c;
  --orange: #d97706;        /* bandeau démonstration (hérité) */
  --gris: #eef2f4;
  --gris-bord: var(--trait);
  --texte: var(--encre);
  --rayon: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--encre);
  background: var(--fond);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--bleu); }
a:hover { color: var(--bleu-clair); }

:focus-visible {
  outline: 2px solid var(--bleu-clair);
  outline-offset: 2px;
}

/* Identifiants administratifs : chiffres alignés, légèrement espacés. */
.ident {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* --- Barre de navigation --- */
.barre {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: var(--bleu);
  color: #fff;
}
.barre a { color: #fff; text-decoration: none; font-weight: 500; }
.barre a:hover { text-decoration: underline; color: #fff; }
.barre .marque { font-weight: 800; font-size: 1.2rem; letter-spacing: 0.02em; }
.barre .deconnexion { margin-left: auto; }
.barre .deconnexion button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  border-radius: var(--rayon);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}
.barre .deconnexion button:hover { background: rgba(255, 255, 255, 0.15); }

/* --- Bandeau démonstration --- */
.bandeau-demo {
  background: #fff7ed;
  color: #7c2d12;
  border-bottom: 2px solid var(--orange);
  padding: 0.6rem 1.5rem;
  font-size: 0.92rem;
}

/* --- Contenu --- */
.contenu {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem;
}

h1 {
  color: var(--bleu);
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}
h2 {
  color: var(--bleu);
  font-size: 1.15rem;
  margin: 2.25rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--trait);
}
h3 { font-size: 1rem; margin: 0 0 0.35rem; }
.sous-titre { color: var(--encre-douce); margin: 0 0 1.25rem; max-width: 70ch; }
.aide { color: var(--encre-douce); font-size: 0.9rem; max-width: 70ch; }

/* --- Boutons / liens boutons --- */
button, .bouton {
  display: inline-block;
  background: var(--bleu);
  color: #fff;
  border: 1px solid var(--bleu);
  border-radius: var(--rayon);
  padding: 0.45rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .bouton:hover { background: #24607f; border-color: #24607f; color: #fff; }
button.discret, .bouton.discret {
  background: var(--papier);
  color: var(--bleu);
  border-color: var(--trait-fort);
}
button.discret:hover, .bouton.discret:hover { background: var(--gris); color: var(--bleu); }

/* --- Formulaires --- */
form label {
  display: block;
  margin: 0.75rem 0;
  font-weight: 500;
}
form input, form select {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 0.25rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--trait-fort);
  border-radius: var(--rayon);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 400;
  background: var(--papier);
  color: var(--encre);
}
form input[type="checkbox"] { width: auto; display: inline-block; margin: 0 0 0 0.4rem; }
form input::placeholder { color: #9aacb6; }
fieldset {
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  margin: 1rem 0;
  padding: 0.25rem 1rem 1rem;
  background: var(--papier);
}
legend { font-weight: 600; color: var(--bleu); padding: 0 0.4rem; }

/* Formulaire en colonnes : les champs courts cessent d'occuper toute la page. */
.grille-champs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0 1.25rem;
  align-items: start;
}
.grille-champs input, .grille-champs select { max-width: none; }
.grille-champs .pleine-largeur { grid-column: 1 / -1; }

/* --- Tableaux : une trame de registre, sans quadrillage vertical --- */
.defilement { overflow-x: auto; }

table.liste, table.bulletin {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  background: var(--papier);
  border: 1px solid var(--trait);
  font-size: 0.94rem;
}
table.liste th, table.liste td {
  border: 0;
  border-bottom: 1px solid var(--trait);
  padding: 0.55rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
table.liste thead th {
  background: var(--gris);
  border-bottom: 2px solid var(--trait-fort);
  font-weight: 600;
  color: var(--encre);
  white-space: nowrap;
}
table.liste tbody tr:last-child td { border-bottom: 0; }
table.liste tbody tr:hover { background: #f8fafb; }
table.liste td.nombre, table.liste th.nombre {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table.liste .vide { color: var(--encre-douce); font-style: italic; }

/* Le bulletin garde son quadrillage complet : c'est un document, pas une liste. */
table.bulletin th, table.bulletin td {
  border: 1px solid var(--trait);
  padding: 0.5rem 0.7rem;
  text-align: left;
}
table.bulletin th { background: var(--gris); font-weight: 600; }
.bulletin td.montant { text-align: right; font-variant-numeric: tabular-nums; }
.bulletin td.net { font-weight: 700; color: var(--vert); }
.bulletin tfoot td { background: #f9fafb; font-weight: 600; }
.bulletin tr.bloc-cotisation { color: #374151; }
.compteurs td.negatif { color: var(--rouge); font-weight: 600; }

/* --- Dossier d'entreprise : ce qui manque avant ce qui est saisi --- */
.dossier {
  background: var(--papier);
  border: 1px solid var(--trait);
  border-left: 3px solid var(--vert);
  border-radius: var(--rayon);
  padding: 0.9rem 1.1rem;
  margin: 0 0 0.85rem;
}
.dossier.incomplet { border-left-color: var(--ambre); }
.dossier .entete-dossier {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
}
.dossier h3 { font-size: 1.05rem; margin: 0; }
.dossier .identifiants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--encre-douce);
}
.dossier .identifiants b {
  color: var(--encre);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.dossier .convention { margin: 0.55rem 0 0; font-size: 0.94rem; }
.dossier .convention .sans { color: var(--ambre); }

.etat { margin: 0; font-size: 0.9rem; font-weight: 500; }
.etat-complet { color: var(--vert); }
.etat-incomplet { color: var(--ambre); }
.a-completer {
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.7rem;
  background: var(--ambre-fond);
  border-radius: var(--rayon);
  font-size: 0.9rem;
}
.a-completer ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.a-completer li { margin: 0.1rem 0; }

.liens-dossier {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0.75rem 0 0;
  padding: 0.6rem 0 0;
  border-top: 1px solid var(--trait);
  font-size: 0.92rem;
}

/* --- Volets repliés : un formulaire secondaire ne s'impose pas --- */
details.volet {
  margin: 0.65rem 0 0;
  border-top: 1px solid var(--trait);
  padding-top: 0.5rem;
}
details.volet > summary {
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--bleu);
  list-style: none;
  padding: 0.15rem 0;
}
details.volet > summary::-webkit-details-marker { display: none; }
details.volet > summary::before {
  content: "+";
  display: inline-block;
  width: 1.1rem;
  font-weight: 600;
}
details.volet[open] > summary::before { content: "–"; }
details.volet > summary:hover { color: var(--bleu-clair); }
details.volet fieldset { margin-top: 0.5rem; }

/* --- Bloc salarié --- */
.salarie {
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.9rem 1.1rem;
  margin: 0 0 0.85rem;
}
.salarie .entete-salarie {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: baseline;
}
.salarie .entete-salarie .naissance { color: var(--encre-douce); font-size: 0.9rem; }
.salarie table.liste { margin-bottom: 0; }

/* --- Sélecteur de convention collective (recherche par nom) --- */
.recherche-convention { display: block; margin: 0.4rem 0 0.2rem; font-weight: 500; }
.recherche-convention input { width: 100%; max-width: 28rem; }
.idcc-manuel { display: block; font-size: 0.85rem; color: var(--encre-douce); }
.idcc-manuel input { width: 7rem; }
.convention-retenue {
  background: #f0f7fb;
  border-left: 3px solid var(--bleu-clair);
  padding: 0.45rem 0.7rem;
  margin: 0.3rem 0;
  font-size: 0.92rem;
}
.suggestions { max-height: 16rem; overflow-y: auto; }
.suggestions .aide { font-size: 0.88rem; margin: 0.3rem 0; }
.suggestions-convention { list-style: none; margin: 0.25rem 0; padding: 0; }
.suggestions-convention li { margin: 0; }
.suggestions-convention .suggestion {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--papier);
  color: var(--encre);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
}
.suggestions-convention .suggestion:hover {
  background: var(--gris);
  border-color: var(--trait-fort);
  color: var(--encre);
}
.suggestions-convention .hors-vigueur { color: var(--ambre); margin-left: 0.3rem; }

/* --- Bulletin (fragment) --- */
.bulletin-trace { margin-top: 1.5rem; }
.rappel-demo {
  background: #fff7ed;
  border-left: 4px solid var(--orange);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}
.actions-bulletin { margin-top: 1rem; display: flex; gap: 0.75rem; }

/* --- Erreurs / messages --- */
.erreur {
  color: var(--rouge);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--rayon);
  padding: 0.6rem 0.85rem;
  margin: 0.75rem 0;
}
/* Écran vide : dire l'étape suivante. Ce N'EST PAS une erreur — l'utilisateur
   n'a rien fait de travers — donc ni rouge ni vocabulaire d'alarme. Même ambre
   que « à compléter » sur le dossier d'entreprise : une seule langue visuelle
   pour « il manque quelque chose, voici quoi ». */
.orientation {
  color: #7c4a03;
  background: var(--ambre-fond);
  border-left: 3px solid var(--ambre);
  border-radius: var(--rayon);
  padding: 0.6rem 0.85rem;
  margin: 0.75rem 0;
}
.orientation a { color: #7c4a03; }

.message {
  color: var(--vert);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--rayon);
  padding: 0.6rem 0.85rem;
  margin: 0.75rem 0;
}
.actions { margin: 1rem 0; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* --- Bulletin clarifié (Lot 17) --- */
.entete-bulletin { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.entete-bulletin .periode { grid-column: 1 / -1; }
.avertissements .avertissement { color: #8a5a00; }
.bulletin tfoot th { text-align: left; }
.bulletin .net-paye { font-weight: bold; }

@media (max-width: 40rem) {
  .entete-bulletin { grid-template-columns: 1fr; }
  .contenu { padding: 0 1rem 2rem; }
  .dossier, .salarie { padding: 0.8rem 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
