/* Rapprochement TVA — styles d'écran. Aucune règle de style dans le HTML (CSP style-src 'self'). */
:root {
  --bleu: #1f4e79; --bleu-clair: #e8eef5; --texte: #1f2933; --muet: #5f6b7a; --bord: #d5dbe3; --fond: #f4f6f9;
  --ok: #166534; --ok-fond: #e7f6ec; --ecart: #9a3412; --ecart-fond: #fff1e6; --erreur: #b91c1c; --erreur-fond: #fdecec;
  --info: #1e40af; --info-fond: #eaf0fd; --na: #4b5563; --na-fond: #eef0f3;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; color: var(--texte); background: var(--fond); line-height: 1.45; }
a { color: var(--bleu); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muet { color: var(--muet); }
.contenu { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
[hidden] { display: none !important; }

/* En-tête */
#entete { background: var(--bleu); color: #fff; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1rem; flex-wrap: wrap; }
#entete .marque { display: flex; align-items: center; gap: .75rem; }
#entete .logo { background: #fff; color: var(--bleu); font-weight: 800; border-radius: 6px; padding: .1rem .45rem; font-size: .85rem; }
#entete .instance { font-weight: 700; }
#entete .logo-instance { height: 40px; width: auto; display: block; }
.bandeau-logo { background: var(--bleu); border-radius: 8px; padding: .8rem; margin-bottom: 1rem; display: flex; justify-content: center; }
.bandeau-logo[hidden] { display: none; }
.bandeau-logo img { height: 72px; width: auto; }
#entete .role { font-size: .8rem; opacity: .85; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 0 .5rem; }
#entete select { font: inherit; border-radius: 6px; border: 0; padding: .2rem .4rem; }
#entete .version { font-size: .75rem; opacity: .75; white-space: nowrap; }
#entete nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
#entete nav a { color: #fff; text-decoration: none; opacity: .85; padding: .2rem 0; border-bottom: 2px solid transparent; }
#entete nav a[aria-current="page"], #entete nav a:hover { opacity: 1; border-bottom-color: #fff; }
.bandeau-reseau { background: var(--erreur); color: #fff; text-align: center; padding: .4rem; font-weight: 600; }

/* Boutons et champs */
.bouton { font: inherit; font-weight: 600; background: var(--bleu); color: #fff; border: 1px solid var(--bleu); border-radius: 7px; padding: .45rem .9rem; cursor: pointer; }
.bouton:hover { filter: brightness(1.1); }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.bouton.secondaire { background: #fff; color: var(--bleu); }
.bouton.danger { background: var(--erreur); border-color: var(--erreur); }
.bouton.petit { padding: .2rem .6rem; font-size: .85rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
label { font-weight: 600; font-size: .9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  font: inherit; border: 1px solid var(--bord); border-radius: 6px; padding: .4rem .5rem; background: #fff; }
input[type="number"] { text-align: right; }
textarea { width: 100%; }
.champ { display: flex; flex-direction: column; gap: .25rem; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem 1rem; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* Cartes et étapes */
.carte { background: #fff; border: 1px solid var(--bord); border-radius: 10px; padding: 1rem 1.1rem; margin-top: 1rem; }
.etape > header { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.etape .numero { background: var(--bleu); color: #fff; border-radius: 50%; width: 1.8rem; height: 1.8rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.etape > header .badge { margin-left: auto; }
.progression { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.progression a { text-decoration: none; font-size: .8rem; border-radius: 999px; padding: .15rem .6rem; border: 1px solid var(--bord); background: #fff; color: var(--texte); }
.titre-page { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; margin: .75rem 0; }
.kpi { background: var(--bleu-clair); border-radius: 8px; padding: .5rem .75rem; }
.kpi span { display: block; font-size: .78rem; color: var(--muet); }
.kpi strong { font-size: 1.1rem; }

/* Badges */
.badge { display: inline-block; border-radius: 999px; padding: .05rem .55rem; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge-ok, .etat-valide { background: var(--ok-fond); color: var(--ok); }
.badge-ecart, .etat-declare { background: var(--ecart-fond); color: var(--ecart); }
.badge-erreur { background: var(--erreur-fond); color: var(--erreur); }
.badge-info, .etat-calcule { background: var(--info-fond); color: var(--info); }
.badge-na, .etat-ouvert { background: var(--na-fond); color: var(--na); }

/* Tableaux */
.tableau-defile { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th { background: var(--bleu); color: #fff; text-align: left; font-weight: 600; padding: .4rem .5rem; }
.tableau td { border-bottom: 1px solid var(--bord); padding: .35rem .5rem; vertical-align: top; }
.tableau.compact td, .tableau.compact th { padding: .2rem .4rem; font-size: .84rem; }
.tableau tfoot td { font-weight: 700; background: var(--bleu-clair); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { font-family: ui-monospace, Consolas, monospace; }
tr.ligne-ecart td { background: var(--ecart-fond); }
tr.ligne-erreur td { background: var(--erreur-fond); }
input.cellule { width: 8rem; }

/* Contrôles */
.controles { display: flex; flex-direction: column; gap: .35rem; margin-top: .75rem; }
.controle { border: 1px solid var(--bord); border-left-width: 5px; border-radius: 6px; padding: .4rem .6rem; background: #fff; }
.controle.ok { border-left-color: var(--ok); }
.controle.ecart { border-left-color: var(--ecart); background: var(--ecart-fond); }
.controle.erreur { border-left-color: var(--erreur); background: var(--erreur-fond); }
.controle.na { border-left-color: var(--na); }
.controle.info { border-left-color: var(--info); }
.controle summary { cursor: pointer; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.controle .code { font-weight: 700; }
.controle .regle { color: var(--muet); font-size: .85rem; }
.controle .corps { margin-top: .4rem; }

/* Messages */
.message { border-radius: 8px; padding: .55rem .75rem; margin-top: .75rem; }
.message-info { background: var(--info-fond); color: var(--info); }
.message-ok { background: var(--ok-fond); color: var(--ok); }
.message-erreur { background: var(--erreur-fond); color: var(--erreur); }
.message-attention { background: var(--ecart-fond); color: var(--ecart); }
progress { width: 100%; height: .8rem; margin-top: .5rem; }

/* Connexion */
.connexion { max-width: 400px; margin: 10vh auto; }
.connexion form { display: flex; flex-direction: column; gap: .8rem; }

/* Dialogue */
.dialogue { border: 0; border-radius: 12px; padding: 1.2rem; max-width: 480px; width: calc(100% - 2rem); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.dialogue::backdrop { background: rgba(15, 23, 42, .45); }
.dialogue h2 { margin-bottom: .5rem; }

@media (max-width: 640px) {
  #entete nav { order: 3; width: 100%; }
  .contenu { padding: .75rem .5rem 2rem; }
}

/* Paramétrage : groupes de champs */
fieldset { border: 1px solid var(--bord, #d0d7de); border-radius: 6px; margin: 0 0 1rem; padding: .5rem 1rem 1rem; }
legend { font-weight: 600; padding: 0 .3rem; }
h4 { font-size: .95rem; margin: .8rem 0 .4rem; }

/* Double authentification : QR code sur fond blanc (lisible par les applications, même en thème sombre) */
.qr-code { display: block; width: 200px; height: 200px; margin: 1rem 0; padding: 8px; background: #fff; border: 1px solid var(--bord); }
#cleMfa { font-size: 1.05rem; letter-spacing: .05em; user-select: all; }

/* ---------- Module banque : écrans du lot 4 ---------- */
.badge-attention { background: #fff3cd; color: #7a5a00; }
.onglets { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.onglets .bouton[aria-pressed="true"] { outline: 3px solid var(--bleu); outline-offset: 1px; }
tr.ligne-a_affecter td { background: #fffbe6; }
tr.ligne-a_verifier td { background: #fffbe6; }
tr.ligne-conflit td { background: #fdecea; }
.filtres { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: .75rem; }
.filtres .champ { margin: 0; }
.affectation { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.affectation input[type="text"] { width: 9rem; }
.affectation input.intitule { width: 11rem; }
/* Lot A (015) : questions pour l'expert-comptable, liste déroulante du plan, comptes proches, registre du compte d'attente */
tr.ligne-question td { background: #eaf0fd; }
.affectation label.question { font-size: .85rem; color: var(--info); }
.affectation .proches { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.bouton.puce-compte { font-weight: 500; font-size: .8rem; padding: .15rem .5rem; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Lot B (017) : demandes à l'expert-comptable */
.demandes { margin-top: .75rem; }
.resume { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: .5rem 0; }
.resume strong { display: block; font-size: 1.1rem; }
/* Soldes lus dans le relevé PDF : affichés, non modifiables */
input.lu-pdf { background: var(--na-fond); color: var(--na); border-color: var(--bord); cursor: not-allowed; }
/* Texte lu par les lecteurs d'écran seulement */
.lecteur-ecran { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
input.lu-pdf::placeholder { color: var(--muet); font-style: italic; }
/* Contrôle des soldes : gros rond vert (OK) ou rouge (KO) */
.controle-soldes { display: flex; gap: 1.25rem; align-items: flex-start; border: 2px solid; border-radius: 10px; padding: 1rem 1.25rem; margin: .9rem 0; }
.controle-soldes.ok { border-color: var(--ok); background: var(--ok-fond); }
.controle-soldes.ko { border-color: var(--erreur); background: var(--erreur-fond); }
.controle-soldes .pastille { flex: 0 0 auto; width: 4.5rem; height: 4.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; font-weight: 700; line-height: 1; color: #fff; }
.controle-soldes.ok .pastille { background: var(--ok); }
.controle-soldes.ko .pastille { background: var(--erreur); }
.controle-soldes .corps-controle { flex: 1 1 auto; min-width: 0; }
.controle-soldes .verdict { margin: 0 0 .5rem; font-size: 1.3rem; font-weight: 700; }
.controle-soldes.ok .verdict { color: var(--ok); }
.controle-soldes.ko .verdict { color: var(--erreur); }
.bilan-soldes { border-collapse: collapse; width: auto; min-width: min(26rem, 100%); background: #fff; }
.bilan-soldes th, .bilan-soldes td { padding: .3rem .75rem; border-bottom: 1px solid var(--bord); text-align: left; font-weight: 400; }
.bilan-soldes td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bilan-soldes tr.calcule th, .bilan-soldes tr.calcule td { border-top: 2px solid var(--texte); font-weight: 700; }
.bilan-soldes tr.cloture th, .bilan-soldes tr.cloture td { font-weight: 700; }
.controle-soldes .detail { margin: .5rem 0 0; font-size: .9rem; color: var(--texte); }
.controle-soldes .detail.continu { color: var(--ok); font-weight: 600; }
.controle-soldes .detail.rupture, .controle-soldes .detail.alerte { color: var(--erreur); font-weight: 600; }
@media (max-width: 600px) {
  .controle-soldes { flex-direction: column; gap: .75rem; }
  .controle-soldes .pastille { width: 3.5rem; height: 3.5rem; font-size: 2.2rem; }
}
/* Historique d'un mois (verrouillages, déverrouillages, fichiers téléchargés) */
ol.historique { margin: .3rem 0 0; padding-left: 1.4rem; font-size: .9rem; }
ol.historique li { margin: .15rem 0; }
ol.historique .date { font-variant-numeric: tabular-nums; color: var(--muet); }
ol.historique li.historique-deverrouillage strong { color: var(--erreur); }
ol.historique li.historique-verrouillage strong { color: var(--ok); }
pre.apercu { white-space: pre-wrap; max-height: 16rem; overflow: auto; background: #f6f7f9; padding: .5rem; font-size: .8rem; }
