/* SSO : pages de connexion et console. Aucun script ; thème clair et sombre selon le système. */
:root {
  --fond: #f6f5f2;
  --surface: #ffffff;
  --texte: #1d1d1b;
  --doux: #5f5d58;
  --bord: #d9d6cf;
  --accent: #8a5a1c;
  --accent-texte: #ffffff;
  --danger: #a3261b;
  --succes-fond: #e6f2e8;
  --succes-texte: #1f5a2b;
  --erreur-fond: #fbe7e5;
  --erreur-texte: #8a1f16;
  --passe: #9a978f;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #171715;
    --surface: #22211f;
    --texte: #ecebe7;
    --doux: #a9a69e;
    --bord: #3a3935;
    --accent: #d99a4e;
    --accent-texte: #1a1408;
    --danger: #ef7d71;
    --succes-fond: #1d3322;
    --succes-texte: #a8dcb2;
    --erreur-fond: #3d1d1a;
    --erreur-texte: #f4b3ab;
    --passe: #75736c;
  }
}

* { 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, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .9em; }
small { color: var(--doux); font-weight: normal; }

.entete {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 16px; background: var(--surface); border-bottom: 1px solid var(--bord);
}
.marque { font-weight: 700; text-decoration: none; color: var(--texte); }
.entete-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

main { padding: 1.5rem 16px 3rem; margin: 0 auto; }
main.etroit { max-width: 32rem; }
main.large { max-width: 72rem; min-width: 0; flex: 1; }

.console { display: flex; align-items: flex-start; }
.console-nav {
  display: flex; flex-direction: column; gap: .25rem; padding: 1.5rem 16px; min-width: 13rem;
  position: sticky; top: 0;
}
.console-nav a { text-decoration: none; padding: .35rem .5rem; border-radius: 6px; }
.console-nav a:hover { background: var(--surface); }
@media (max-width: 760px) {
  .console { flex-direction: column; }
  .console-nav { flex-direction: row; flex-wrap: wrap; position: static; padding-bottom: 0; min-width: 0; }
}

.formulaire { display: flex; flex-direction: column; gap: .4rem; max-width: 32rem; }
.formulaire button { margin-top: .75rem; align-self: flex-start; }
label { font-weight: 600; font-size: .95rem; }
label.case { font-weight: normal; display: flex; gap: .5rem; align-items: baseline; }
label.petit { font-size: .85rem; white-space: nowrap; }
input, select, textarea {
  font: inherit; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bord); border-radius: 6px; padding: .5rem .6rem; max-width: 100%;
}
input[type="checkbox"], input[type="radio"] { padding: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
fieldset.choix { border: 1px solid var(--bord); border-radius: 6px; padding: .5rem .75rem; display: flex; flex-direction: column; gap: .25rem; }
fieldset.choix label { font-weight: normal; }

button, .bouton {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-block; text-decoration: none;
  background: var(--accent); color: var(--accent-texte); border: 1px solid var(--accent);
  border-radius: 6px; padding: .5rem .9rem;
}
button.secondaire, .bouton.secondaire { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.lien { background: none; border: none; color: var(--accent); padding: 0; font-weight: normal; text-decoration: underline; }

form.en-ligne { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.ajout { margin-top: .75rem; }
.actions, .actions-groupe { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.actions-ligne { white-space: nowrap; }
.actions-ligne form { margin-right: .25rem; }
.barre { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.recherche { display: flex; gap: .5rem; }

.message { padding: .6rem .8rem; border-radius: 6px; background: var(--succes-fond); color: var(--succes-texte); }
.message.erreur { background: var(--erreur-fond); color: var(--erreur-texte); }
.note { color: var(--doux); font-size: .92rem; }
.fil { margin: 0 0 .25rem; font-size: .92rem; }
.masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.fiche { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.fiche dt { color: var(--doux); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .fiche { grid-template-columns: 1fr; } .fiche dd { margin-bottom: .5rem; } }

table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .95rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
thead th { font-size: .85rem; color: var(--doux); font-weight: 600; }
tr.passe td, tr.passe th { color: var(--passe); }
.defilant { overflow-x: auto; }
section > table { display: block; overflow-x: auto; }
.matrice td { white-space: nowrap; }
.matrice td label { display: flex; }

.etiquette { font-size: .8rem; padding: .05rem .4rem; border-radius: 4px; border: 1px solid var(--bord); white-space: nowrap; }
.etiquette.refus { border-color: var(--danger); color: var(--danger); }

.qr { display: block; background: #ffffff; border-radius: 6px; margin: .5rem 0; }
.secret, .lien-a-copier, .detail { overflow-wrap: anywhere; word-break: break-all; }
.lien-a-copier { display: block; padding: .6rem; background: var(--surface); border: 1px solid var(--bord); border-radius: 6px; user-select: all; }
.sections li { margin-bottom: .4rem; }

/* Écran « Droits » : liste des rôles à gauche, matrice du rôle choisi à droite. */
.droits { display: grid; grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.droits-roles { display: flex; flex-direction: column; gap: .25rem; }
.droits-roles a { text-decoration: none; color: var(--texte); padding: .45rem .6rem; border-radius: 6px; border: 1px solid transparent; }
.droits-roles a:hover { background: var(--surface); }
.droits-roles a[aria-current="page"] { border-color: var(--accent); background: var(--surface); }
.droits-matrice h2 { margin-top: 0; }
.filtres { margin: .25rem 0 1rem; }
details.module { margin: 1rem 0; }
details.module > summary { cursor: pointer; padding: .4rem 0; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.matrice th[scope="row"] { font-weight: normal; min-width: 14rem; white-space: normal; }
.matrice tr.niveau-1 th[scope="row"] { padding-left: 1.75rem; }
.matrice tr.niveau-2 th[scope="row"] { padding-left: 3rem; }
.matrice tr.alerte th, .matrice tr.alerte td { background: var(--erreur-fond); }
.case-action { text-align: center; }
input.non-detenu { outline: 1px dashed var(--doux); outline-offset: 2px; }
input.jours { width: 6.5rem; }
.ferme { color: var(--bord); }
code.petit { font-size: .75rem; color: var(--doux); }
tr.niveau-1 > th[scope="row"] { padding-left: 1.75rem; }
@media (max-width: 760px) {
  .droits { grid-template-columns: 1fr; }
  .droits-roles { flex-direction: row; flex-wrap: wrap; }
}
