:root {
    --marine: #12325c;
    --bleu: #1a5fac;
    --bleu-fonce: #0e69be;
    --vert: #8cc63f;
    --encre: #343a40;
    --gris: #e4e4e4;
    --ligne: #d5d8de;
    --fond-carte: #fff;
    --age-rouge: #e10600;
    --age-orange: #ff8c00;
    --age-jaune: #ffe100;
    --age-bleu: #2f6fe0;
    --age-vert: #1f8a3a;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", "Liberation Sans", "Nimbus Sans", Arial, sans-serif;
    color: var(--encre);
    background: #fff;
    min-height: 100vh;
}

a { color: var(--bleu); }

img { max-width: 100%; height: auto; }

.lien-evitement {
    position: absolute;
    left: 8px;
    top: -40px;
    background: #fff;
    color: var(--marine);
    padding: 6px 10px;
    z-index: 50;
}

.lien-evitement:focus { top: 8px; }

.barre-haute {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto minmax(220px, 1fr);
    align-items: center;
    column-gap: 12px;
    background: var(--marine);
    color: #fff;
    padding: 10px 16px 14px;
    box-shadow: inset 0 -4px 0 var(--vert);
    min-height: 96px;
}

.barre-gauche {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.logo-cadre {
    background: #fff;
    border-radius: 8px;
    padding: 3px 6px;
    display: flex;
    line-height: 0;
}

.logo-cadre img { height: 68px; width: auto; }

.barre-haute h1 {
    margin: 0;
    text-align: center;
    font-size: 42px;
    letter-spacing: 0.08em;
    font-weight: 750;
    line-height: 1;
}

.barre-droite {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: right;
}

.qui { margin: 0; font-size: 13px; line-height: 1.35; }

.btn-nouvelle {
    background: #fff;
    color: var(--marine);
    border: 2px solid var(--vert);
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.btn-nouvelle:hover { background: var(--vert); color: var(--marine); }

.btn-lien {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font: inherit;
}

.btn-lien:hover { background: rgba(255, 255, 255, 0.12); }

.corps {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 12px 140px;
}

.rail { width: 168px; flex: none; }

.compteur {
    margin: 4px 0 0;
    text-align: center;
    font-size: 13px;
    line-height: 1.25;
    color: var(--marine);
}

.compteur-nombre {
    display: block;
    font-size: 32px;
    font-weight: 750;
    color: var(--bleu);
    line-height: 1.1;
}

.rail h2 {
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--marine);
    margin: 16px 0 8px;
}

.pastille {
    display: block;
    margin: 4px 0;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid rgba(0, 0, 0, 0.22);
}

.note-legende { margin: 8px 0 0; font-size: 12px; color: #555; }

.contenu { flex: 1; min-width: 0; }

.filtre {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: flex-end;
    margin: 0 0 8px;
}

.filtre label, .grille label, .forme-connexion label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--marine);
    margin-bottom: 4px;
}

.filtre input, .filtre select { width: auto; min-width: 150px; }

.compte-filtre { margin: 0 0 8px; font-size: 13px; color: #555; }

.note-js { margin: 0 0 8px; font-size: 12px; color: #666; }

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--ligne);
    background: #fff;
}

table.registre {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 860px;
}

table.registre th {
    background: #f3f4f6;
    color: #222;
    font-weight: 650;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #ccc;
    white-space: nowrap;
}

table.registre td {
    padding: 4px 8px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

table.registre td.notes, table.registre td.motif {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td.col-lu, td.col-details, th.col-lu, th.col-details { text-align: center; width: 64px; }

td.nowrap { white-space: nowrap; }

.non-lu { font-weight: 750; }

.age-rouge { background: var(--age-rouge); color: #fff; }
.age-orange { background: var(--age-orange); color: #1a1a1a; }
.age-jaune { background: var(--age-jaune); color: #1a1a1a; }
.age-bleu { background: var(--age-bleu); color: #fff; }
.age-termine { background: var(--age-vert); color: #fff; }
.age-recent { background: #fff; color: #1a1a1a; }

tr.age-rouge td { background: var(--age-rouge); color: #fff; }
tr.age-orange td { background: var(--age-orange); color: #1a1a1a; }
tr.age-jaune td { background: var(--age-jaune); color: #1a1a1a; }
tr.age-bleu td { background: var(--age-bleu); color: #fff; }
tr.age-termine td { background: var(--age-vert); color: #fff; }
tr.age-recent td { background: #fff; color: #1a1a1a; }

.btn-details {
    display: inline-flex;
    width: 30px;
    height: 22px;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #8d97a3;
    border-radius: 3px;
    color: var(--marine);
}

.icone-petite { width: 16px; height: 16px; }

input[type="checkbox"] {
    accent-color: var(--marine);
    width: 16px;
    height: 16px;
}

.barre-modules {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: var(--gris);
    border-top: 1px solid #cfcfcf;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 10px 14px;
}

.barre-modules a {
    width: 118px;
    min-height: 86px;
    background: #fff;
    border: 1px solid #b7b7b7;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--marine);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    padding: 8px 6px;
}

.barre-modules a:hover { border-color: var(--bleu); }

.barre-modules a.actif {
    border: 2px solid var(--bleu);
    box-shadow: 0 0 0 2px rgba(26, 95, 172, 0.18);
}

.icone { width: 28px; height: 28px; }

.barre-liste {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
}

.barre-liste h2, .fiche h2, .contenu > h2 { margin: 0; color: var(--marine); font-size: 22px; }

.fiche {
    background: var(--fond-carte);
    border: 1px solid var(--ligne);
    border-radius: 10px;
    padding: 18px 20px 20px;
    max-width: 860px;
}

.fiche h2 { margin-bottom: 8px; }

.fiche .pastille { display: inline-block; margin: 0 0 14px; }

.fiche dl {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 8px 12px;
    margin: 0 0 16px;
}

.fiche dt { color: var(--marine); font-weight: 750; }
.fiche dd { margin: 0; }

.grille {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.grille .plein { grid-column: 1 / -1; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], select, textarea {
    width: 100%;
    border: 1px solid #c5ccd6;
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    font-size: 16px;
    color: var(--encre);
    background: #fff;
}

textarea { min-height: 120px; resize: vertical; }

.aide { margin: 4px 0 0; font-size: 12px; color: #555; font-weight: 400; }

.req { color: var(--age-rouge); }

.actions, .actions-ligne {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 16px;
}

.actions form, .actions-ligne form { margin: 0; }

.btn, button.btn {
    background: var(--bleu);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 8px 14px;
    font-weight: 700;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:hover { background: var(--bleu-fonce); }

.btn-secondaire {
    background: #fff;
    color: var(--marine);
    border: 1px solid var(--bleu);
}

.btn-secondaire:hover { background: #eef5fc; }

.btn-danger {
    background: #fff;
    color: #8d2218;
    border: 1px solid #8d2218;
}

.btn-danger:hover { background: #fdecea; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.flash-ok { background: #eef8e0; color: #24510a; border: 1px solid var(--vert); }
.flash-err { background: #fdecea; color: #7a1e16; border: 1px solid #e6b0aa; }
.flash ul { margin: 0; padding-left: 1.15rem; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    background: #e7f0fa;
    color: var(--marine);
}

.badge-admin { background: var(--marine); color: #fff; }
.badge-inactif { background: #eceff1; color: #666; }

.vide { color: #555; }

.portee { display: flex; gap: 16px; align-items: center; }
.portee label { font-weight: 650; }

.page-connexion {
    min-height: 100vh;
    background: #e7eef6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
}

.carte-connexion {
    width: min(440px, 100%);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(18, 50, 92, 0.16);
}

.carte-entete {
    background: var(--marine);
    color: #fff;
    text-align: center;
    padding: 18px 16px 16px;
    box-shadow: inset 0 -4px 0 var(--vert);
}

.carte-entete img {
    height: 84px;
    width: auto;
    background: #fff;
    border-radius: 8px;
    padding: 4px;
}

.carte-entete h1 { margin: 8px 0 0; letter-spacing: 0.08em; font-size: 32px; }
.carte-entete p { margin: 4px 0 0; opacity: 0.9; }

.forme-connexion { padding: 18px 18px 8px; display: grid; gap: 4px; }
.forme-connexion .btn { margin-top: 8px; }

.sous-lien, .adresse-fede { text-align: center; font-size: 13px; color: #555; padding: 0 16px; }
.adresse-fede { padding-bottom: 16px; line-height: 1.45; }

.piege {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.carte-large { width: min(560px, 100%); }

.forme-web {
    display: grid;
    gap: 4px;
    max-width: 640px;
}

.forme-web label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--marine);
    margin: 8px 0 4px;
}

.forme-web button { justify-self: start; margin-top: 12px; }

.forme-sortie { margin: 0; }
.forme-lu { margin: 0; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--vert);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .barre-haute { grid-template-columns: 1fr; row-gap: 8px; }
    .barre-haute h1 { font-size: 30px; text-align: left; }
    .barre-droite { justify-self: start; }
    .corps { flex-direction: column; }
    .rail { width: 100%; }
    .grille, .fiche dl { grid-template-columns: 1fr; }
    .logo-cadre img { height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    .barre-modules a:hover { transform: none; }
}
