:root {
  --bleu: #1f4e78; --bleu-clair: #ddebf7; --gris: #f3f4f6; --bord: #d0d7de; --texte: #1f2328;
  --vert: #e2efda; --rouge: #ff3300; --orange: #fce4d6; --jaune: #fff2cc; --age-ko: #f8cbad;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", Arial, sans-serif; color: var(--texte); background: #fafbfc; }
a { color: var(--bleu); }
h1 { font-size: 22px; margin: 0; }
h1 small { font-size: 14px; color: #666; font-weight: normal; margin-left: 8px; }
h2 { font-size: 15px; margin: 0 0 8px; color: var(--bleu); border-bottom: 2px solid var(--bleu-clair); padding-bottom: 4px; }

.barre { display: flex; align-items: center; gap: 4px 20px; background: var(--bleu); color: #fff; padding: 6px 18px; min-height: 48px;
         position: sticky; top: 0; z-index: 10; }
.barre .logo { color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap; }
.barre nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; width: 100%; }
.barre nav a { color: #dce8f5; text-decoration: none; padding: 6px 10px; border-radius: 4px; white-space: nowrap; }
.barre nav a:hover, .barre nav a.on { background: rgba(255,255,255,.15); color: #fff; }
.barre nav .btn-nav { background: #2e75b6; color: #fff; }
.barre .sep { flex: 1; }
.barre .lien { background: none; border: 0; color: #dce8f5; font-size: 18px; cursor: pointer; padding: 4px 8px; }

main { padding: 18px; }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

.btn { display: inline-block; background: var(--bleu); color: #fff; border: 1px solid var(--bleu); border-radius: 4px;
       padding: 6px 12px; text-decoration: none; cursor: pointer; font: inherit; }
.btn:hover { filter: brightness(1.15); }
.btn.secondaire { background: #fff; color: var(--bleu); }
.btn.danger { background: #fff; color: #b42318; border-color: #b42318; }

.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; }
.flash.ok { background: #e6f4ea; border: 1px solid #a3d9b1; }
.flash.ko { background: #fde7e9; border: 1px solid #f1a7ae; }
.flash.info { background: #eef5fc; border: 1px solid #b6d4f2; }

input[type=search], input[type=text], input[type=date], select, textarea {
  font: inherit; padding: 5px 7px; border: 1px solid var(--bord); border-radius: 4px; background: #fff; width: 100%; }
input[type=search] { width: 260px; }
.check { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }

.table-wrap { overflow: auto; max-height: calc(100vh - 190px); border: 1px solid var(--bord); background: #fff; }
.table-wrap.etroit { max-width: 640px; }
table.donnees { border-collapse: collapse; width: 100%; }
table.donnees th { position: sticky; top: 0; background: var(--bleu); color: #fff; font-weight: 600; text-align: left;
                   padding: 6px 8px; white-space: nowrap; z-index: 1; font-size: 13px; }
table.donnees td { padding: 4px 8px; border-bottom: 1px solid #eaeef2; border-right: 1px solid #f0f2f4; white-space: nowrap; }
table.donnees tbody tr:hover td { background: #eef5fc; }
table.donnees tfoot td { background: var(--bleu-clair); font-weight: 600; }
table.cliquable tbody tr[data-href] { cursor: pointer; }
table.petit td, table.petit th { font-size: 12px; white-space: normal; }
table.synthese td:first-child { font-weight: 500; }
td.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.inactif td { background: #e7e7e7; color: #666; }
tr.fort td { font-weight: 700; background: var(--bleu-clair); }
tr.vide td { height: 10px; border: 0; }
td.rouge, .lg.rouge { background: var(--rouge) !important; color: #fff; }
td.orange, .lg.orange { background: var(--orange) !important; }
td.jaune, .lg.jaune { background: var(--jaune) !important; }
td.age-ok, .lg.age-ok { background: var(--vert) !important; }
td.age-ko, .lg.age-ko { background: var(--age-ko) !important; }
.lg { display: inline-block; padding: 2px 8px; border-radius: 3px; margin-right: 8px; font-size: 12px; border: 1px solid var(--bord); }
.lg.inactif { background: #e7e7e7; }
.lg.change { background: #fff7d6; }
.legende { margin-top: 10px; }
.note { color: #57606a; font-size: 13px; }
.meta { color: #57606a; margin: -6px 0 12px; }
.infos { display: flex; gap: 22px; margin-bottom: 10px; flex-wrap: wrap; }

.cartes { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.carte { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 10px 16px; min-width: 150px; color: #57606a; }
.carte span { display: block; font-size: 22px; font-weight: 600; color: var(--bleu); }

.pastille { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-right: 3px; vertical-align: middle; }
.pastille.erreur { background: #fde7e9; color: #b42318; }
.pastille.alerte { background: #fff4e5; color: #9a5b00; }
.pastille.inactif { background: #e7e7e7; color: #444; font-size: 12px; }
td.liens a { text-decoration: none; }

ul.alertes { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 4px; }
ul.alertes li { padding: 5px 10px; border-radius: 4px; border-left: 4px solid; }
ul.alertes li.erreur { background: #fde7e9; border-color: #b42318; }
ul.alertes li.alerte { background: #fff4e5; border-color: #d4880f; }
ul.alertes li.info { background: #eef5fc; border-color: #2e75b6; }

.fiche { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.fiche .colonne { flex: 1 1 420px; display: flex; flex-direction: column; gap: 14px; }
.fiche section, .fiche fieldset { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 12px 14px; }
dl { display: grid; grid-template-columns: minmax(180px, 40%) 1fr; gap: 4px 12px; margin: 0; }
dt { color: #57606a; }
dd { margin: 0; font-weight: 500; word-break: break-word; }
section.calculs dd { color: var(--bleu); }

.formulaire .fiche { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.formulaire fieldset { margin: 0; }
.formulaire fieldset.large { grid-column: 1 / -1; }
.formulaire legend { font-weight: 600; color: var(--bleu); padding: 0 6px; }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.grille-enfants { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.formulaire label span { display: block; font-size: 12px; color: #57606a; margin-bottom: 2px; }
.formulaire label.change input, .formulaire label.change select { background: #fff7d6; border-color: #e3b341; }
.formulaire label.erreur input, .formulaire label.erreur select, tr.erreur input { border-color: #b42318; background: #fde7e9; }
.formulaire em { color: #b42318; font-size: 12px; font-style: normal; }
.barre-actions { position: sticky; bottom: 0; background: #fafbfc; padding: 12px 0; display: flex; gap: 10px; align-items: center; }
table.params td { white-space: normal; vertical-align: middle; }
table.params td:nth-child(2) { width: 200px; }
.upload { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 10px; }
.vide-base { text-align: center; padding: 50px; background: #fff; border: 1px dashed var(--bord); border-radius: 6px; }
.aide { margin-top: 18px; max-width: 900px; }

@media print {
  .barre, .actions, .barre-actions, .filtre { display: none !important; }
  .table-wrap { max-height: none; overflow: visible; }
}

/* gestion de la base */
.connexion { max-width: 420px; margin: 40px auto; background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 24px; }
.connexion form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.connexion label span { display: block; font-size: 12px; color: #57606a; margin-bottom: 2px; }
input[type=password] { font: inherit; padding: 5px 7px; border: 1px solid var(--bord); border-radius: 4px; width: 100%; }
.ligne-form { display: flex; gap: 8px; align-items: center; margin: 8px 0; width: 100%; }
.ligne-form input[type=text] { flex: 1; }
.petit-btn { padding: 2px 8px; font-size: 12px; }
.ok-txt { color: #1a7f37; }
.ko-txt { color: #b42318; }
tr.non-reversible td { color: #8c959f; }
code { background: var(--gris); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* choix des colonnes à exporter */
.choix-export fieldset { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 12px 14px; margin: 0 0 14px; }
.choix-export h3 { font-size: 13px; color: var(--bleu); margin: 12px 0 4px; }
.grille-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; margin-top: 8px; }
.grille-cases .check { white-space: normal; align-items: flex-start; }

/* barème ANCV */
table.tranches td { white-space: nowrap; vertical-align: middle; }
table.tranches select, table.tranches input { width: auto; }
input.court { width: 90px !important; }
.sim-resultat { font-size: 16px; margin: 10px 0; }
.aide-bareme { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 10px 16px; margin-bottom: 14px; }
.aide-bareme ol, .aide ol { margin: 4px 0; }

/* version */
.barre .version { color: #9ec3e6; font-size: 12px; text-decoration: none; border: 1px solid #4a7aa8; border-radius: 10px;
                  padding: 1px 8px; white-space: nowrap; }
.barre .version:hover { color: #fff; border-color: #fff; }
.pied-version { margin-top: 18px; color: #57606a; font-size: 12px; border-top: 1px solid var(--bord); padding-top: 8px; }
.note-version { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 12px 16px; margin-bottom: 12px; }
.note-version h2 span { color: #57606a; font-weight: normal; font-size: 13px; margin-left: 8px; }

/* ---- DELEG_CSE ---- */
.barre nav a.mois { padding: 6px 6px; font-size: 13px; }
.titre-section { margin: 18px 0 8px; }
.saisie-rapide { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.ligne-saisie { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ligne-saisie label span { display: block; font-size: 12px; color: #57606a; margin-bottom: 2px; }
.ligne-saisie label.large { flex: 1 1 200px; }
.ligne-saisie label.large input { width: 100%; }
.blocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.bloc-membre { background: #fff; border: 1px solid var(--bord); border-radius: 6px; overflow: hidden; }
.bloc-membre.inactif { opacity: .6; }
.bloc-entete { padding: 6px 10px; }
.bloc-entete small { color: #444; margin-left: 6px; }
.bloc-membre table { width: 100%; border-collapse: collapse; }
.bloc-membre tbody tr[data-href] { cursor: pointer; }
.bloc-membre tfoot td { background: var(--bleu-clair); font-weight: 600; padding: 3px 8px; }
.bloc-membre .vide-ligne { color: #8c959f; text-align: center; font-style: italic; }
.bloc-membre tr.sous-titre td { background: var(--gris); color: #57606a; font-size: 11px; }
.bloc-membre td.rouge { background: var(--rouge) !important; color: #fff; }
tfoot td.rouge { background: var(--rouge) !important; color: #fff; }

.compteur { float: right; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.7); padding: 1px 8px; border-radius: 10px; }
.compteur.rouge { background: var(--rouge); color: #fff; }
.mail-apercu { background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 12px 16px; max-width: 820px; margin-bottom: 14px; }
.mail-apercu pre { white-space: pre-wrap; font: inherit; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--bord); }
textarea { font: inherit; padding: 5px 7px; border: 1px solid var(--bord); border-radius: 4px; }

.barre nav a.util { margin-left: 6px; background: rgba(255,255,255,.12); }
.barre nav a.util.ro { background: #b7791f; color: #fff; }
.flash.lecture-seule { background: #fff4e5; border: 1px solid #e0b36a; }
.flash.lecture-seule form { margin-left: 8px; }
.choix-nom { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.choix-nom .btn { min-width: 150px; padding: 12px 16px; font-size: 15px; }
.choix-nom .btn small { display: block; font-size: 11px; opacity: .75; font-weight: normal; }

.avertissement-ro { max-width: 640px; margin: 40px auto; text-align: center; background: #fff; border: 2px solid #e0b36a; border-radius: 8px; padding: 26px 30px; }
.avertissement-ro .gros { font-size: 17px; }
.avertissement-ro form { margin: 0 4px; }

.dlg-fond { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.dlg { background: #fff; border-radius: 8px; padding: 22px 28px; max-width: 520px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.dlg h2 { border: 0; font-size: 18px; }

.masque { display: none !important; }
