/* WIN — feuille commune (back-office, pages publiques). Charte Muntadaa :
   navy #1d3766, orange #f47a20, gris #444545. Jamais de texte blanc sur l'orange. */
:root {
  --navy: #1d3766;
  --navy-2: #2a4a85;
  --orange: #f47a20;
  --orange-fonce: #c45a0a;
  --gris: #444545;
  --fond: #f4f6fa;
  --carte: #ffffff;
  --texte: #1f2430;
  --texte-2: #5b6272;
  --bord: #dfe3ec;
  --ok: #1e7d3c;
  --ok-fond: #e3f4e8;
  --alerte: #a15c00;
  --alerte-fond: #fff3df;
  --erreur: #b3261e;
  --erreur-fond: #fde8e7;
  --info-fond: #e8eefb;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0f1420; --carte: #171e2d; --texte: #e8ebf2; --texte-2: #a3abbd; --bord: #2a3346;
    --ok-fond: #12301d; --alerte-fond: #3a2a0c; --erreur-fond: #3b1614; --info-fond: #1a2742;
    --ok: #6fd18f; --alerte: #f3b45a; --erreur: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0f1420; --carte: #171e2d; --texte: #e8ebf2; --texte-2: #a3abbd; --bord: #2a3346;
  --ok-fond: #12301d; --alerte-fond: #3a2a0c; --erreur-fond: #3b1614; --info-fond: #1a2742;
  --ok: #6fd18f; --alerte: #f3b45a; --erreur: #ff8a80;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--navy-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: #8fb0ff; } }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
.muet { color: var(--texte-2); }
.petit { font-size: .86rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 40px; padding: .45em 1em; border-radius: 8px; border: 1px solid var(--bord);
  background: var(--carte); color: var(--texte); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primaire { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primaire:hover { background: var(--navy-2); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #1b1200; }
.btn-accent:hover { background: #ff8b33; }
.btn-danger { color: var(--erreur); }
.btn-lien { border: 0; background: none; color: var(--navy-2); padding: 0; min-height: 0; font-weight: 600; }
.btn-petit { min-height: 32px; padding: .2em .7em; font-size: .88rem; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 1px; }

/* Formulaires */
label { display: block; font-weight: 600; margin: 0 0 .25em; }
.champ { margin-bottom: 1rem; }
.aide { font-size: .84rem; color: var(--texte-2); margin-top: .2em; font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=datetime-local],
input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 42px; padding: .5em .7em; border: 1px solid var(--bord); border-radius: 8px;
  background: var(--carte); color: var(--texte); font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 48px; height: 38px; border: 1px solid var(--bord); border-radius: 8px; padding: 2px; background: var(--carte); }
.case { display: flex; align-items: flex-start; gap: .55em; font-weight: 400; margin: .35em 0; }
.case input { margin-top: .25em; width: 18px; height: 18px; flex: 0 0 auto; }
.grille { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ligne { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ligne.fin { justify-content: flex-end; }
.espace { flex: 1; }

/* Cartes, tableaux, pastilles */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1.1rem; margin-bottom: 1rem; }
.carte > h2:first-child, .carte > h3:first-child { margin-top: 0; }
.tableau-boite { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55em .6em; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-2); white-space: nowrap; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: var(--info-fond); }
.pastille { display: inline-block; padding: .1em .55em; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--info-fond); color: var(--navy-2); white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pastille { color: #b9ccff; } }
.pastille.ok { background: var(--ok-fond); color: var(--ok); }
.pastille.alerte { background: var(--alerte-fond); color: var(--alerte); }
.pastille.erreur { background: var(--erreur-fond); color: var(--erreur); }
.pastille.neutre { background: var(--bord); color: var(--texte-2); }
.message { padding: .7em .9em; border-radius: 8px; margin: 0 0 1rem; background: var(--info-fond); }
.message.erreur { background: var(--erreur-fond); color: var(--erreur); }
.message.ok { background: var(--ok-fond); color: var(--ok); }
.message.alerte { background: var(--alerte-fond); color: var(--alerte); }
.message ul { margin: .4em 0 0; padding-left: 1.2em; }

/* Chiffres clés */
.chiffres { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 1rem; }
.chiffre { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .8rem .9rem; }
.chiffre .valeur { font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chiffre .libelle { font-size: .8rem; color: var(--texte-2); }

/* Notifications éphémères */
#toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; max-width: 420px; background: var(--texte); color: var(--carte); padding: .7em 1em; border-radius: 8px; box-shadow: var(--ombre); }
.toast.erreur { background: var(--erreur); color: #fff; }

dialog { border: 0; border-radius: 12px; padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--carte); color: var(--texte); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 16, 30, .55); }
dialog .corps { padding: 1.2rem; max-height: calc(100vh - 140px); overflow: auto; }
dialog .pied { padding: .8rem 1.2rem; border-top: 1px solid var(--bord); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
