:root {
  --bg: #f4f6f9; --surface: #fff; --texte: #1d2733; --doux: #5f6b7a; --trait: #dde3ea;
  --accent: #1f4e79; --accent-doux: #e7eef6; --ok: #1b7f4c; --ok-doux: #e3f4ea;
  --alerte: #b42318; --alerte-doux: #fdecea; --attente: #9a6700; --attente-doux: #fff4d6;
  --rayon: 8px; --ombre: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--texte); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
main, .grille > * { min-width: 0; }
.nav { background: #13283f; color: #c9d4e0; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav .marque { color: #fff; font-weight: 700; font-size: 18px; padding: 4px 10px 16px; }
.nav .marque small { display: block; font-weight: 400; font-size: 12px; color: #8ea2b8; }
.nav a { color: #c9d4e0; padding: 8px 10px; border-radius: 6px; display: block; }
.nav a:hover, .nav a.actif { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.nav .sep { border-top: 1px solid rgba(255,255,255,.1); margin: 10px 0; }
.nav .bas { margin-top: auto; font-size: 12px; }
.nav .bas button { background: none; border: 0; color: #8ea2b8; cursor: pointer; padding: 8px 10px; font: inherit; }
main { padding: 24px 32px; max-width: 1200px; width: 100%; }
.entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
         box-shadow: var(--ombre); padding: 18px; margin-bottom: 18px; overflow-x: auto; }
.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.kpi .lib { color: var(--doux); font-size: 13px; } .kpi .val { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi.alerte .val { color: var(--alerte); }
table.liste { width: 100%; border-collapse: collapse; }
table.liste th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
                 color: var(--doux); border-bottom: 1px solid var(--trait); padding: 8px; }
table.liste td { border-bottom: 1px solid var(--trait); padding: 10px 8px; vertical-align: top; }
table.liste tr:last-child td { border-bottom: 0; }
table.liste tbody tr:hover { background: #fafbfc; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vide { color: var(--doux); text-align: center; padding: 30px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px;
       border: 1px solid var(--trait); background: #fff; color: var(--texte); font: inherit; cursor: pointer;
       font-weight: 500; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #f6f8fa; }
.btn.primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primaire:hover { filter: brightness(1.1); }
.btn.danger { color: var(--alerte); } .btn.petit { padding: 4px 9px; font-size: 13px; }
.btn.lien { border: 0; background: none; color: var(--accent); padding: 0; }
form.inline { display: inline; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #344054; }
.aide { font-weight: 400; color: var(--doux); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #c9d1db; border-radius: 6px;
  font: inherit; background: #fff; color: var(--texte); }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-doux); border-color: var(--accent); }
.champ { margin-bottom: 14px; }
.case { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.case input { width: auto; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-doux); border-color: #b5e0c6; color: var(--ok); }
.flash.erreur { background: var(--alerte-doux); border-color: #f5c2bd; color: var(--alerte); }
.flash.info { background: var(--attente-doux); border-color: #f0dca0; color: var(--attente); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
         background: #eef1f5; color: var(--doux); white-space: nowrap; }
.badge.payee, .badge.accepte, .badge.rembourse { background: var(--ok-doux); color: var(--ok); }
.badge.retard, .badge.refuse { background: var(--alerte-doux); color: var(--alerte); }
.badge.a_payer, .badge.partielle, .badge.envoye, .badge.emis { background: var(--attente-doux); color: var(--attente); }
.badge.annulee { background: #ece9fe; color: #5925dc; }
.filtres { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filtres input[type=text] { width: 240px; }
.onglets a { padding: 6px 12px; border-radius: 999px; color: var(--doux); }
.onglets a.actif { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
/* éditeur de lignes */
table.lignes { width: 100%; border-collapse: collapse; }
table.lignes th { font-size: 12px; color: var(--doux); text-align: left; padding: 6px 4px; }
table.lignes td { padding: 4px; vertical-align: top; }
table.lignes input, table.lignes textarea { padding: 6px 8px; }
table.lignes textarea { min-height: 34px; font-size: 13px; margin-top: 4px; }
table.lignes .total { padding-top: 10px; font-weight: 600; }
.totaux { margin-left: auto; width: 320px; }
.totaux div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--trait); }
.totaux .fort { font-weight: 700; font-size: 16px; border-bottom: 0; }
.mention { color: var(--doux); font-size: 12px; text-align: right; }
.barres { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; height: 160px; }
.barres .b { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.barres .b span.v { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.barres .b small { color: var(--doux); font-size: 11px; margin-top: 4px; }
.auth { max-width: 420px; margin: 8vh auto; }
.auth .marque { text-align: center; font-size: 26px; font-weight: 700; color: var(--accent); margin-bottom: 18px; }
dl.infos { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.infos dt { color: var(--doux); } dl.infos dd { margin: 0; }
.doc-apercu { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
iframe.pdf { width: 100%; height: 75vh; border: 1px solid var(--trait); border-radius: var(--rayon); background: #fff; }
.logo-apercu { max-height: 70px; max-width: 220px; display: block; margin-bottom: 8px; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); } .nav { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .nav .marque { width: 100%; padding-bottom: 6px; } .nav .sep { display: none; }
  .filtres input[type=text] { width: 100%; } .totaux { width: 100%; }
  .nav .bas { margin-top: 0; } main { padding: 16px; }
  .g2, .g3, .g4, .doc-apercu { grid-template-columns: 1fr; }
}

/* --- Thème : couleur principale + touche chaude ------------------------- */
:root { --chaud: #d97757; --chaud-doux: #fbeee8; --lien: #1676ae; }
a { color: var(--lien); }
.nav { background: var(--accent); }
.nav .marque { display: flex; gap: 10px; align-items: center; }
.nav .pastille { background: #fff; border-radius: 8px; padding: 4px; display: inline-flex; flex: none; }
.nav .pastille img { height: 34px; width: auto; display: block; }
.nav a { border-left: 3px solid transparent; }
.nav a.actif { border-left-color: var(--chaud); background: rgba(255,255,255,.1); }
.nav .marque::after { content: none; }
.entete h1 { position: relative; padding-bottom: 6px; }
.entete h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 36px; height: 3px;
                    border-radius: 2px; background: var(--chaud); }
.kpi { border-top: 3px solid var(--accent); }
.kpi:first-child { border-top-color: var(--chaud); }
.barres .b.courant span.v { background: var(--chaud); }
.barres .b.courant small { color: var(--chaud); font-weight: 700; }
.onglets a.actif { background: var(--chaud-doux); color: #a4462a; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--chaud-doux); border-color: var(--chaud); }
.barres .b span.v { background: var(--lien); }
.barres .b.courant span.v { background: var(--chaud); }

/* --- Identité visuelle des documents : Poppins + Lora, en-têtes beiges ----- */
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/Lora-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
body { font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 13.5px; }
h1, h2, .nav .marque > span, .auth .marque { font-family: "Lora", Georgia, serif; font-weight: 700; }
h1 { color: var(--accent); letter-spacing: .01em; }
table.liste th { background: #f1f0ec; color: #1d2733; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
table.liste th:first-child { border-top-left-radius: 6px; } table.liste th:last-child { border-top-right-radius: 6px; }
.kpi .val { font-family: "Poppins", sans-serif; }
.flash.info { background: #edf6fc; border-color: #b9dcf2; color: #0f4c75; border-left: 3px solid var(--lien); }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 4px; z-index: 10;
               background: linear-gradient(90deg, var(--accent), var(--lien), #41bff2); }
table.liste td:first-child a { white-space: nowrap; }
table.liste td a { white-space: nowrap; }
table.lignes select[name=recurrence] { padding: 6px 4px; font-size: 12.5px; min-width: 92px; }
table.lignes td:nth-child(3) { min-width: 100px; }
.entete-carte { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mini-kpi > div { background: #f8f9fb; border: 1px solid var(--trait); border-radius: 8px; padding: 12px 14px; }
.mini-kpi .lib { color: var(--doux); font-size: 12.5px; } .mini-kpi .val { font-size: 20px; font-weight: 700; margin-top: 2px; }
.mini-kpi .alerte { border-color: #f5c2bd; background: var(--alerte-doux); } .mini-kpi .alerte .val { color: var(--alerte); }
form.paiement-urssaf { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
form.paiement-urssaf input[name=montant] { width: 92px; padding: 5px 8px; text-align: right; }
form.paiement-urssaf input[type=date] { width: 140px; padding: 5px 8px; }

/* --- Rubriques repliables ------------------------------------------------- */
details > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--lien); font-size: 14px; transition: transform .15s; display: inline-block; }
details[open] > summary::before { transform: rotate(90deg); }
details.section > summary h2 { margin: 0; }
details.section[open] > summary { margin-bottom: 12px; }
details.options > summary { font-weight: 600; color: var(--lien); }
details.options[open] > summary { margin-bottom: 4px; }
details.options h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); margin: 18px 0 8px; }
details.section:not([open]) { padding-top: 14px; padding-bottom: 14px; }
.onglets-params { margin: -6px 0 16px; display: flex; gap: 6px; flex-wrap: wrap; }
table.lignes .voir-detail { font-size: 12px; margin-top: 4px; padding: 0; }
.barre-offre { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--accent-doux); }
.barre-offre label { margin: 0; } .barre-offre select { width: auto; min-width: 240px; }
.carte.offre h2 { margin: 0; } .carte.offre.inactive { opacity: .6; }
.prix-offre { display: flex; gap: 24px; margin: 10px 0 14px; } .prix-offre div { display: flex; flex-direction: column; }
.prix-offre b { font-size: 18px; }
tr.attenue td { color: var(--doux); }
.jauge { margin: 10px 0 14px; }
.jauge-tete { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 5px; }
.jauge-barre { height: 10px; background: #edf0f4; border-radius: 999px; overflow: hidden; }
.jauge-barre span { display: block; height: 100%; background: var(--lien); border-radius: 999px; }
.jauge.attention .jauge-barre span { background: #e0a100; } .jauge.depasse .jauge-barre span { background: var(--alerte); }
.qr svg { width: 200px; height: 200px; display: block; margin: 10px 0; background: #fff; border: 1px solid var(--trait); border-radius: 8px; }
.codes-secours { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 24px; margin: 12px 0; font-size: 16px; }
ol.etapes li { margin-bottom: 12px; } tr.alerte-ligne td { color: var(--alerte); }
.pastille-nb { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--chaud); color: #fff; font-size: 12px; text-align: center; margin-left: 4px; }
[hidden] { display: none !important; }
