/* Compta-Tshimungu — FIVE SARL, logiciel conçu par Thierry Zola Kwandi. */
@font-face { font-family: 'Plex'; src: url(polices/ibmplexsans-latin.woff2) format('woff2'); font-weight: 100 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; src: url(polices/ibmplexsans-latin-ext.woff2) format('woff2'); font-weight: 100 700; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'PlexMono'; src: url(polices/ibmplexmono-latin-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PlexMono'; src: url(polices/ibmplexmono-latin-500.woff2) format('woff2'); font-weight: 500 700; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(polices/fraunces-latin.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(polices/fraunces-latin-ext.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
  --fond: #f6f4ee; --papier: #ffffff; --encre: #1b2333; --doux: #5d6677; --trait: #dfdbcf; --trait-fort: #c7c1b1;
  --bleu: #0f2f63; --bleu-2: #1d4e9e; --bleu-clair: #e7eef9; --or: #b08a17; --or-clair: #f6eecf;
  --vert: #1f7a4a; --vert-clair: #e3f3ea; --rouge: #b3261e; --rouge-clair: #fbe7e5; --ambre: #9a5b00; --ambre-clair: #fdf0d9;
  --ombre: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .05);
  --r: 10px; --cote: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0f141d; --papier: #171e2a; --encre: #e6e9ef; --doux: #9aa3b4; --trait: #283244; --trait-fort: #364257;
    --bleu: #8fb4ff; --bleu-2: #a9c4ff; --bleu-clair: #1c2a44; --or: #e0bd4f; --or-clair: #3a3118;
    --vert: #5fcf91; --vert-clair: #14301f; --rouge: #ff8a80; --rouge-clair: #3d1c1a; --ambre: #f5b74e; --ambre-clair: #3a2a10;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0f141d; --papier: #171e2a; --encre: #e6e9ef; --doux: #9aa3b4; --trait: #283244; --trait-fort: #364257;
  --bleu: #8fb4ff; --bleu-2: #a9c4ff; --bleu-clair: #1c2a44; --or: #e0bd4f; --or-clair: #3a3118;
  --vert: #5fcf91; --vert-clair: #14301f; --rouge: #ff8a80; --rouge-clair: #3d1c1a; --ambre: #f5b74e; --ambre-clair: #3a2a10;
  --ombre: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--encre); }
body { font: 15px/1.45 Plex, system-ui, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--bleu-2); }
.mono, .num, td.m, th.m { font-family: PlexMono, Consolas, monospace; font-variant-numeric: tabular-nums; }
.doux { color: var(--doux); } .petit { font-size: .85rem; }
.chargement { padding: 40px; text-align: center; color: var(--doux); }
[hidden] { display: none !important; }

/* ── Mise en page ── */
.cadre { display: grid; grid-template-columns: var(--cote) minmax(0, 1fr); min-height: 100vh; }
.cote { background: var(--bleu); color: #fff; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
:root[data-theme="dark"] .cote, .cote { background: #0f2f63; }
.marque { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-bottom: 14px; }
.marque img { width: 34px; height: 34px; border-radius: 8px; }
.marque b { font-family: Fraunces, serif; font-size: 1.05rem; display: block; }
.marque small { opacity: .7; font-size: .72rem; }
.ent-choix { background: rgba(255, 255, 255, .08); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.ent-choix .nom { font-weight: 600; line-height: 1.25; }
.ent-choix select { width: 100%; margin-top: 6px; background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .2); border-radius: 6px; padding: 5px; font: inherit; font-size: .85rem; }
.ent-choix select option { color: #000; }
.cote nav { display: flex; flex-direction: column; gap: 1px; }
.cote nav .groupe { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; margin: 12px 8px 4px; }
.cote nav a { color: #dfe7f5; text-decoration: none; padding: 7px 10px; border-radius: 7px; display: flex; gap: 9px; align-items: center; font-size: .93rem; }
.cote nav a:hover { background: rgba(255, 255, 255, .08); }
.cote nav a.actif { background: #fff; color: #0f2f63; font-weight: 600; }
.cote .pied { margin-top: auto; padding-top: 16px; font-size: .72rem; opacity: .7; line-height: 1.4; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.barre { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--trait); background: var(--papier); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.barre .titre { font-family: Fraunces, serif; font-size: 1.15rem; font-weight: 600; flex: 1; min-width: 0; }
.barre .menu { display: none; }
.contenu { padding: 22px 24px 60px; max-width: 1280px; width: 100%; }
.pied-page { padding: 14px 24px; color: var(--doux); font-size: .78rem; border-top: 1px solid var(--trait); margin-top: auto; }

@media (max-width: 860px) {
  .cadre { grid-template-columns: minmax(0, 1fr); }
  .cote { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .cote.ouvert { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .barre { padding: 10px 16px; }
  .barre .menu { display: inline-flex; }
  .contenu { padding: 16px 16px 60px; }
}

/* ── Éléments ── */
.carte { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); padding: 18px; box-shadow: var(--ombre); margin-bottom: 18px; min-width: 0; }
.carte > h2:first-child, .carte > h3:first-child { margin-top: 0; }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.grille-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.tuile { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--ombre); min-width: 0; }
.tuile .lib { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.tuile .val { font-family: PlexMono, monospace; font-size: 1.35rem; font-weight: 500; margin-top: 4px; overflow-wrap: anywhere; }
.tuile .val.pos { color: var(--vert); } .tuile .val.neg { color: var(--rouge); }
.tuile .note { font-size: .8rem; color: var(--doux); margin-top: 2px; }
.ent-carte { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.ent-carte:hover { border-color: var(--bleu-2); transform: translateY(-1px); }
.ent-carte h3 { margin-bottom: 2px; }
.ent-carte dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 10px 0 0; font-size: .88rem; }
.ent-carte dt { color: var(--doux); } .ent-carte dd { margin: 0; text-align: right; font-family: PlexMono, monospace; }

button, .bouton { font: inherit; font-weight: 500; border-radius: 8px; border: 1px solid var(--trait-fort); background: var(--papier); color: var(--encre); padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; min-height: 38px; }
button:hover, .bouton:hover { border-color: var(--bleu-2); }
button.primaire, .bouton.primaire { background: var(--bleu); color: #fff; border-color: var(--bleu); }
:root[data-theme="dark"] button.primaire { color: #0f141d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.primaire, :root:not([data-theme="light"]) .bouton.primaire { color: #0f141d; } }
button.danger { color: var(--rouge); border-color: var(--rouge); }
button.mini, .bouton.mini { padding: 4px 9px; min-height: 30px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.droite { justify-content: flex-end; }

label { display: block; font-size: .85rem; color: var(--doux); margin-bottom: 4px; }
input, select, textarea { font: inherit; color: var(--encre); background: var(--papier); border: 1px solid var(--trait-fort); border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--bleu-2); outline-offset: 1px; }
input.num { text-align: right; }
.champs { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin-bottom: 14px; }
.champs .large { grid-column: 1 / -1; }
.case { display: flex; align-items: center; gap: 8px; color: var(--encre); font-size: .93rem; }
.case input { width: auto; min-height: 0; }

.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.onglets button { border-radius: 999px; }
.onglets button.actif { background: var(--bleu-clair); border-color: var(--bleu-2); color: var(--bleu); font-weight: 600; }

.table-defile { overflow-x: auto; border: 1px solid var(--trait); border-radius: 8px; background: var(--papier); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: top; }
th { background: var(--fond); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); position: sticky; top: 0; }
td.m, th.m { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--trait-fort); background: var(--fond); }
tr.sous td { font-weight: 700; background: var(--bleu-clair); color: var(--bleu); }
tr.titre-bloc td { font-weight: 700; text-transform: uppercase; font-size: .78rem; letter-spacing: .05em; color: var(--doux); background: var(--fond); }
tr.clic { cursor: pointer; } tr.clic:hover td { background: var(--bleu-clair); }
tr.ext td { color: var(--doux); text-decoration: line-through; text-decoration-color: var(--trait-fort); }

.etiquette { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fond); color: var(--doux); border: 1px solid var(--trait); white-space: nowrap; }
.etiquette.ok { background: var(--vert-clair); color: var(--vert); border-color: transparent; }
.etiquette.att { background: var(--ambre-clair); color: var(--ambre); border-color: transparent; }
.etiquette.ko { background: var(--rouge-clair); color: var(--rouge); border-color: transparent; }
.alerte { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alerte.ok { background: var(--vert-clair); color: var(--vert); }
.alerte.att { background: var(--ambre-clair); color: var(--ambre); }
.alerte.ko { background: var(--rouge-clair); color: var(--rouge); }
.alerte.info { background: var(--bleu-clair); color: var(--bleu); }

.choix-op { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); margin-bottom: 18px; }
.choix-op button { flex-direction: column; align-items: flex-start; text-align: left; padding: 12px; min-height: 78px; gap: 2px; }
.choix-op button .ico { font-size: 1.4rem; }
.choix-op button small { color: var(--doux); font-weight: 400; font-size: .78rem; }
.choix-op button.actif { border-color: var(--bleu); background: var(--bleu-clair); box-shadow: inset 0 0 0 1px var(--bleu); }

.apercu { border: 1px dashed var(--trait-fort); border-radius: 8px; padding: 12px; background: var(--fond); margin: 12px 0; }
.apercu h3 { font-size: .95rem; }
.ligne-ecr { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 36px; gap: 6px; margin-bottom: 6px; align-items: center; }
.ligne-ecr.tete { font-size: .75rem; text-transform: uppercase; color: var(--doux); letter-spacing: .05em; }
@media (max-width: 700px) { .ligne-ecr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ligne-ecr.tete { display: none; } .ligne-ecr { border-bottom: 1px solid var(--trait); padding-bottom: 8px; } }

.graphe svg { width: 100%; height: auto; display: block; }
.graphe .leg { display: flex; gap: 14px; font-size: .8rem; color: var(--doux); margin-top: 6px; }
.graphe .leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.connexion { position: relative; overflow: hidden; min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0b2550 0%, #1d4e9e 60%, #0f7fd8 120%); }
.connexion::before { content: ""; position: absolute; inset: 0; background: url(/img/drapeau-rdc.svg) center / cover no-repeat; opacity: .16; }
.cx-fond { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cx-carte { width: min(92vw, 92vh); height: auto; opacity: .55; }
.cx-colonne { position: relative; width: min(100%, 420px); display: grid; gap: 14px; }
.cx-bienvenue { color: #fff; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.cx-bienvenue h1 { margin: 8px 0 4px; font-size: 1.55rem; }
.cx-bienvenue p { margin: 0; line-height: 1.45; }
.cx-drapeau { width: 84px; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.connexion .carte { width: 100%; }
.cx-mdp { position: relative; }
.cx-mdp input { padding-right: 46px; }
.cx-oeil { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 1.15rem; padding: 6px 8px; cursor: pointer; line-height: 1; }
.cx-pwa { margin-top: 10px; text-align: center; }
.cx-pwa-ligne { display: flex; align-items: center; gap: 10px; text-align: left; background: #fffbe6; border: 1px solid #f0d64a; border-radius: 10px; padding: 8px 10px; }
.cx-pwa-msg { flex: 1; font-size: .9rem; line-height: 1.35; color: #1c2433; }
.cx-pwa-btn { flex: none; white-space: nowrap; justify-content: center; background: #f7d618; color: #0b2550; border: 0; font-weight: 700; }
.cx-pwa-btn:hover { filter: brightness(.95); }
.cx-pwa-aide { margin-top: 8px; text-align: left; background: #eef3fc; color: #1c2433; border-radius: 8px; padding: 8px 10px; line-height: 1.45; }
.cx-pwa-ok { color: #1f9d55; font-weight: 600; }
.cx-manuel { display: block; margin-top: 14px; text-align: center; font-weight: 600; color: var(--bleu); }
.connexion .marque b { color: var(--bleu); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1b2333; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
#toast.ko { background: #b3261e; }
dialog { border: 1px solid var(--trait); border-radius: 12px; padding: 20px; background: var(--papier); color: var(--encre); width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }

/* ── Impression : l'état seul, avec l'en-tête de l'entreprise ── */
.entete-impr { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .cote, .barre, .pied-page, .non-impr, .actions, .onglets, #toast { display: none !important; }
  .cadre { display: block; }
  .contenu { padding: 0; max-width: none; }
  .carte { border: 0; box-shadow: none; padding: 0; }
  .table-defile { overflow: visible; border: 0; }
  th { position: static; background: #eee !important; color: #000; }
  .entete-impr { display: block; border-bottom: 2px solid #000; margin-bottom: 10px; padding-bottom: 6px; font-size: 9.5pt; }
  .entete-impr b { font-size: 13pt; }
  .entete-impr .sig { float: right; font-size: 8pt; color: #555; }
  tr { break-inside: avoid; }
}

/* ── v1.1 : personnalisation et documents (feuille A4) ──
   La feuille est du PAPIER : fond blanc et encre sombre, même en thème sombre.
   Les couleurs de l'entreprise arrivent en variables --dc / --dc2 posées sur la feuille. */
.feuille-zone { position: relative; margin: 0 auto 18px; overflow: hidden; }
.feuille { --dc: #0f2f63; --dc2: #b08a17; width: 794px; min-height: 1123px; background: #fff; color: #1b2333; padding: 46px 50px 40px; box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 10px 30px rgba(0,0,0,.08);
  font: 12.5px/1.45 Plex, 'Segoe UI', Arial, sans-serif; display: flex; flex-direction: column; transform-origin: 0 0; position: relative; margin: 0 auto; overflow: hidden; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.feuille.police-serif { font-family: Fraunces, Georgia, serif; } .feuille.police-mono { font-family: PlexMono, Consolas, monospace; font-size: 11.5px; }
.feuille h1, .feuille h2, .feuille h3 { color: inherit; }
.feuille .f-tete { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; padding-bottom: 14px; border-bottom: 3px solid var(--dc); }
.feuille .f-tete.logo-droite { flex-direction: row-reverse; } .feuille .f-tete.logo-centre { flex-direction: column; align-items: center; text-align: center; }
.feuille .f-ident { display: flex; gap: 14px; align-items: center; min-width: 0; } .feuille .logo-centre .f-ident { flex-direction: column; }
.feuille .f-logo { max-height: 78px; max-width: 180px; object-fit: contain; }
.feuille .f-nom { font-size: 19px; font-weight: 700; color: var(--dc); line-height: 1.15; font-family: Fraunces, Georgia, serif; }
.feuille .f-slogan { font-style: italic; color: var(--dc2); font-size: 11.5px; }
.feuille .f-coord { font-size: 10.5px; color: #4a5263; margin-top: 3px; }
.feuille .f-titre { text-align: right; flex-shrink: 0; } .feuille .logo-droite .f-titre { text-align: left; } .feuille .logo-centre .f-titre { text-align: center; }
.feuille .f-titre .t { font-size: 22px; font-weight: 800; letter-spacing: .08em; color: var(--dc); }
.feuille .f-titre .n { font-family: PlexMono, Consolas, monospace; font-size: 13px; font-weight: 600; margin-top: 2px; }
.feuille .f-titre .d { font-size: 11px; color: #4a5263; }
.feuille.modele-bandeau { padding-top: 0; }
.feuille.modele-bandeau .f-tete { margin: 0 -50px; padding: 26px 50px 20px; background: var(--dc); color: #fff; border-bottom: 5px solid var(--dc2); }
.feuille.modele-bandeau .f-nom, .feuille.modele-bandeau .f-titre .t { color: #fff; } .feuille.modele-bandeau .f-coord, .feuille.modele-bandeau .f-titre .d { color: rgba(255,255,255,.85); }
.feuille.modele-bandeau .f-slogan { color: #fff; opacity: .9; }
.feuille.modele-bandeau .f-logo { background: #fff; padding: 6px; border-radius: 8px; }
.feuille.modele-sobre .f-tete { border-bottom: 1px solid #1b2333; } .feuille.modele-sobre .f-nom { color: #1b2333; }
.feuille .f-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 14px; }
.feuille .f-boite { border: 1px solid #d6d2c6; border-radius: 6px; padding: 10px 12px; font-size: 11.5px; }
.feuille .f-boite .l { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--dc); font-weight: 700; margin-bottom: 3px; }
.feuille .f-boite b { font-size: 13px; }
.feuille .f-objet { margin: 0 0 10px; font-size: 12px; }
.feuille table.f-lignes { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.feuille .f-lignes th { background: var(--dc); color: #fff; font-size: 9.5px; letter-spacing: .06em; padding: 7px 8px; position: static; text-transform: uppercase; }
.feuille.modele-sobre .f-lignes th { background: #fff; color: #1b2333; border-bottom: 2px solid #1b2333; }
.feuille .f-lignes td { padding: 6px 8px; border-bottom: 1px solid #e6e2d7; color: #1b2333; }
.feuille .f-lignes tr:nth-child(even) td { background: #faf9f5; }
.feuille .f-lignes .m { text-align: right; font-family: PlexMono, Consolas, monospace; white-space: nowrap; }
.feuille .f-bas { display: grid; grid-template-columns: 1fr 270px; gap: 20px; margin-top: 12px; align-items: start; }
.feuille .f-totaux { width: 100%; border-collapse: collapse; font-size: 12px; }
.feuille .f-totaux td { padding: 5px 8px; border-bottom: 1px solid #e6e2d7; color: #1b2333; background: none !important; }
.feuille .f-totaux td:last-child { text-align: right; font-family: PlexMono, Consolas, monospace; white-space: nowrap; }
.feuille .f-totaux tr.ttc td { background: var(--dc) !important; color: #fff; font-weight: 700; font-size: 13.5px; }
.feuille.modele-sobre .f-totaux tr.ttc td { background: #fff !important; color: #1b2333; border-top: 2px solid #1b2333; }
.feuille .f-lettres { font-size: 11.5px; margin-top: 6px; } .feuille .f-lettres b { color: var(--dc); }
.feuille .f-mentions { font-size: 10.5px; color: #4a5263; margin-top: 10px; white-space: pre-line; }
.feuille .f-sign { display: flex; justify-content: flex-end; gap: 30px; margin-top: 16px; align-items: flex-end; }
.feuille .f-qr { display: flex; gap: 10px; align-items: center; font-size: 9.5px; color: #4a5263; margin-right: auto; max-width: 300px; }
.feuille .f-qr img { width: 86px; height: 86px; }
.feuille .f-signe { text-align: center; min-width: 230px; position: relative; font-size: 11.5px; }
.feuille .f-signe .zone { position: relative; height: 120px; display: flex; align-items: center; justify-content: center; }
.feuille .f-signe .sig { max-height: 92px; max-width: 220px; position: relative; z-index: 2; }
.feuille .f-signe .cachet { position: absolute; width: 132px; height: 132px; object-fit: contain; left: 50%; top: 50%; transform: translate(-28%, -52%) rotate(-9deg); opacity: .9; mix-blend-mode: multiply; z-index: 1; }
.feuille .f-pied { margin-top: auto; padding-top: 14px; border-top: 1px solid #d6d2c6; font-size: 9.5px; color: #5d6677; text-align: center; }
.feuille .f-pied .five { display: block; margin-top: 3px; font-size: 8.5px; opacity: .8; }
.feuille .filigrane { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5; }
.feuille .filigrane span { transform: rotate(-30deg); font-size: 64px; font-weight: 800; color: rgba(179, 38, 30, .14); letter-spacing: .12em; text-align: center; line-height: 1.1; }
.feuille .f-cases { display: grid; gap: 12px; margin-top: 20px; }
.feuille .f-cases > div { border: 1px solid #d6d2c6; border-radius: 6px; min-height: 96px; padding: 8px; font-size: 10.5px; position: relative; }
.feuille .f-cases .l { font-weight: 700; color: var(--dc); }
.feuille .f-cases .cachet { position: absolute; width: 90px; height: 90px; object-fit: contain; right: 6px; bottom: 4px; transform: rotate(-9deg); opacity: .9; mix-blend-mode: multiply; }
.feuille .f-cases .sig { position: absolute; max-height: 60px; max-width: 150px; left: 10px; bottom: 8px; }
.feuille .solde { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 11px; border: 2px solid; transform: rotate(-4deg); }
.feuille .solde.ok { color: #1f7a4a; } .feuille .solde.att { color: #9a5b00; }

/* Bloc signature / cachet au bas des états imprimés (balance, bilan…). */
.pied-etat { display: none; }
.entete-impr .logo { float: left; max-height: 54px; max-width: 140px; margin-right: 12px; }

/* Éditeur de document */
.ligne-doc { display: grid; grid-template-columns: minmax(0, 3fr) 70px 70px minmax(0, 1.1fr) 60px 60px minmax(0, 1.2fr) minmax(0, 1fr) 34px; gap: 6px; margin-bottom: 6px; align-items: center; }
.ligne-doc.tete { font-size: .72rem; text-transform: uppercase; color: var(--doux); letter-spacing: .04em; }
.ligne-doc .ht { text-align: right; font-family: PlexMono, monospace; font-size: .9rem; }
@media (max-width: 900px) { .ligne-doc { grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--trait); padding-bottom: 8px; } .ligne-doc .des { grid-column: 1 / -1; } .ligne-doc.tete { display: none; } .ligne-doc .ht { align-self: center; } }
.ligne-doc input, .ligne-doc select { padding: 6px 8px; min-height: 34px; }
.mini-lib { display: none; font-size: .7rem; color: var(--doux); } @media (max-width: 900px) { .mini-lib { display: block; } }

/* Personnalisation */
.perso-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .perso-grille { grid-template-columns: minmax(0, 1fr); } }
.perso-apercu { position: sticky; top: 70px; } @media (max-width: 1100px) { .perso-apercu { position: static; } }
.choix-visuel { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); gap: 8px; }
.choix-visuel label { border: 1px solid var(--trait-fort); border-radius: 8px; padding: 10px; cursor: pointer; color: var(--encre); margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.choix-visuel input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choix-visuel label:has(input:checked) { border-color: var(--bleu); box-shadow: inset 0 0 0 1px var(--bleu); background: var(--bleu-clair); }
.choix-visuel label:has(input:focus-visible) { outline: 2px solid var(--bleu-2); }
.vignette { height: 46px; border-radius: 4px; background: #fff; border: 1px solid #ddd; position: relative; overflow: hidden; }
.vignette i { position: absolute; left: 0; right: 0; } 
.palette { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.palette button { width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--papier); box-shadow: 0 0 0 1px var(--trait-fort); }
input[type=color] { padding: 2px; height: 38px; width: 64px; }
.image-cadre { border: 1px dashed var(--trait-fort); border-radius: 8px; padding: 10px; min-height: 90px; display: grid; place-items: center; background: repeating-conic-gradient(#f2f0ea 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.image-cadre img { max-height: 140px; max-width: 100%; object-fit: contain; }
.image-cadre .vide { color: #777; font-size: .85rem; }
.pave-signature { width: 100%; height: 200px; border: 1px solid var(--trait-fort); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.signataire { display: flex; gap: 12px; align-items: center; border: 1px solid var(--trait); border-radius: 8px; padding: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.signataire .image-cadre { width: 160px; min-height: 60px; padding: 4px; }
.signataire .image-cadre img { max-height: 56px; }
.cachet-apercu { width: 220px; height: 220px; margin: 0 auto; display: block; }
.prochain { font-family: PlexMono, monospace; font-size: .85rem; color: var(--vert); }
.barre-enreg { position: sticky; bottom: 0; background: var(--papier); border-top: 1px solid var(--trait); padding: 10px 0; z-index: 4; }

@media print {
  @page { size: A4; margin: 10mm; }
  body.impr-feuille .contenu > :not(.feuille-zone) { display: none !important; }
  body.impr-feuille .feuille-zone { height: auto !important; margin: 0; overflow: visible; }
  body.impr-feuille .feuille { transform: none !important; box-shadow: none; width: 100%; min-height: 274mm; padding: 0 2mm; overflow: visible; }
  body.impr-feuille .feuille.modele-bandeau .f-tete { margin: 0 -2mm; padding-left: 8mm; padding-right: 8mm; }
  .pied-etat { display: flex; justify-content: flex-end; margin-top: 18px; break-inside: avoid; }
  .pied-etat .bloc { text-align: center; min-width: 240px; position: relative; font-size: 10pt; }
  .pied-etat .zone { position: relative; height: 110px; display: flex; align-items: center; justify-content: center; }
  .pied-etat .sig { max-height: 85px; max-width: 220px; position: relative; z-index: 2; }
  .pied-etat .cachet { position: absolute; width: 120px; height: 120px; object-fit: contain; left: 50%; top: 50%; transform: translate(-28%, -52%) rotate(-9deg); opacity: .9; mix-blend-mode: multiply; }
}

/* Boutons « ← Retour » : barre du haut, menu (téléphone), dialogues */
.barre .retour { font-weight: 600; }
.fermer-menu { display: none; align-self: flex-start; margin-bottom: 8px; background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
dialog .retour[data-retour] { margin: -4px 0 8px; }
@media (max-width: 860px) { .fermer-menu { display: inline-flex; } }
@media print { .retour, .fermer-menu { display: none !important; } }
.cx-retour { position: absolute; top: 14px; left: 14px; z-index: 2; background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; padding: 7px 14px; font-weight: 600; cursor: pointer; backdrop-filter: blur(4px); }
.cx-retour:hover { background: rgba(255,255,255,.28); }

/* Bandeau du mode hors ligne */
#hl-bandeau { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 9px 16px; font-size: .92rem; color: #fff; background: #1d4e9e; box-shadow: 0 -2px 10px rgba(0,0,0,.2); }
#hl-bandeau[hidden] { display: none; }
#hl-bandeau.hl-hors { background: #8a1c1c; }
#hl-bandeau.hl-attente { background: #9a5b00; }
#hl-bandeau.hl-transfert { background: #1d4e9e; }
#hl-bandeau.hl-refus { background: #7a3d00; }
#hl-bandeau button.mini { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.5); }
#hl-bandeau .hl-voix { background: none; border: 0; font-size: 1.15rem; cursor: pointer; padding: 2px 6px; }
body.avec-hl { padding-bottom: 54px; }
@media print { #hl-bandeau { display: none !important; } body.avec-hl { padding-bottom: 0; } }
#hl-bandeau { flex-wrap: nowrap; justify-content: space-between; text-align: left; }
#hl-bandeau > span { flex: 1; min-width: 0; }
body.avec-hl #toast { bottom: 110px; }

/* Assistant (RAG) */
#aide-bouton { position: fixed; right: 18px; bottom: 18px; z-index: 45; display: flex; align-items: center; gap: 6px; background: #0f2f63; color: #fff; border: 2px solid #f7d618; border-radius: 999px; padding: 10px 16px; font-size: 1.05rem; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.28); cursor: pointer; }
#aide-bouton span { font-size: .9rem; }
body.avec-hl #aide-bouton { bottom: 74px; }
#aide-panneau { position: fixed; right: 18px; bottom: 80px; z-index: 46; width: min(420px, calc(100vw - 32px)); height: min(600px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--papier, #fff); color: var(--encre, #1c2433); border: 1px solid var(--trait, #d6dbe5); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.3); overflow: hidden; }
#aide-panneau[hidden] { display: none; }
body.avec-hl #aide-panneau { bottom: 136px; height: min(600px, calc(100vh - 176px)); }
#aide-panneau header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #0f2f63; color: #fff; }
#aide-panneau header b { flex: 1; }
#aide-panneau header .mini { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.4); }
#aide-fil { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.aide-b { max-width: 92%; padding: 9px 12px; border-radius: 12px; line-height: 1.45; font-size: .93rem; overflow-wrap: anywhere; }
.aide-moi { align-self: flex-end; background: #1d4e9e; color: #fff; border-bottom-right-radius: 4px; }
.aide-ia { align-self: flex-start; background: #eef3fc; color: #1c2433; border-bottom-left-radius: 4px; }
.aide-redige { background: #fffbe6; border: 1px solid #f0d64a; }
.aide-src-titre { font-weight: 700; margin-bottom: 4px; }
.aide-src { border-left: 3px solid #c9a227; padding: 4px 8px; margin: 6px 0; background: #fff; border-radius: 4px; font-size: .88rem; }
.aide-lien { font-size: .85rem; font-weight: 600; }
.aide-attente { opacity: .8; font-style: italic; }
.aide-curseur { animation: aide-clign 1s steps(2) infinite; }
@keyframes aide-clign { 50% { opacity: 0; } }
.aide-actions { margin-top: 6px; }
.aide-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
#aide-f { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--trait, #d6dbe5); }
#aide-f input { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  #aide-bouton span { display: none; }
  #aide-panneau, body.avec-hl #aide-panneau { right: 8px; left: 8px; width: auto; bottom: 8px; top: 8px; height: auto; }
}
@media print { #aide-bouton, #aide-panneau { display: none !important; } }

/* Petite ou grande entreprise */
fieldset.taille-ent { border: 1px solid var(--trait); border-radius: 10px; padding: 10px 14px 4px; margin: 10px 0 14px; }
fieldset.taille-ent legend { font-weight: 700; padding: 0 6px; }
.conseil-sys { margin: 4px 0 10px; padding: 9px 12px; border-radius: 8px; background: #eef3fc; line-height: 1.45; }
.conseil-sys.simple { background: #ecf8f1; border-left: 4px solid #1f9d55; }
.conseil-sys.complete { background: #fff5e6; border-left: 4px solid #d97706; }
.gros-boutons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.gros-boutons .bouton { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 18px 20px; font-size: 1.6rem; border-radius: 14px; text-decoration: none; }
.gros-boutons .bouton b { font-size: 1.15rem; }
.gros-boutons .bouton small { font-size: .85rem; opacity: .8; }
.gros-boutons .entree { background: #1f7a45; color: #fff; border-color: #1f7a45; }
.gros-boutons .sortie { background: #a33a1c; color: #fff; border-color: #a33a1c; }
form.argent.entree h2 { color: #1f7a45; }
form.argent.sortie h2 { color: #a33a1c; }
input.gros { font-size: 1.35rem; font-weight: 700; }
button.gros { font-size: 1.05rem; padding: 12px 22px; }
.ecriture-apercu { margin: 6px 0 10px; }
#f-notes textarea { width: 100%; }
