:root {
  /* Les 4 couleurs présentes dans le logo */
  --brun: #593a0f;     /* brun foncé (anneau extérieur) */
  --ocre: #825c20;     /* ocre / brun doré (anneau intérieur) */
  --creme: #ebe5cf;    /* crème (anneau droit) */
  --mauve: #977c74;    /* mauve / taupe (le M) */

  /* Rôles dans les pages, dérivés de ces 4 couleurs */
  --fond: #f3efe2;          /* crème éclairci (fond de page) */
  --surface: #ebe5cf;       /* crème (cartes) */
  --texte: #593a0f;         /* brun foncé (texte) */
  --accent: #825c20;        /* ocre (boutons, titres, en-têtes) */
  --accent-fonce: #593a0f;  /* brun foncé (survol) */
  --bordure: #d8cdb3;       /* bordure douce (crème assombri) */
  --sable: #f2e6c9;         /* fond des boutons d'action des listes */
  --sable-survol: #e8d7a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
  background: linear-gradient(180deg, var(--fond), #ffffff);
  background-repeat: no-repeat;
  color: var(--texte);
  line-height: 1.5;
}

.centre {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

.carte.large { max-width: 640px; }

h1 {
  font-size: 1.4rem;
  margin: 0 0 1.25rem;
  color: var(--accent);
}

p { margin: 0 0 1rem; }

label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input, select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--bordure);
  border-radius: 5px;
  background: #fff;
  color: var(--texte);
  font-size: 1rem;
}

/* Le rendu natif du navigateur (chrome de la flèche) fait paraître un
   <select> plus haut/bas qu'un <input> malgré un padding identique — on
   désactive ce rendu natif et on dessine une flèche nous-mêmes pour une
   hauteur strictement identique à tous les champs de saisie. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='%23593a0f' d='M5.5 7.5l4.5 4.5 4.5-4.5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.9em;
  padding-right: 2rem;
}

button {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 5px;
  background: var(--accent);
  color: var(--fond);
  font-size: 1rem;
  cursor: pointer;
}

button:hover { background: var(--accent-fonce); }

fieldset {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5rem 1rem 1rem;
  margin: 0 0 1rem;
}

legend {
  padding: 0 0.4rem;
  font-weight: 600;
  color: #555;
}

.radios {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.radios label {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.radios input { width: auto; }

.deux {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

@media (max-width: 480px) {
  .deux { grid-template-columns: 1fr; }
}

.erreur {
  background: #f3d9c9;
  border: 1px solid var(--accent);
  color: #7a2e12;
  padding: 0.6rem 0.8rem;
  border-radius: 5px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.liens {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.liens a { color: var(--accent); }

/* --- Gestion des utilisateurs & accueil --- */
.tableau {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.tableau th, .tableau td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.9rem;
  vertical-align: middle;
}

.tableau th { color: #555; }

.ligne {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}

.ligne select { width: auto; margin: 0; }

.ligne-decision {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0;
  flex-wrap: wrap;
}

.petit-champ {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

button.petit {
  width: auto;
  margin: 0;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

button.bouton-danger {
  background: #a0341e;
}

button.bouton-danger:hover {
  background: #7a2716;
}

.info {
  background: #dce8d2;
  border: 1px solid #7c9a5b;
  color: #3f5a26;
  padding: 0.6rem 0.8rem;
  border-radius: 5px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.droits {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.lien-bouton {
  display: block;
  text-align: center;
  margin-top: 1rem;
  padding: 0.6rem;
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
}

.lien-bouton:hover { background: #f0e3d2; }

/* Boutons d'action des listes (icône seule, infobulle au survol) — style
   unique quelle que soit l'action : bord brun foncé, fond sable, icône brun
   foncé. Appliqué à la place de .petit/.lien-bouton sur ces boutons. */
.bouton-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--texte);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--sable), #ffffff);
  color: var(--texte);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}
.bouton-action:hover { background: var(--sable-survol); }
.bouton-action .sym { font-size: 1.2rem; color: var(--texte); }

/* Barre au-dessus d'une liste : bouton "+ Nouveau" + repli, côte à côte */
.barre-titre-liste {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Ligne désactivée (interrupteur actif/inactif sur off) dans une liste */
.ligne-inactive { color: #999; }
.ligne-inactive td { color: #999; }

/* Table hiérarchique (Directions/Services, Projets/Tâches) : lignes enfants
   repliables sous leur ligne parente, indentées. table-layout: fixed fige les
   largeurs de colonnes sur la ligne parente (toujours visible) pour éviter
   qu'elles ne se recalculent — et donc décalent visuellement le tableau —
   au dépli/repli des lignes enfants (masquées via l'attribut hidden). */
.tableau-hierarchique { table-layout: fixed; }
.tableau-hierarchique .indent { padding-left: 2rem; }
.tableau-hierarchique .ligne-service td { background: var(--surface); }

/* --- Configuration des profils & droits --- */
.cases {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 480px) {
  .cases { grid-template-columns: 1fr; }
}

.case {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  font-size: 0.9rem;
  margin: 0;
}

.case input { width: auto; }

/* --- Liste déroulante avec recherche (choix d'une personne unique) --- */
.picker-recherche { position: relative; margin-bottom: 0.75rem; }

.picker-liste {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.picker-option {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--bordure);
}

.picker-option:last-child { border-bottom: none; }
.picker-option:hover { background: var(--sable); }

.txt-muted {
  color: #7a6a5c;
  font-size: 0.88rem;
  margin: 0 0 0.4rem;
}

/* --- Journal de connexions --- */
.tableau td.ok { color: #3f5a26; font-weight: 600; }
.tableau td.ko { color: #a0341e; font-weight: 600; }

/* --- Vérification entreprise (auto-remplissage) --- */
.aide {
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
  min-height: 1em;
  color: #7a6a5c;
}

.aide.ok { color: #3f5a26; font-weight: 600; }
.aide.ko { color: #a0341e; font-weight: 600; }

/* --- Ligne de titre : logo à gauche, titre à droite --- */
.titre-ligne {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.titre-ligne h1 {
  margin: 0;
}

.logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

/* --- Bandeau photo (haut de page, hauteur réduite) --- */
.bandeau {
  height: 120px;
  background-image: url('/img/bandeau.jpg');
  background-size: cover;
  background-position: center 40%;
  border-bottom: 3px solid var(--ocre);
}

/* Champ actif : liseré mauve (couleur du logo) */
input:focus, select:focus {
  outline: none;
  border-color: var(--mauve);
  box-shadow: 0 0 0 2px rgba(151, 124, 116, 0.25);
}

/* --- Page d'erreur --- */
.message-erreur {
  font-size: 1.05rem;
  color: var(--texte);
  margin: 0.5rem 0 1.25rem;
}

/* --- Icônes symboles (Material Symbols Outlined) --- */
.sym {
  font-family: 'Material Symbols Outlined';
  font-size: 1.05em;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  vertical-align: -0.15em;
  color: inherit;
  user-select: none;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
}

/* --- Page de déconnexion --- */
.message-deconnexion {
  font-size: 1.05rem;
  color: var(--texte);
  margin: 0.5rem 0 1.25rem;
  line-height: 1.6;
}

/* --- Menu utilisateur (avatar + dropdown) --- */
.menu-utilisateur {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-avatar {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.5rem;
  background: none;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  color: var(--texte);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.btn-avatar:hover { background: var(--fond); border-color: var(--mauve); }

.dropdown-compte {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  min-width: 175px;
  z-index: 200;
  overflow: hidden;
}

.dropdown-compte.ouvert { display: block; }

.dropdown-compte a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  color: var(--texte);
  text-decoration: none;
  font-size: 0.9rem;
}

.dropdown-compte .separateur { height: 1px; background: var(--bordure); }

.dropdown-compte .dropdown-titre {
  margin: 0;
  padding: 0.5rem 1rem 0.2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mauve);
}

.dropdown-compte form { margin: 0; }

.dropdown-compte button {
  width: 100%;
  margin: 0;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--texte);
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-compte a:hover,
.dropdown-compte button:hover { background: var(--fond); }

/* === Style épuré : suppression des fonds de cellules === */
table, .tableau { background: transparent; }
th, .tableau th { background: transparent; color: #555; }
tr:hover td { background: transparent; }

/* === Espace fournisseur === */
.fournisseur {
  display: flex;
  min-height: calc(100vh - 120px);
  align-items: stretch;
}

.fournisseur-menu {
  width: 280px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface), #ffffff);
  border-right: 1px solid var(--bordure);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: width 0.2s ease, padding 0.2s ease;
}

.fournisseur-menu a {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  color: var(--texte);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fournisseur-menu a:hover { background: var(--fond); }
.fournisseur-menu a.actif { color: var(--accent); font-weight: 600; }

/* Regroupement repliable dans le menu latéral (Ressources, Organisation,
   Prestations...) : le titre est un bouton (fleche à droite, centrée
   verticalement sur le libellé) qui affiche/masque les liens du groupe ;
   ces liens reçoivent un retrait plus marqué que les liens de premier niveau
   pour bien matérialiser la hiérarchie. */
.menu-groupe-titre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a6a5c;
  padding: 0.6rem 0.8rem;
}
.menu-groupe:first-child .menu-groupe-titre { padding-top: 0.2rem; }

/* Au survol ou à la sélection (clic) du titre, couleur bien plus claire —
   état transitoire uniquement, le titre reprend sa couleur foncée habituelle
   une fois le regroupement déplié. */
.menu-groupe-titre:hover,
.menu-groupe-titre:focus,
.menu-groupe-titre:active { color: #c2b6a3; }

.menu-groupe-fleche {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}
.menu-groupe.replie .menu-groupe-fleche { transform: rotate(-90deg); }

.menu-groupe-corps {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.menu-groupe.replie .menu-groupe-corps { display: none; }

.menu-groupe-corps > a { padding-left: 1.8rem; }

.sous-menu {
  display: flex;
  flex-direction: column;
  margin: 0.15rem 0 0.4rem 1.1rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--bordure);
}
.sous-menu a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: var(--texte);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sous-menu a:hover { background: var(--fond); }
.sous-menu a.actif { color: var(--accent); font-weight: 600; }

.fournisseur-contenu {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fournisseur-entete {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.5rem 0;
  margin-bottom: 1.25rem;
}

.fournisseur-scroll {
  padding: 0 1.5rem 1.5rem;
}

/* --- Pages à onglets (fournisseur/DO/prestataire/hyperviseur) : bandeau,
   menu latéral, titre et menu compte figés — seul .fournisseur-scroll défile --- */
body.page-figee {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-figee .bandeau { flex-shrink: 0; }

body.page-figee .fournisseur {
  flex: 1;
  min-height: 0;
}

body.page-figee .fournisseur-menu {
  overflow-y: auto;
}

body.page-figee .fournisseur-entete {
  flex-shrink: 0;
}

body.page-figee .fournisseur-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

body.page-figee .pied-page {
  flex-shrink: 0;
}

body.page-figee .bandeau-usurpation {
  flex-shrink: 0;
}

.bandeau-usurpation {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  background: #fdeecb;
  color: #6b4a10;
  border-bottom: 2px solid #e0a83a;
  font-size: 0.9rem;
}
.bandeau-usurpation .sym { color: #b3791a; }
.bandeau-usurpation span:nth-child(2) { flex: 1; }
.bandeau-usurpation form { margin: 0; }
.bandeau-usurpation button {
  background: #b3791a;
  color: #fff;
}
.bandeau-usurpation button:hover { background: #8f6013; }

.fournisseur-entete h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--accent);
}

.bascule {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.7rem;
  font-size: 1.1rem;
  background: var(--accent);
  color: var(--fond);
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Menu réduit (rétracté) */
.fournisseur.menu-reduit .fournisseur-menu {
  width: 0;
  padding: 1rem 0;
  border-right: none;
  overflow: hidden;
}

.carte-plein {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.carte-plein h3 {
  color: var(--accent);
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

/* Bloc "résumé" en tête de page (ex : fiche projet, fiche personne) :
   même gabarit que .carte-plein mais fond distinct des blocs liste/création
   qui suivent, pour bien les séparer visuellement. */
.carte-resume {
  background: var(--surface);
  border-color: var(--bordure);
}

dialog {
  position: relative;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1.5rem;
  width: 100%;
  max-width: 560px;
}
dialog::backdrop {
  background: rgba(89, 58, 15, 0.45);
}
dialog h3 {
  color: var(--accent);
  margin: 0 0 1rem;
  font-size: 1.05rem;
}
dialog form { margin: 0; }
/* Toutes les fiches (popups) : boutons sur une seule ligne horizontale,
   Abandon à gauche / Validation à droite — obtenu par inversion CSS
   (row-reverse) sans toucher l'ordre HTML existant (Validation puis Abandon
   dans le code), largeur réduite au contenu plutôt que 100% par défaut. */
dialog .barre-actions {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}
dialog .barre-actions button { width: auto; margin-top: 0; }

/* Confirmation de désactivation (interrupteur actif/inactif) : toast flottant
   ancré en bas du popup plutôt qu'un panneau qui remplace tout le formulaire
   — le reste de la fiche reste visible derrière. */
.confirmation-desactivation {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  width: calc(100% - 3rem);
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 0.9rem 1.1rem;
  z-index: 30;
}
.confirmation-desactivation .aide { margin: 0 0 0.7rem; }
.confirmation-desactivation .barre-actions { margin: 0; }

/* Popup Emails (hyperviseur) : contenu plus large (éditeur HTML + aperçu en
   direct côte à côte) — élargie de 50% par rapport au dialog standard. */
#dialog-gabarit { max-width: 840px; }

/* Popup Historique des avenants (onglet Contrats) : 8 colonnes, élargie pour
   éviter l'ascenseur horizontal du tableau. */
#dialog-historique { max-width: 900px; }

/* Popup Semaine type (onglet Contrats) : jours en lignes (pas de tableau
   large à défilement horizontal) — la hauteur disponible est en revanche
   maximisée pour limiter l'ascenseur vertical sur les longues semaines. */
#dialog-planning { max-height: 92vh; overflow-y: auto; }

/* Fiche de lecture (popup en mode modification) : bloc de paires libellé/valeur */
.fiche-lecture {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
}
.fiche-lecture p { margin: 0.25rem 0; }
.fiche-lecture .libelle { color: #6b6b6b; font-size: 0.85rem; }

/* Interrupteur actif/inactif : checkbox stylée en toggle switch — modèle
   unique pour toute valeur booléenne d'une fiche (saisie/édition). La classe
   .case-interrupteur porte le style directement sur l'input, réutilisable
   aussi bien dans un <label class="interrupteur"> (avec libellé d'état à
   côté) que seule dans une cellule de tableau (ex : grille de droits). */
.interrupteur {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  cursor: pointer;
  user-select: none;
}
input.case-interrupteur {
  appearance: none;
  -webkit-appearance: none;
  width: 2.4rem;
  height: 1.35rem;
  background: #ccc;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  margin: 0;
}
input.case-interrupteur::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.35rem - 4px);
  height: calc(1.35rem - 4px);
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
input.case-interrupteur:checked {
  background: var(--accent);
}
input.case-interrupteur:checked::before {
  transform: translateX(calc(2.4rem - 1.35rem));
}
.interrupteur .libelle-etat { font-weight: 600; }

/* Badge coloré (listes) : même code couleur que l'interrupteur — vrai en
   ocre (accent), faux en gris — pour toute valeur booléenne affichée en
   lecture seule dans un tableau. */
.badge-bool {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #ccc;
  white-space: nowrap;
}
.badge-bool.vrai { background: var(--accent); }

/* Conteneur direct des .sous-carte d'un tableau de bord : rangée qui se
   remplit depuis la gauche, chaque groupe gardant sa largeur naturelle
   (aucun étirement, aucun centrage), passe à la ligne suivante si besoin. */
.groupes-tableau-bord {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
}

.sous-carte {
  border: 1px solid #e5e0d3;
  border-radius: 6px;
  padding: 1rem;
  margin: 0;
  background: #fbfaf6;
}

.sous-carte h4 {
  color: var(--accent);
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

/* Tableaux de bord : les groupes (.sous-carte) ne s'étirent jamais sur toute
   la largeur ni ne se centrent — chacun se rétrécit à la largeur de ses
   tuiles (taille fixe, pas de piste de grille en 1fr) et plusieurs groupes
   s'alignent sur la même ligne depuis la gauche (cf. .groupes-tableau-bord). */
.grille-indicateurs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tuile-indicateur {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
  background: linear-gradient(180deg, var(--sable), #ffffff);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none;
  color: var(--texte);
  text-align: center;
  transition: background 0.15s;
}

.tuile-indicateur:hover {
  background: var(--sable-survol);
}

.tuile-indicateur .sym {
  font-size: 2rem;
  color: var(--accent);
}

.tuile-indicateur .tuile-nombre {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.tuile-indicateur .tuile-libelle {
  font-size: 0.75rem;
}

/* Tuile élargie (250px) pour les indicateurs monétaires (tableau de bord
   hyperviseur > Trésorerie) : un montant en euros ne tient pas dans la
   largeur habituelle (140px) des tuiles à simple compteur. */
.tuile-indicateur.tuile-montant {
  width: 250px;
}
.tuile-indicateur.tuile-montant .tuile-nombre {
  font-size: 1.3rem;
  white-space: nowrap;
}

/* --- Choix à l'inscription (créer / se rattacher, façon Chorus Pro) --- */
.tuile-choix {
  background: linear-gradient(180deg, var(--sable), #ffffff);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.tuile-choix h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  color: var(--accent);
}

.tuile-choix p { font-size: 0.9rem; }

.tuile-choix form { margin-top: auto; }

/* --- Forfaits souscrits (Abonnements > Forfaits) : tuiles --- */
.grille-forfaits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tuile-forfait {
  position: relative;
  background: linear-gradient(180deg, var(--sable), #ffffff);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tuile-forfait-libelle {
  font-size: 0.8rem;
  color: #777;
}

.tuile-forfait-montant {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.tuile-forfait-periode {
  font-size: 0.8rem;
  color: #777;
}

.tuile-forfait form {
  margin-top: 0.5rem;
  align-self: flex-start;
}

.tuile-forfait-resiliation { opacity: 0.75; }

.tuile-forfait-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: #a0341e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

@media (max-width: 640px) {
  .fournisseur-menu { width: 160px; }
}

/* --- Pied de page --- */
.pied-page {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #888;
  font-size: 0.85rem;
}

.pied-page nav {
  margin-bottom: 0.4rem;
}

.pied-page nav a {
  color: var(--accent);
  text-decoration: none;
}

.pied-page nav a:hover {
  text-decoration: underline;
}

.pied-page nav span {
  margin: 0 0.5rem;
  color: #ccc;
}

.pied-page p {
  margin: 0;
}

/* Astérisque obligatoire dans les labels */
.requis {
  color: #a0341e;
}

/* Détection du remplissage automatique du navigateur (Chrome/Edge/Safari) :
   l'animation se déclenche dès que :-webkit-autofill s'applique, ce qui
   permet à connexion.js d'écouter l'événement "animationstart". */
@keyframes remplissageAuto {
  from { opacity: 1; }
  to { opacity: 1; }
}

input:-webkit-autofill {
  animation-name: remplissageAuto;
  animation-duration: 0.001s;
}

/* Planning prévisionnel (grille semaine par collaborateur) */
.tableau-planning th, .tableau-planning td {
  text-align: center;
  white-space: nowrap;
}
.select-statut {
  border: 1px solid var(--bordure);
  border-radius: 4px;
  padding: 0.2rem 0.3rem;
  font-size: 0.85rem;
  background-position: right 0.3rem center;
  padding-right: 1.2rem;
}
.select-statut-vide       { background: #fff; color: var(--texte); }
.select-statut-presentiel { background: #dcefdc; color: #2b6a2b; }
.select-statut-distanciel { background: #dce8f5; color: #2b4d7a; }
.select-statut-absent     { background: #f5dcdc; color: #8a2b2b; }

.txt-danger { color: #8a2b2b; font-weight: 600; }

/* Grille des droits par onglet (hyperviseur, onglet Profils) */
.tableau-droits th, .tableau-droits td {
  text-align: center;
}
.tableau-droits td:first-child, .tableau-droits th:first-child {
  text-align: left;
}

/* Grille de saisie des temps de travail (CRA) */
/* Tableau avancé (tri + filtre par colonne + export CSV) : générique,
   activé par data-triable sur un <table class="tableau"> (cf. commun.js) —
   prévu pour être réutilisé par d'autres listes que le Journal de connexions.
   table-layout: fixed fige les largeurs de colonnes dès le premier rendu
   (avant tout filtrage) : elles ne se recalculent plus quand le filtre par
   colonne masque des lignes (comportement identique à .tableau-hierarchique). */
table[data-triable] { table-layout: fixed; }
th.th-triable { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-triable::after { content: '\21C5'; margin-left: 0.4rem; opacity: 0.35; font-size: 0.8em; }
th.th-triable[data-tri-etat="asc"]::after { content: '\2191'; opacity: 1; }
th.th-triable[data-tri-etat="desc"]::after { content: '\2193'; opacity: 1; }
tr.ligne-filtre th { padding: 0.3rem 0.4rem; background: var(--surface); }
input.filtre-colonne {
  width: 100%;
  margin: 0;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 400;
  border: 1px solid var(--bordure);
  border-radius: 4px;
}

.tableau-scroll { overflow-x: auto; }
.tableau-cra th, .tableau-cra td {
  text-align: center;
  padding: 0.3rem 0.25rem;
}
.tableau-cra .col-libelle { text-align: left; white-space: nowrap; }
.tableau-cra input[type="number"] {
  width: 2.2rem;
  padding: 0.2rem;
  text-align: center;
  /* Pas de flèches +/- : saisie manuelle uniquement, pour une grille bien
     plus étroite (répété sur 28 à 31 colonnes, l'effet cumulé est net). */
  -moz-appearance: textfield;
}
.tableau-cra input[type="number"]::-webkit-outer-spin-button,
.tableau-cra input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tableau-cra th.jour-atypique, .tableau-cra td.jour-atypique { background: linear-gradient(180deg, var(--sable), #ffffff); }
.tableau-cra .btn-commentaire { position: relative; }
.tableau-cra .btn-commentaire.a-commentaire::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}
.tableau-cra tr.sous-entete td {
  text-align: left;
  font-weight: 600;
  color: var(--accent);
  background: var(--fond);
}
.tableau-cra tfoot td.total-jour { font-weight: 600; }
.tableau-cra tfoot td.total-jour.depassement { color: #a0341e; }
