/*
 * Charte graphique OECCA Bénin × 8e Congrès des Experts-Comptables de l'UEMOA
 * Bleu marine institutionnel, or du « 8 », liseré vert-jaune-rouge du Bénin.
 * Titres : DIN Pro (repli Barlow) · Texte : Arial Nova (repli Arial).
 */
:root {
    --navy: #02254F;
    --navy-fonce: #011833;
    --navy-clair: #0A3566;
    --or: #BE8E42;
    --or-vif: #D4AD60;
    --or-texte: #9A6C14;
    --or-pale: #F8E092;
    --jaune: #FDC731;
    --creme: #FCEDC7;
    --creme-pale: #FEF6E2;
    --fond: #F6F6F4;
    --ligne: #E2DED3;
    --gris: #E9E9E9;
    --encre: #212529;
    --texte: #4F4F4E;
    --muet: #7A7A78;
    --vert: #008751;
    --vert-pale: #E3F3EC;
    --rouge: #E8112D;
    --rouge-fonce: #B80E24;
    --rouge-pale: #FDE8EB;
    --bleu-pale: #E2EBF6;

    --police-titre: 'DIN Pro', 'Barlow', 'Arial Narrow', Arial, sans-serif;
    --police-texte: 'Arial Nova', Arial, Helvetica, sans-serif;
    --rayon: 12px;
    --ombre: 0 6px 24px rgba(2, 37, 79, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--police-texte);
    font-size: 15px;
    line-height: 1.5;
    color: var(--texte);
    background: var(--fond);
}

h1, h2, h3, .titre { font-family: var(--police-titre); color: var(--navy); letter-spacing: .01em; }
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 18px; line-height: 1.2; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 14px; }
a { color: var(--navy-clair); }
a:hover { color: var(--or-texte); }
code { background: var(--gris); padding: 1px 6px; border-radius: 4px; font-size: .9em; }

.surtitre {
    display: inline-block; font-family: var(--police-titre); font-weight: 600; font-size: .78rem;
    letter-spacing: .14em; text-transform: uppercase; color: var(--or-texte); margin-bottom: 6px;
}
.muted { color: var(--muet); font-size: .9rem; }

/* Liseré aux couleurs du Bénin (repris du logo du congrès) */
.lisere {
    height: 4px;
    background: linear-gradient(90deg, var(--vert) 0 33.3%, var(--jaune) 33.3% 66.6%, var(--rouge) 66.6% 100%);
}

/* ---------- Cartes, grilles, statistiques ---------- */
.card {
    background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre);
    border: 1px solid var(--ligne); padding: 24px; margin-bottom: 22px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
    background: #fff; border-radius: var(--rayon); padding: 18px 20px; box-shadow: var(--ombre);
    border: 1px solid var(--ligne); border-top: 4px solid var(--or);
}
.stat a { text-decoration: none; display: block; }
.stat .valeur { font-family: var(--police-titre); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat .libelle { color: var(--muet); font-size: .88rem; margin-top: 4px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: 8px; border: 2px solid transparent; cursor: pointer;
    font-family: var(--police-titre); font-weight: 600; font-size: .95rem; letter-spacing: .02em;
    color: #fff; background: var(--navy); text-decoration: none; white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--navy-clair); color: #fff; }
.btn:focus-visible { outline: 3px solid var(--or-vif); outline-offset: 2px; }
.btn.or, .btn.vert { background: var(--jaune); color: var(--navy); }
.btn.or:hover, .btn.vert:hover { background: var(--or-vif); color: var(--navy); }
.btn.gris, .btn.secondaire { background: #fff; color: var(--navy); border-color: var(--ligne); }
.btn.gris:hover, .btn.secondaire:hover { border-color: var(--navy); color: var(--navy); }
.btn.rouge { background: var(--rouge); }
.btn.rouge:hover { background: var(--rouge-fonce); }
.btn.petit { padding: 5px 10px; font-size: .82rem; }
.btn.plein { width: 100%; padding: 13px; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: wait; }

/* ---------- Formulaires ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; font: inherit; color: var(--encre);
    background: #fff; border: 1.5px solid var(--ligne); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--or); box-shadow: 0 0 0 3px rgba(190, 142, 66, .18); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.champ label, label.etiquette { display: block; font-weight: 700; margin-bottom: 6px; font-size: .9rem; color: var(--navy); }
.champ .erreur { color: var(--rouge-fonce); font-size: .85rem; margin-top: 4px; }
.champ.large { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; }
.check input { margin-top: 4px; accent-color: var(--navy); }

/* ---------- Barre d'outils / filtres ---------- */
.barre { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.barre .espace { flex: 1; }
.barre input, .barre select { width: auto; flex: 1 1 200px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
th {
    background: var(--navy); color: #fff; font-family: var(--police-titre); font-weight: 600;
    font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
thead th:first-child { border-top-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; }
tbody tr:nth-child(even) { background: #FBFAF7; }
tbody tr:hover { background: var(--creme-pale); }
td.montant { text-align: right; font-weight: 700; white-space: nowrap; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700;
    background: var(--bleu-pale); color: var(--navy); white-space: nowrap;
}
.badge.manuel { background: var(--creme); color: var(--or-texte); }
.badge.lock { background: var(--navy); color: #fff; }
.badge.ok { background: var(--vert-pale); color: var(--vert); }
.badge.ko { background: var(--rouge-pale); color: var(--rouge-fonce); }

/* ---------- Messages ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 600; border-left: 5px solid; }
.flash.succes { background: var(--vert-pale); color: #00603A; border-color: var(--vert); }
.flash.erreur { background: var(--rouge-pale); color: var(--rouge-fonce); border-color: var(--rouge); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.pagination a, .pagination span.page {
    min-width: 36px; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--ligne);
    text-decoration: none; color: var(--navy); text-align: center; background: #fff;
}
.pagination a:hover { border-color: var(--or); }
.pagination .courant { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 700; }
.pagination .ellipse { padding: 6px 4px; color: var(--muet); }
.pagination form { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.pagination select { width: auto; padding: 6px 10px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--creme); border: 2px solid var(--or-pale); }
.vide { text-align: center; padding: 30px; color: var(--muet); }

/* =========================================================
   Administration : barre latérale bleu marine
   ========================================================= */
.shell { display: flex; min-height: 100vh; }
.shell aside {
    width: 250px; flex-shrink: 0; padding: 22px 14px; color: #fff;
    background: var(--navy); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.shell aside nav { flex: 1; display: flex; flex-direction: column; }
.shell aside .menu-bouton { display: none; }
.shell aside .logo { display: block; padding: 4px 8px 18px; }
.shell aside .logo img { width: 100%; max-width: 200px; height: auto; display: block; }
.shell aside .logo span { display: block; margin-top: 10px; font-family: var(--police-titre); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--or-vif); }
.shell aside .lisere { margin: 0 8px 18px; border-radius: 2px; }
.shell aside a, .shell aside button {
    display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 3px; border-radius: 8px;
    color: rgba(255, 255, 255, .86); text-decoration: none; font: inherit; font-size: .93rem;
    background: none; border: none; cursor: pointer; border-left: 3px solid transparent;
}
.shell aside a:hover, .shell aside button:hover { background: var(--navy-clair); color: #fff; }
.shell aside a.actif { background: var(--navy-clair); color: #fff; border-left-color: var(--jaune); font-weight: 700; }
.shell aside .sep { border-top: 1px solid rgba(255, 255, 255, .12); margin: 14px 4px; }
.shell aside .bas { margin-top: auto; }
.shell aside .user { font-size: .8rem; color: rgba(255, 255, 255, .6); padding: 0 12px 8px; word-break: break-all; }
.shell aside .congres { display: block; padding: 14px 8px 4px; opacity: .9; }
.shell aside .congres img { width: 100%; max-width: 180px; height: auto; }
.shell main { flex: 1; padding: 30px; min-width: 0; }

/* =========================================================
   Pages publiques : espace membre, calculateur, connexion
   ========================================================= */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--fond); }
.entete-public { background: #fff; border-bottom: 1px solid var(--ligne); }
.entete-public .interieur {
    max-width: 1100px; margin: 0 auto; padding: 14px 20px;
    display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap;
}
.entete-public img.oecca { height: 58px; width: auto; }
.entete-public img.congres { height: 46px; width: auto; }
.entete-public nav { display: flex; gap: 18px; flex-wrap: wrap; }
.entete-public nav a { font-family: var(--police-titre); font-weight: 600; text-decoration: none; color: var(--navy); padding: 6px 0; border-bottom: 3px solid transparent; }
.entete-public nav a:hover, .entete-public nav a.actif { border-bottom-color: var(--or-vif); color: var(--navy); }

.bandeau {
    background: radial-gradient(1200px 300px at 85% -40%, rgba(212, 173, 96, .35), transparent 60%), var(--navy);
    color: #fff; padding: 46px 20px 90px; text-align: center;
}
.bandeau .surtitre { color: var(--or-vif); }
.bandeau h1 { color: #fff; font-size: 2.1rem; margin: 0 0 8px; }
.bandeau p { margin: 0 auto; max-width: 620px; color: rgba(255, 255, 255, .82); }

.contenu { width: 100%; max-width: 820px; margin: -60px auto 0; padding: 0 16px 40px; flex: 1; position: relative; }
.contenu.etroit { max-width: 460px; }
.contenu.large { max-width: 1040px; }

.champ-grand {
    width: 100%; padding: 14px 16px; font-size: 1.15rem; border: 2px solid var(--ligne); border-radius: 10px;
    text-transform: uppercase; letter-spacing: .04em;
}
.champ-grand::placeholder { text-transform: none; letter-spacing: normal; }
.barre .champ-grand { width: 100%; }
.champ-grand.code { text-align: center; letter-spacing: 12px; font-size: 1.7rem; font-weight: 700; font-family: var(--police-titre); }
.lien { display: block; text-align: center; margin-top: 14px; }

.total-a-payer { text-align: center; border-top: 5px solid var(--or); }
.total-a-payer .montant-grand { font-family: var(--police-titre); font-size: 2.6rem; font-weight: 700; line-height: 1.1; margin: 6px 0; }
.total-a-payer.du .montant-grand { color: var(--rouge-fonce); }
.total-a-payer.ok .montant-grand { color: var(--vert); }
.alerte { border-left: 6px solid; }
.alerte.ko { border-left-color: var(--rouge); }
.alerte.ok { border-left-color: var(--vert); }

.pied-public { background: var(--navy-fonce); color: rgba(255, 255, 255, .75); font-size: .85rem; }
.pied-public .interieur {
    max-width: 1100px; margin: 0 auto; padding: 20px; display: flex; gap: 16px;
    justify-content: space-between; align-items: center; flex-wrap: wrap;
}
.pied-public a { color: var(--or-vif); }
.pied-public img { height: 40px; width: auto; }

/* Aucun champ ni média ne doit élargir la page au-delà de l'écran */
input, select, textarea, img, iframe { max-width: 100%; }
.barre > * { min-width: 0; }

@media (max-width: 860px) {
    /* Administration : barre du haut compacte, menu déroulant */
    .shell { flex-direction: column; }
    .shell aside { width: 100%; height: auto; padding: 10px 14px; position: sticky; top: 0; z-index: 20; overflow: visible; }
    .shell aside .haut { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .shell aside .logo { padding: 0; }
    .shell aside .logo img { max-width: 150px; }
    .shell aside .logo span { margin-top: 4px; font-size: .65rem; }
    .shell aside .menu-bouton {
        display: block; width: auto; flex-shrink: 0; margin: 0; padding: 8px 14px;
        border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px; font-family: var(--police-titre); font-weight: 600;
    }
    .shell aside .lisere { margin: 10px 0 0; }
    .shell aside nav { display: none; padding-top: 10px; max-height: calc(100vh - 90px); overflow-y: auto; }
    .shell aside.ouvert nav { display: flex; }
    .shell aside .congres { display: none; }
    .shell main { padding: 16px; }

    /* Titres de page + boutons d'action : passent à la ligne */
    .btn { white-space: normal; text-align: center; }
    h1 { font-size: 1.4rem; overflow-wrap: anywhere; }
    .barre input, .barre select { flex-basis: 100%; }
    .split .apercu iframe { height: 70vh; min-height: 420px; }
    th, td { padding: 8px 10px; }
    .entete-public img.oecca { height: 44px; }
    .entete-public img.congres { display: none; }
    .bandeau { padding: 32px 16px 80px; }
    .bandeau h1 { font-size: 1.6rem; }
    .card { padding: 18px; }
}

/* ---------- Module OCR ---------- */
.badge.alerte-statut { background: var(--creme); color: var(--or-texte); }
.verifs { list-style: none; margin: 0; padding: 0; }
.verifs li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ligne); align-items: flex-start; }
.verifs li:last-child { border-bottom: 0; }
.verifs .puce { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .85rem; }
.verifs .ok .puce { background: var(--vert); }
.verifs .alerte .puce { background: var(--or); }
.verifs .erreur .puce { background: var(--rouge); }
.verifs strong { display: block; color: var(--navy); }
.colonnes-ocr { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .colonnes-ocr { grid-template-columns: minmax(0, 1fr); } }
.apercu-doc { width: 100%; height: 640px; border: 1px solid var(--ligne); border-radius: 8px; background: #fff; }
.texte-brut { white-space: pre-wrap; font-size: .8rem; max-height: 340px; overflow: auto; background: var(--fond); padding: 12px; border-radius: 8px; }
.motif { font-family: Consolas, monospace; font-size: .82rem; }
.lu-par { font-size: .76rem; color: var(--muet); }

/* ---------- Envoi aux lignes cochées ---------- */
.selection-barre {
    position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    background: var(--navy); color: #fff; padding: 12px 18px; border-radius: var(--rayon); margin-bottom: 18px; box-shadow: var(--ombre);
}
.selection-barre[hidden] { display: none; }
.selection-barre input[type=text] { flex: 1 1 260px; width: auto; }
input[type=checkbox][form="envoi-selection"], [data-tout-cocher] { width: 18px; height: 18px; accent-color: var(--or); cursor: pointer; }
.point-ocr { border: 1px solid var(--ligne); border-left: 5px solid var(--or); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.point-ocr.inactif { opacity: .6; border-left-color: var(--gris); }
.point-ligne, .attendu { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.point-ligne .champ, .attendu .champ { flex: 1 1 180px; margin: 0; }
.attendu { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--ligne); }
.attendu [hidden] { display: none; }
.point-ocr .actions { margin-top: 12px; }

/* ---------- Écran partagé : liste ou formulaire à gauche, aperçu PDF à droite ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.split .apercu { position: sticky; top: 16px; }
.split .apercu iframe { width: 100%; height: calc(100vh - 150px); min-height: 520px; border: 1px solid var(--ligne); border-radius: 8px; background: #fff; }
.split tr[data-pdf] { cursor: pointer; }
.split tr.selectionne td { background: var(--creme-pale); }
@media (max-width: 1200px) { .split { grid-template-columns: minmax(0, 1fr); } .split .apercu { position: static; } }
