:root {
  --teal: #144161;
  --teal-clair: #1d5a85;
  --corail: #EC5A64;
  --ardoise: #617CA9;
  --fond: #f5f6f8;
  --carte: #ffffff;
  --texte: #1c2733;
  --texte-doux: #5b6773;
  --bord: #dde2e8;
  --vert: #1f7a4d;
  --vert-fond: #e3f3ea;
  --orange: #a35a00;
  --orange-fond: #fdf0dc;
  --rouge: #b42330;
  --rouge-fond: #fde8ea;
  --bleu-fond: #e7edf6;
  --gris-fond: #eef0f3;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(20, 65, 97, .06), 0 4px 16px rgba(20, 65, 97, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--texte);
  background: var(--fond);
}
a { color: var(--teal-clair); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; color: var(--teal); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
.doux { color: var(--texte-doux); }
.petit { font-size: .87rem; }
.chargement { padding: 3rem; text-align: center; color: var(--texte-doux); }

/* En-tête */
.entete {
  background: var(--teal);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.entete-interieur {
  max-width: 1180px; margin: 0 auto; padding: .7rem 16px;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; }
.marque-pastille { width: 26px; height: 26px; border-radius: 7px; background: #fff; display: grid; place-items: center; }
.marque-pastille::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--corail); }
.marque small { display: block; font-weight: 400; opacity: .75; font-size: .75rem; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a, .nav button {
  color: #fff; text-decoration: none; padding: .4rem .7rem; border-radius: 7px;
  background: none; border: 0; font: inherit; cursor: pointer; opacity: .88;
}
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.1); opacity: 1; }
.nav a.actif { background: rgba(255,255,255,.16); opacity: 1; }
.nav a.cloche { position: relative; padding-right: 1.4rem; }
.cloche .compte {
  position: absolute; top: 0; right: 0; background: var(--corail); color: #fff;
  border-radius: 999px; font-size: .7rem; min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 4px;
}

.contenu { max-width: 1180px; margin: 0 auto; padding: 1.5rem 16px 4rem; }

/* Cartes et grilles */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.25rem; box-shadow: var(--ombre); margin-bottom: 1.25rem; }
.grille { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.titre-page { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.titre-page h1 { margin: 0; }

/* Page de connexion */
.auth { max-width: 440px; margin: 3rem auto; }
.auth .carte { padding: 2rem; }
.auth-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.5rem; }
.auth-logo .marque-pastille { background: var(--teal); width: 38px; height: 38px; border-radius: 10px; }
.auth-logo .marque-pastille::after { width: 16px; height: 16px; }
.auth-logo strong { display: block; color: var(--teal); font-size: 1.1rem; }
.liens-auth { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; font-size: .9rem; }

/* Formulaires */
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
.champ { margin-bottom: 1rem; }
.aide { font-size: .84rem; color: var(--texte-doux); margin-top: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: .6rem .7rem; font: inherit; color: inherit;
  border: 1px solid var(--bord); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ardoise); outline-offset: 1px; border-color: var(--ardoise);
}
textarea { min-height: 96px; resize: vertical; }
.ligne { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.choix { display: flex; gap: .6rem; flex-wrap: wrap; }
.choix label {
  font-weight: 500; display: flex; align-items: center; gap: .5rem; margin: 0;
  border: 1px solid var(--bord); border-radius: 8px; padding: .55rem .8rem; cursor: pointer; background: #fff;
}
.choix label:has(input:checked) { border-color: var(--teal); background: var(--bleu-fond); }
.choix input { accent-color: var(--teal); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--teal); color: #fff;
}
.btn:hover { background: var(--teal-clair); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.secondaire { background: #fff; color: var(--teal); border-color: var(--bord); }
.btn.secondaire:hover { border-color: var(--teal); }
.btn.corail { background: var(--corail); }
.btn.vert { background: var(--vert); }
.btn.rouge { background: var(--rouge); }
.btn.petit { padding: .35rem .7rem; font-size: .85rem; }
.btn.bloc { width: 100%; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* Messages */
.alerte { border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alerte.info { background: var(--bleu-fond); border-color: #c9d6ea; }
.alerte.ok { background: var(--vert-fond); border-color: #b9dfca; color: #134b30; }
.alerte.attention { background: var(--orange-fond); border-color: #f2d3a3; color: #6b3c00; }
.alerte.erreur { background: var(--rouge-fond); border-color: #f4bcc2; color: #7d1720; }
.alerte strong { display: block; margin-bottom: .15rem; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--texte); color: #fff; padding: .7rem 1.1rem; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px); z-index: 50;
}
.toast.visible { opacity: 1; transform: translateX(-50%); }
.toast.erreur { background: var(--rouge); }

/* Compteur de jokers */
.compteur { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.jauge { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; width: 100%; max-width: 360px; }
.jauge span { height: 22px; border-radius: 4px; background: var(--gris-fond); border: 1px solid var(--bord); }
.jauge span.entreprise { background: var(--ardoise); border-color: var(--ardoise); }
.jauge span.personnel { background: var(--teal); border-color: var(--teal); }
.jauge span.attente { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); }
.chiffre { font-size: 2.2rem; font-weight: 700; color: var(--teal); line-height: 1; }
.chiffre small { font-size: 1rem; color: var(--texte-doux); font-weight: 500; }
.legende { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--texte-doux); margin-top: .6rem; }
.legende i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.stat { background: var(--fond); border-radius: 8px; padding: .7rem .9rem; }
.stat b { display: block; font-size: 1.3rem; color: var(--teal); }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.en_attente { background: var(--orange-fond); color: var(--orange); }
.badge.info_demandee { background: #fbe4f0; color: #8a1f5c; }
.badge.validee { background: var(--vert-fond); color: var(--vert); }
.badge.refusee { background: var(--rouge-fond); color: var(--rouge); }
.badge.annulee { background: var(--gris-fond); color: var(--texte-doux); }
.badge.arret_travail { background: var(--bleu-fond); color: var(--teal); }
.badge.personnel { background: #e3edf2; color: var(--teal); }
.badge.entreprise { background: #ebeef6; color: #3d5585; }
.badge.depasse { background: var(--rouge-fond); color: var(--rouge); }
.badge.proche { background: var(--orange-fond); color: var(--orange); }

/* Tableaux */
.tableau-conteneur { overflow-x: auto; border: 1px solid var(--bord); border-radius: var(--rayon); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { background: #f8f9fb; font-weight: 600; color: var(--texte-doux); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.cliquable { cursor: pointer; }
tbody tr.cliquable:hover { background: #f8fafc; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
.vide { padding: 2rem; text-align: center; color: var(--texte-doux); }

/* Filtres */
.filtres { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-bottom: 1rem; }
.filtres label { font-size: .82rem; }
.onglets { display: flex; gap: .3rem; border-bottom: 1px solid var(--bord); margin-bottom: 1rem; flex-wrap: wrap; }
.onglets a { padding: .55rem .9rem; text-decoration: none; color: var(--texte-doux); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.onglets a.actif { color: var(--teal); border-bottom-color: var(--corail); }

/* Détail d'une demande */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0; }
.dl dt { color: var(--texte-doux); font-size: .9rem; }
.dl dd { margin: 0; white-space: pre-wrap; }
.fil { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .7rem; }
.fil li { background: var(--fond); border-radius: 8px; padding: .7rem .9rem; }
.fil li.equipe { background: var(--bleu-fond); }
.fil .auteur { font-size: .82rem; color: var(--texte-doux); margin-bottom: .2rem; }
.fichiers { list-style: none; padding: 0; margin: 0 0 1rem; }
.fichiers li { padding: .35rem 0; border-bottom: 1px dashed var(--bord); }
.fichiers button { background: none; border: 0; color: var(--teal-clair); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.notif { display: block; padding: .8rem 1rem; border-bottom: 1px solid var(--bord); text-decoration: none; color: inherit; }
.notif.nonlue { background: #fbfcfe; border-left: 3px solid var(--corail); }
.notif p { margin: .2rem 0 0; white-space: pre-wrap; color: var(--texte-doux); font-size: .9rem; }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .carte { padding: 1rem; }
  .auth { margin: 1rem auto; }
  .auth .carte { padding: 1.25rem; }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .5rem; }
  .nav { margin-left: 0; width: 100%; }
}
