/* =========================================================================
   Ponctia — application (espace salarié, gestion, plateforme)
   Polices système : aucune requête externe.
   ========================================================================= */
:root {
  --fond: #f3f6fa;
  --surface: #ffffff;
  --texte: #142334;
  --doux: #5b6b7d;
  --ligne: #dbe3ec;
  --primaire: #124d7d;
  --primaire-clair: #e6f0f9;
  --entree: #13865a;
  --entree-clair: #e3f5ec;
  --sortie: #c2621a;
  --sortie-clair: #fcefe3;
  --alerte: #b42318;
  --alerte-clair: #fdecea;
  --attente: #8a6d00;
  --attente-clair: #fff6d6;
  --rayon: 12px;
  --ombre: 0 1px 2px rgba(16, 35, 55, .06), 0 2px 8px rgba(16, 35, 55, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0e1620; --surface: #16212e; --texte: #e6edf5; --doux: #9aabbd; --ligne: #2a3a4c;
    --primaire: #6fb0ea; --primaire-clair: #18324a; --entree: #3ccf8e; --entree-clair: #123526;
    --sortie: #f0a35e; --sortie-clair: #3a2614; --alerte: #ff8a80; --alerte-clair: #3d1a18;
    --attente: #f2cc4b; --attente-clair: #352c0c; --ombre: none;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primaire); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
small, .discret { color: var(--doux); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primaire); outline-offset: 2px; }

/* ----------------------------------------------------------- en-tête */
.barre {
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem;
  background: var(--surface); border-bottom: 1px solid var(--ligne); position: sticky; top: 0; z-index: 10;
}
.marque { display: flex; align-items: center; gap: .5rem; color: var(--texte); text-decoration: none; font-weight: 700; }
.barre-ent { color: var(--doux); font-size: .9rem; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-compte { position: relative; }
.menu-compte summary { list-style: none; cursor: pointer; }
.menu-compte summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primaire); color: #fff; font-weight: 700; font-size: .85rem;
}
.menu-compte > div {
  position: absolute; right: 0; top: 46px; min-width: 230px; background: var(--surface); border: 1px solid var(--ligne);
  border-radius: var(--rayon); padding: .75rem 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.menu-compte > div p { margin: 0 0 .5rem; }
.menu-compte > div a, .menu-compte .lien { display: block; padding: .35rem 0; }

.nav {
  display: flex; gap: .25rem; padding: .4rem 1rem; overflow-x: auto; background: var(--surface);
  border-bottom: 1px solid var(--ligne); scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a, .onglets a {
  white-space: nowrap; padding: .45rem .8rem; border-radius: 999px; text-decoration: none; color: var(--doux); font-size: .95rem;
}
.nav a:hover, .onglets a:hover { background: var(--primaire-clair); color: var(--texte); }
.nav a[aria-current], .onglets a[aria-current] { background: var(--primaire); color: #fff; }
.nav-sep { flex: 0 0 1px; background: var(--ligne); margin: .3rem .4rem; }
.pastille { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--alerte); color: #fff; font-size: .75rem; text-align: center; }
.onglets { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; }

/* ----------------------------------------------------------- mise en page */
.contenu { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.carte {
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--ombre);
}
.carte-etroite { max-width: 420px; margin: 3rem auto; }
.carte-moyenne { max-width: 640px; margin: 0 auto 1rem; }
.grille-2, .grille-3, .grille-4 { display: grid; gap: 1rem; }
@media (min-width: 760px) {
  .grille-2 { grid-template-columns: 1fr 1fr; }
  .grille-3 { grid-template-columns: repeat(3, 1fr); }
  .grille-4 { grid-template-columns: repeat(4, 1fr); }
}
.grille-2 > .carte, .grille-3 > .carte, .grille-4 > .carte { margin-bottom: 0; }
.grille-2, .grille-3, .grille-4 { margin-bottom: 1rem; }
.titre-nav { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.titre-nav h1 { margin: 0; flex: 1; text-align: center; font-size: 1.25rem; }
.titre-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.titre-actions h1 { margin: 0; }
.fil { margin: 0 0 .25rem; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.en-ligne { display: inline; }

/* ----------------------------------------------------------- chiffres */
.chiffres .chiffre { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.chiffre span { color: var(--doux); font-size: .85rem; }
.chiffre strong { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.negatif { color: var(--alerte); }
.positif { color: var(--entree); }

/* ----------------------------------------------------------- boutons */
.bouton, button.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px;
  padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--ligne); background: var(--surface);
  color: var(--texte); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.bouton:hover { border-color: var(--primaire); }
.bouton.bouton-plein { background: var(--primaire); border-color: var(--primaire); color: #fff; }
@media (prefers-color-scheme: dark) { .bouton.bouton-plein { color: #0e1620; } }
.bouton.bouton-danger { color: var(--alerte); border-color: var(--alerte); }
.lien { background: none; border: 0; padding: 0; color: var(--primaire); font: inherit; text-decoration: underline; cursor: pointer; }

/* ----------------------------------------------------------- formulaires */
.formulaire { display: grid; gap: .9rem; }
.grille-form { display: grid; gap: .9rem; }
@media (min-width: 760px) { .grille-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
fieldset.carte { margin: 0 0 1rem; }
fieldset legend { font-weight: 700; padding: 0 .3rem; }
fieldset[disabled] input, fieldset[disabled] select { opacity: .75; }
.champ { display: flex; flex-direction: column; gap: .3rem; }
.champ label { font-weight: 600; font-size: .95rem; }
.champ small { font-size: .82rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--ligne); border-radius: 10px;
  background: var(--surface); color: var(--texte); font: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primaire); outline: 2px solid var(--primaire-clair); }
.champ-case { flex-direction: row; flex-wrap: wrap; align-items: center; }
.champ-case input { width: 20px; height: 20px; }
.champ-case small { flex-basis: 100%; }
.choix { border: 0; padding: 0; margin: 0; display: grid; gap: .4rem; }
.choix legend { font-weight: 600; margin-bottom: .3rem; }
.choix label { display: flex; gap: .5rem; align-items: center; padding: .5rem .7rem; border: 1px solid var(--ligne); border-radius: 10px; cursor: pointer; }
.choix label:has(input:checked) { border-color: var(--primaire); background: var(--primaire-clair); }
.choix-ligne { display: flex; flex-wrap: wrap; }
.formulaire-ligne { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.formulaire-ligne input:not([type=hidden]) { flex: 1 1 180px; width: auto; }
.formulaire-ligne select, .formulaire-ligne input[type=time] { flex: 0 0 auto; width: auto; }
.filtres { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filtres .champ { min-width: 180px; }
.copie { font-family: ui-monospace, monospace; font-size: .85rem; }

/* ----------------------------------------------------------- alertes, étiquettes */
.alerte { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--primaire-clair); border: 1px solid var(--ligne); }
.alerte-ok { background: var(--entree-clair); border-color: var(--entree); }
.alerte-erreur { background: var(--alerte-clair); border-color: var(--alerte); }
.etiquette {
  display: inline-block; padding: .1rem .5rem; margin: .1rem .2rem .1rem 0; border-radius: 999px; font-size: .78rem;
  background: var(--primaire-clair); color: var(--texte); white-space: nowrap;
}
.etiquette small { color: inherit; opacity: .8; }
.etiquette-alerte { background: var(--alerte-clair); color: var(--alerte); }
.etiquette-ok { background: var(--entree-clair); color: var(--entree); }
.etiquette-info { background: var(--primaire-clair); color: var(--primaire); }
.etiquette-attente { background: var(--attente-clair); color: var(--attente); }
.point { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ligne); vertical-align: middle; }
.point-vert { background: var(--entree); box-shadow: 0 0 0 3px var(--entree-clair); }
.point-rouge { background: var(--alerte); }

/* ----------------------------------------------------------- pointer */
.pointer { text-align: center; padding: 1.5rem 1.2rem; }
.pointer-date { margin: 0; color: var(--doux); }
.pointer-heure { font-size: 3.2rem; font-weight: 800; margin: .1rem 0; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pointer-statut { margin: 0 0 1.2rem; }
.bouton-pointer {
  width: 100%; max-width: 420px; min-height: 76px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--entree); color: #fff; font: 700 1.3rem/1.2 inherit; font-family: inherit;
  box-shadow: 0 6px 18px rgba(19, 134, 90, .3); transition: transform .1s;
}
.bouton-pointer.sortie { background: var(--sortie); box-shadow: 0 6px 18px rgba(194, 98, 26, .3); }
.bouton-pointer:active { transform: scale(.98); }
.bouton-pointer[disabled] { opacity: .6; cursor: progress; }
@media (prefers-color-scheme: dark) { .bouton-pointer { color: #0e1620; } }
.pointer-resultat { margin: 1rem auto 0; max-width: 420px; padding: 1rem; border-radius: 14px; font-weight: 700; font-size: 1.15rem; }
.pointer-resultat.ok { background: var(--entree-clair); color: var(--entree); }
.pointer-resultat.erreur { background: var(--alerte-clair); color: var(--alerte); }
.frise { list-style: none; padding: 0; margin: 0 0 .75rem; }
.frise li { padding: .35rem 0 .35rem 1rem; border-left: 3px solid var(--ligne); }
.frise-entree { border-color: var(--entree) !important; }
.frise-sortie { border-color: var(--sortie) !important; }

/* ----------------------------------------------------------- semaine */
.jours { display: grid; gap: .75rem; }
@media (min-width: 900px) { .jours { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.jour { margin: 0; }
.jour header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.jour h3 { margin: 0; text-transform: capitalize; }
.jour-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.jour-alerte { border-left: 4px solid var(--alerte); }
.jour-vide { opacity: .65; }
.jour-actions { margin: .5rem 0 0; font-size: .9rem; }
.puces-heures { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.puces-heures li { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.ph-entree { background: var(--entree-clair); color: var(--entree); }
.ph-sortie { background: var(--sortie-clair); color: var(--sortie); }
.action-mini { display: inline; position: relative; }
.action-mini summary { list-style: none; cursor: pointer; opacity: .6; padding: 0 .2rem; }
.action-mini summary::-webkit-details-marker { display: none; }
.action-mini[open] form {
  position: absolute; z-index: 5; left: 0; top: 1.6rem; width: 260px; padding: .75rem; background: var(--surface);
  border: 1px solid var(--ligne); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); color: var(--texte);
}
.ajout-pointage { margin-top: .5rem; font-size: .9rem; }
.ajout-pointage summary { cursor: pointer; color: var(--primaire); }

/* ----------------------------------------------------------- tableaux */
.table-defile { overflow-x: auto; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.tableau { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tableau th, .tableau td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--ligne); vertical-align: top; }
.tableau thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--doux); background: var(--fond); }
.tableau tbody tr:last-child > * { border-bottom: 0; }
.tableau tr.inactif { opacity: .55; }
.matrice td { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.matrice th[scope=row] { white-space: nowrap; }
.case-alerte { background: var(--alerte-clair); }
.case-encours { box-shadow: inset 0 -3px 0 var(--entree); }
.alerte-point { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--alerte); color: #fff; font-size: .7rem; font-weight: 800; }
.tableau-horaire input { min-width: 110px; }
.liste-simple { list-style: none; padding: 0; margin: 0; }
.liste-simple li { padding: .5rem 0; border-bottom: 1px solid var(--ligne); }
.liste-simple li:last-child { border-bottom: 0; }
.demande header { margin-bottom: .4rem; }
.demande p { margin: .4rem 0; }
.reponse { background: var(--fond); padding: .5rem .75rem; border-radius: 8px; }

/* ----------------------------------------------------------- QR, badges */
.qr { display: inline-block; background: #fff; padding: 12px; border-radius: 12px; line-height: 0; }
.qr svg, .qr img { display: block; }
.badge-perso { text-align: center; max-width: 460px; margin: 0 auto; }
.activation { text-align: center; }
.code-appairage { font: 800 2.6rem/1 ui-monospace, monospace; letter-spacing: .3em; text-align: center; padding: 1rem; background: var(--primaire-clair); border-radius: 12px; }
pre.code { background: var(--fond); padding: 1rem; border-radius: 10px; overflow-x: auto; font-size: .85rem; }
details.aide summary { cursor: pointer; font-weight: 600; margin-top: 1rem; }

/* ----------------------------------------------------------- impression */
body.impression { background: #fff; color: #000; padding: 1rem; }
.cartes { display: grid; grid-template-columns: repeat(auto-fill, 85mm); gap: 6mm; }
.carte-badge {
  width: 85mm; height: 54mm; border: 1px dashed #999; border-radius: 3mm; padding: 4mm; display: flex;
  justify-content: space-between; align-items: center; break-inside: avoid; color: #000; background: #fff;
}
.carte-badge .qr { padding: 0; }
.cb-texte { display: flex; flex-direction: column; gap: 2mm; font-size: 9pt; }
.cb-nom { font-size: 13pt; font-weight: 800; line-height: 1.15; }
.affiche { text-align: center; max-width: 180mm; margin: 0 auto; color: #000; }
.affiche h1 { font-size: 40pt; margin: 4mm 0; }
.affiche-ent, .affiche-site { font-size: 16pt; margin: 0; }
.affiche ol { text-align: left; display: inline-block; font-size: 14pt; }
@media print {
  .non-imprime { display: none; }
  body.impression { padding: 0; }
  .carte-badge { border-style: solid; border-color: #ccc; }
}

/* ----------------------------------------------------------- lecteur QR (téléphone) */
.scanner { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 1rem; }
.scanner > div { text-align: center; color: #fff; width: min(92vw, 480px); }
.scanner video { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 1; object-fit: cover; }

/* ----------------------------------------------------------- planning des absences */
.planning { font-size: .78rem; }
.planning th, .planning td { padding: .3rem .15rem; text-align: center; min-width: 30px; }
.planning th[scope=row] { text-align: left; white-space: nowrap; padding-left: .6rem; min-width: 120px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.planning thead th { line-height: 1.15; text-transform: none; letter-spacing: 0; }
.pl-we { background: var(--fond); }
.pl-ferie { background: var(--attente-clair); }
.pl-auj { box-shadow: inset 0 -3px 0 var(--primaire); }
.pl { display: inline-block; min-width: 26px; padding: .1rem .15rem; border-radius: 5px; font-weight: 700; font-size: .7rem; }
.pl-conges { background: var(--entree-clair); color: var(--entree); }
.pl-rtt { background: var(--primaire-clair); color: var(--primaire); }
.pl-maladie { background: var(--alerte-clair); color: var(--alerte); }
.pl-autre { background: var(--sortie-clair); color: var(--sortie); }
.pl-attente { background: repeating-linear-gradient(45deg, transparent 0 3px, var(--ligne) 3px 5px); outline: 1px dashed currentColor; }
.pl-total td, .pl-total th { font-weight: 700; border-top: 2px solid var(--ligne); }
.legende { font-size: .85rem; color: var(--doux); }

/* ----------------------------------------------------------- documentation */
.doc-mise-en-page { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 1000px) { .doc-mise-en-page { grid-template-columns: 240px minmax(0, 1fr); } .doc-sommaire { position: sticky; top: 72px; } }
.doc-sommaire ol { padding-left: 1.2rem; margin: .5rem 0 0; font-size: .9rem; }
.doc-sommaire li { margin: .25rem 0; }
.doc { line-height: 1.65; max-width: 900px; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--ligne); scroll-margin-top: 72px; }
.doc h3 { margin-top: 1.5rem; }
.doc code { background: var(--fond); padding: .05rem .35rem; border-radius: 5px; font-size: .88em; }
.doc pre.code code { background: none; padding: 0; }
.doc .table-defile { margin: 1rem 0; }

/* ----------------------------------------------------------- enrôlement des badges */
.enrolement { text-align: center; position: sticky; top: 62px; z-index: 4; }
.enr-etape { margin: 0; color: var(--doux); }
.enr-nom { font-size: 1.8rem; font-weight: 800; margin: .2rem 0 1rem; }
.enrolement form { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: 640px; margin: 0 auto .5rem; }
.enrolement input { flex: 1 1 240px; font: 600 1.2rem ui-monospace, monospace; text-align: center; }
.enr-resultat { min-height: 1.5em; font-weight: 700; margin: .4rem 0; }
tr.enr-courante { background: var(--primaire-clair); box-shadow: inset 4px 0 0 var(--primaire); }
tr.enr-fait td[data-enr-valeur] { color: var(--entree); font-weight: 700; }
