:root {
  --bleu: #1a4f8b;      /* bleu Joigny */
  --bleu-fonce: #123a67;
  --fond: #f4f6f9;
  --carte: #ffffff;
  --texte: #1c2733;
  --gris: #6b7a8c;
  --rouge: #b3261e;
  --vert: #1e7d3c;
  --bord: #d7dee7;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 960px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.05rem; }

.topnav {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--bleu); color: #fff; padding: .6rem 1rem;
}
.topnav a { color: #fff; text-decoration: none; padding: .2rem .4rem; border-radius: 4px; }
.topnav a:hover { background: var(--bleu-fonce); }
.topnav .marque { font-weight: 700; margin-right: .5rem; display: inline-flex; align-items: center; gap: .5rem; }
.topnav .logo-nav { height: 30px; width: auto; display: block; }
.topnav form.inline { margin-left: auto; }
.logo-login { display: block; width: 150px; max-width: 60%; height: auto; margin: 0 auto .6rem; }
button.lien { background: none; border: none; color: #dbe7f5; cursor: pointer; font: inherit; }

.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: 10px;
  padding: 1rem 1.2rem; margin: 1rem 0;
}
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.cartes .carte { margin: 0; }
.carte-lien { display: block; text-decoration: none; color: inherit; }
.carte-lien:hover { border-color: var(--bleu); }
.carte-off { opacity: .5; }
.carte p { color: var(--gris); margin: .3rem 0 0; }

.carte-login { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.carte-login .sous-titre { color: var(--gris); }
.carte-login label { display: block; text-align: left; margin-bottom: .3rem; font-weight: 600; }
.carte-login input {
  width: 100%; font-size: 1.6rem; letter-spacing: .5rem; text-align: center;
  padding: .5rem; border: 1px solid var(--bord); border-radius: 8px; margin-bottom: 1rem;
}

form.ligne { display: flex; gap: .6rem; flex-wrap: wrap; }
form.ligne input, form.ligne select {
  flex: 1 1 180px; padding: .5rem .6rem; border: 1px solid var(--bord); border-radius: 8px; font: inherit;
}

.btn {
  background: var(--bleu); color: #fff; border: none; border-radius: 8px;
  padding: .55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--bleu-fonce); }
.btn-large { width: 100%; padding: .8rem; font-size: 1.1rem; }
.btn-petit { padding: .3rem .7rem; font-weight: 500; }
.btn-secondaire { background: #e8edf3; color: var(--texte); }
.btn-secondaire:hover { background: #d8e0ea; }

table { width: 100%; border-collapse: collapse; background: var(--carte); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--bord); }
th { background: #eef2f7; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
td input[type=text], td input:not([type]), td select {
  padding: .35rem .5rem; border: 1px solid var(--bord); border-radius: 6px; font: inherit;
}
tr.inactif td { opacity: .45; }

.alerte { background: #fdecea; color: var(--rouge); padding: .6rem .9rem; border-radius: 8px; }
.bandeau-pin { background: #e7f4ec; color: var(--vert); padding: .8rem 1rem; border-radius: 8px; margin: 1rem 0; }
.bandeau-pin .pin { font-size: 1.5rem; font-weight: 800; letter-spacing: .3rem; }

/* --- M1 --- */
.entete-page { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.filtres { margin: .8rem 0; }
.compteur { color: var(--gris); font-size: .9rem; }
.plaque-cellule { font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: .05em; }
tr.revoque-ligne td { opacity: .55; }
.note { color: var(--gris); font-size: .88rem; }
.btn-danger { background: var(--rouge); }
.btn-danger:hover { background: #8f1e18; }

.formulaire label { display: block; font-weight: 600; font-size: .9rem; margin: .5rem 0; }
.formulaire input, .formulaire select, .formulaire textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem;
  border: 1px solid var(--bord); border-radius: 8px; font: inherit; font-weight: 400;
}
.champ-groupe { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.deux-colonnes { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; }
@media (max-width: 720px) { .deux-colonnes, .champ-groupe { grid-template-columns: 1fr; } }
.centre { text-align: center; }

.statut-actif { color: var(--vert); font-weight: 800; }
.statut-revoque { color: var(--rouge); font-weight: 800; }
.resultat-valide { color: var(--vert); font-weight: 700; }
.resultat-refuse, .resultat-revoque { color: var(--rouge); font-weight: 700; }

.qr-image { width: min(70vw, 320px); height: auto; image-rendering: pixelated; }
.qr-grand { width: min(85vw, 380px); }
.carte-pass, .carte-verif { max-width: 480px; margin: 4vh auto 0; text-align: center; }
.consignes { background: #eef2f7; border-radius: 8px; padding: .8rem 1rem; margin-top: 1rem; text-align: left; }

.plaque-geante {
  font-family: ui-monospace, monospace; font-size: clamp(2.2rem, 11vw, 4rem);
  font-weight: 900; letter-spacing: .06em; margin: .5rem 0;
  background: #fff; border: 3px solid var(--texte); border-radius: 10px; padding: .3rem .5rem;
}
.verif-statut { font-size: 1.3rem; font-weight: 800; }
.verif-nom { font-size: 1.1rem; }
.verif-valide { border-color: var(--vert); border-width: 3px; }
.verif-revoque { border-color: var(--rouge); border-width: 3px; background: #fdecea; }

form.inline { display: inline; margin: 0; }
.statut-message-envoye, .statut-message-delivre { color: var(--vert); }
.statut-message-erreur, .statut-message-abandonne { color: var(--rouge); }

/* --- M2 : dashboard --- */
.compteurs-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1rem 0; }
.compteur-tuile { margin: 0; text-align: center; }
.compteur-tuile span { display: block; font-size: 2.2rem; font-weight: 800; color: var(--bleu); }
.compteur-tuile label { color: var(--gris); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.compteur-refus span { color: var(--rouge); }
.deux-colonnes section h2 { margin-top: 0; }

.scan-entete { display: flex; align-items: center; gap: .8rem; background: var(--bleu); color: #fff; padding: .5rem .8rem; flex-wrap: wrap; }
.scan-entete select { padding: .4rem; border-radius: 8px; border: none; font: inherit; }
.scan-entete form.inline:last-child { margin-left: auto; }
#video { width: 100%; max-height: 60vh; border-radius: 10px; background: #000; margin-top: .8rem; }
#form-plaque { margin-top: .8rem; }
#form-plaque input { text-transform: uppercase; }
.resultat-panneau { text-align: center; padding: 1.2rem; border-radius: 12px; margin-top: 1rem; }
.resultat-panneau.res-valide { background: #e7f4ec; border: 3px solid var(--vert); }
.resultat-panneau.res-refuse { background: #fdecea; border: 3px solid var(--rouge); }
.resultat-panneau.res-erreur { background: #fff4e5; border: 3px solid #b26a00; }

/* --- M4 : hors-ligne --- */
.bandeau-horsligne {
  background: #b26a00; color: #fff; text-align: center; font-weight: 700;
  padding: .5rem .8rem;
}
.note-horsligne { color: #b26a00; font-weight: 700; }
