  :root { --darkened-bg: #f8fafc; --hairline-color: #e2e8f0; --body-bg: #f1f5f9; --link-fg: #1d4ed8; --fond: #f1f5f9; --texte: #1e293b; --discret: #64748b; --trait: #cbd5e1; --carte: #fff; --accent: #1d4ed8; --rouge: #c62828; --vert: #2e7d32; }
  @media (prefers-color-scheme: dark) {
    :root { --darkened-bg: #212226; --hairline-color: #3a3b40; --body-bg: #17181a; --link-fg: #64b5f6; --fond: #17181a; --texte: #e9e9ec; --discret: #a0a0a8; --trait: #3a3b40; --carte: #212226; --accent: #64b5f6; --rouge: #ef5350; --vert: #66bb6a; }
  }
  body { font: 16px/1.5 system-ui, sans-serif; margin: 0; background: var(--fond); color: var(--texte); }
  header { background: linear-gradient(135deg, #1e3a5f, #2b4f7e); color: #fff; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--trait); }
  header form { margin-left: auto; }
  main { max-width: 72rem; margin: 0 auto; padding: 1rem; }
  h1 { margin-top: .5rem; } h2 { margin-top: 2rem; border-bottom: 1px solid var(--trait); padding-bottom: .25rem; }
  table { border-collapse: collapse; width: 100%; }
  th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--trait); vertical-align: top; }
  th { background: var(--carte); }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
  a { color: var(--accent); }
  .carte { box-shadow: 0 1px 3px rgba(15,23,42,.08); background: var(--carte); border: 1px solid var(--trait); border-radius: 6px; padding: .75rem 1rem; }
  .signalee { color: var(--rouge); font-weight: 700; }
  .alerte { border-left: 4px solid var(--rouge); background: rgba(198, 40, 40, .12); padding: .5rem .75rem; margin: .5rem 0; font-weight: 600; }
  .message { padding: .5rem .75rem; margin: .5rem 0; border-radius: 4px; background: var(--carte); border-left: 4px solid var(--vert); }
  .message.error { border-left-color: var(--rouge); }
  tr.doublon td { background: rgba(239, 108, 0, .16); }
  .badge-doublon { background: #ef6c00; color: #fff; font-weight: 700; font-size: .8em; padding: .05rem .4rem; border-radius: 3px; }
  .alerte-doublon { border-left-color: #ef6c00; background: rgba(239, 108, 0, .14); }
  button.refuser { background: var(--rouge); color: #fff; border: 0; border-radius: 4px; }
  .decision { display: flex; flex-wrap: wrap; gap: 2rem; align-items: end; }
  tr.barree td, tr.barree th, h1.barree { text-decoration: line-through; opacity: .62; }
  .statut-incomplete { color: #b26a00; font-weight: 600; } .statut-supprimee { color: var(--discret); font-weight: 600; }
  .statut-acceptee { color: #1565c0; font-weight: 600; } .statut-payee { color: var(--vert); font-weight: 600; }
  .statut-refusee { color: var(--rouge); font-weight: 600; }
  .ajout { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; align-items: end; }
  .iban { font-family: ui-monospace, monospace; font-size: 1.1em; user-select: all; }
  iframe.pdf { width: 100%; height: min(78vh, 40rem); border: 1px solid var(--trait); background: #fff; }
  img.apercu { max-width: 100%; border: 1px solid var(--trait); }
  .fiche > .carte { position: sticky; top: .75rem; align-self: start; }
  .fiche { display: grid; grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr); gap: 1rem; margin-top: 1rem; }
  @media (max-width: 800px) { .fiche { grid-template-columns: 1fr; } }
  label { display: block; font-weight: 600; margin-top: .6rem; }
  input[type=number], input[type=text], textarea { width: 100%; padding: .45rem; box-sizing: border-box; font: inherit; background: var(--fond); color: var(--texte); border: 1px solid var(--trait); border-radius: 4px; }
  button { padding: .6rem 1.2rem; font: inherit; cursor: pointer; margin-top: .75rem; }
  button.payer.grand { font-size: 1.1rem; padding: .8rem 1.6rem; font-weight: 700; }
  .virement-fait { border-left: 5px solid var(--vert); }
  button.payer { background: var(--vert); color: #fff; border: 0; border-radius: 4px; }
  .note { margin-bottom: .6rem; white-space: pre-wrap; } .note small { color: var(--discret); }
  .discret { color: var(--discret); }
  header .discret { color: #cbd5e1; }
  .recherche { display: flex; gap: .5rem; align-items: center; margin: 1rem 0; } .recherche input { max-width: 28rem; }
  .recherche button { margin: 0; }
  .indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
  .indicateurs .carte strong { display: block; font-size: 1.8rem; }
  .negatif { color: var(--rouge); } .positif { color: var(--vert); }
  th[data-tri] { cursor: pointer; user-select: none; } th[data-sens=asc]::after { content: " ▲"; } th[data-sens=desc]::after { content: " ▼"; }
  .ajout { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; align-items: end; }
  select { width: 100%; padding: .45rem; font: inherit; background: var(--fond); color: var(--texte); border: 1px solid var(--trait); border-radius: 4px; }

/* --- formulaires (formulaire public, saisies) --- */
.etroit { max-width: 48rem; }
p.field { margin: 1rem 0 0; }
.help { color: var(--discret); font-size: .9em; display: block; }
.errorlist { color: var(--rouge); margin: .25rem 0; padding: 0; list-style: none; font-weight: 600; }
.intro { background: var(--carte); border: 1px solid var(--trait); border-left: 4px solid var(--accent); padding: .5rem 1rem; border-radius: 6px; }
.ligne { border: 1px solid var(--trait); background: var(--carte); border-radius: 6px; padding: 0 .75rem .75rem; margin-top: .75rem; }
button.retirer { margin-top: .5rem; padding: .3rem .8rem; }
button[data-ajouter] { margin-top: .75rem; }
input[type=file] { max-width: 100%; }
input[type=checkbox] { width: auto; margin-right: .4rem; }
label.check, p.field label:has(> input[type=checkbox]) { font-weight: 400; }
h3 { margin-bottom: .25rem; }
/* --- listes : filtres, pagination, étiquettes --- */
.filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; align-items: end; margin: 1rem 0; }
.filtres label { margin-top: 0; font-size: .85rem; }
.filtres button { margin: 0; }
th a.tri { color: inherit; text-decoration: none; white-space: nowrap; }
th a.tri.actif::after { content: " ▲"; } th a.tri.actif.desc::after { content: " ▼"; }
.pagination { display: flex; gap: .5rem; align-items: center; margin: 1rem 0; flex-wrap: wrap; }
.pagination a, .pagination span.courant { padding: .25rem .7rem; border: 1px solid var(--trait); border-radius: 6px; background: var(--carte); text-decoration: none; }
.pagination span.courant { background: var(--accent); color: #fff; border-color: var(--accent); }
.etiquettes { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: .5rem 0; list-style: none; }
.etiquettes li { background: var(--carte); border: 1px solid var(--trait); border-radius: 999px; padding: .15rem .8rem; }
.etiquettes small { color: var(--discret); }
.badge { background: var(--trait); border-radius: 999px; padding: .05rem .55rem; font-size: .8em; font-weight: 600; }
.badge.ok { background: rgba(46, 125, 50, .2); color: var(--vert); } .badge.attente { background: rgba(239, 108, 0, .2); }
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
small.statut { font-size: .5em; vertical-align: middle; }
header .lien-entete { margin-left: auto; color: #fff; font-weight: 600; text-decoration: none; border: 1px solid rgba(255,255,255,.5); padding: .3rem .9rem; border-radius: 999px; }

a.bouton { display: inline-block; padding: .45rem 1rem; border: 1px solid var(--trait); border-radius: 6px; background: var(--carte); color: var(--accent); text-decoration: none; font-weight: 600; }
a.bouton:hover { border-color: var(--accent); }
button.annuler-paiement { background: transparent; color: var(--rouge); border: 1px solid var(--rouge); border-radius: 4px; }
.correction { margin-top: 1rem; }

details.revoir { margin-top: .5rem; }
details.revoir summary { cursor: pointer; padding: .4rem .8rem; border: 1px dashed var(--trait); border-radius: 6px; color: var(--accent); font-weight: 600; }
details.revoir[open] summary { margin-bottom: .5rem; }
ul.regles { list-style: disc; padding-left: 1.4rem; margin: .25rem 0 1rem; color: var(--discret); }
.alerte-edition { border-left-color: #ef6c00; background: rgba(239, 108, 0, .14); }
label.confirmation { display: flex; gap: .5rem; align-items: center; font-weight: 600; }
.pagination a.courant { background: var(--accent); color: #fff; border-color: var(--accent); }

ul.diff { list-style: none; margin: 0; padding: 0; }
ul.diff li { margin: .1rem 0; }
ul.diff .avant { color: var(--discret); text-decoration: line-through; }
ul.diff .apres { font-weight: 600; }

fieldset.radios { border: 0; padding: 0; margin: 1rem 0 0; }
fieldset.radios legend { font-weight: 600; padding: 0; }
fieldset.radios label.check { display: flex; gap: .5rem; align-items: flex-start; margin: .35rem 0; font-weight: 400; }
