:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #1d2733; --muted: #66727f; --line: #dde3ea;
  --accent: #1f4e79; --accent-soft: #e6eef6; --neg: #b3261e; --pos: #1b6e3a; --warn: #fff4d6; --warn-ink: #7a5a00;
  --side: #17324d; --side-ink: #e8eef5; --side-muted: #9fb3c8; --side-hover: #21405f;
  --hl: #fff1b8; --hl-strong: #ffd95a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12171d; --panel: #1b222b; --ink: #e6ebf0; --muted: #98a4b1; --line: #2c3743; --accent: #7fb0e0;
    --accent-soft: #233243; --neg: #ff8a80; --pos: #7fd69a; --warn: #3a3218; --warn-ink: #f0d27a; --side: #0e1620; --side-hover: #1a2836;
    --hl: #4a3e12; --hl-strong: #7a6418; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.app { display: flex; min-height: 100vh; }
.sidebar { width: 280px; flex-shrink: 0; background: var(--side); color: var(--side-ink); padding: 16px 0; overflow-y: auto; max-height: 100vh; position: sticky; top: 0; }
.sidebar h1 { font-size: 18px; margin: 0 16px 14px; }
.sidebar nav a { display: block; padding: 7px 16px; color: var(--side-ink); text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--side-hover); }
.sidebar .grp { margin: 14px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); display: flex; justify-content: space-between; }
.sidebar .acc { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.sidebar .acc span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .acc .neg { color: #ffb4ab; }
.main { flex: 1; min-width: 0; padding: 20px 28px 60px; }
.pad { padding: 20px; }
h2 { margin: 0 0 4px; font-size: 22px; }
h3 { margin: 22px 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary, .btn.primary { color: #0e1620; } }
button:disabled { opacity: .45; cursor: default; }
button.link { border: none; background: none; color: var(--accent); padding: 0; }
button.danger { color: var(--neg); }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
input[type=checkbox] { width: 16px; height: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi .lbl { color: var(--muted); font-size: 12px; }
.kpi .val { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
.tablewrap { border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
.logo { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; margin-right: 8px; flex-shrink: 0; }
.accrow { display: flex; align-items: center; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; }
.badge.warn { background: var(--warn); color: var(--warn-ink); }
.banner { background: var(--warn); color: var(--warn-ink); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.form { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center; }
.form label { color: var(--muted); }
.form .full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: none; border-radius: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.err { color: var(--neg); min-height: 1.2em; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 10; overflow-y: auto; }
.modal-back[hidden] { display: none; }
.modal { background: var(--panel); border-radius: 12px; padding: 18px 20px; width: 100%; max-width: 620px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h3 { margin-top: 0; }
.modal .actions { display: flex; justify-content: space-between; margin-top: 16px; gap: 8px; }
/* bouton dans le message (Annuler) */
.toast .toast-btn { margin-left: 8px; background: transparent; color: var(--bg); border: 1px solid var(--bg); padding: 2px 10px; border-radius: 6px; cursor: pointer; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 20; }
.recon-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0; }
.ecart-zero { color: var(--pos); }
.splits td { padding: 4px; }
.splits input { width: 100%; }
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; max-height: none; position: static; }
  .main { padding: 16px; }
  .form { grid-template-columns: 1fr; }
}
.logo.img { background: #fff; object-fit: contain; padding: 2px; border: 1px solid var(--line); }
.logo-big { width: 44px; height: 44px; }
.form label.chk { display: flex; gap: 6px; align-items: center; }

/* Groupes de comptes de l'accueil */
.grp-courant { --grp: #1f6fb5; }
.grp-epargne { --grp: #2e8b57; }
.grp-placements { --grp: #8a4fbf; }
.grp-biens { --grp: #b5651d; }
.kpi[class*="grp-"] { border-top: 4px solid var(--grp); }
.group { margin: 18px 0 22px; padding: 4px 14px 14px; border: 1px solid var(--line); border-left: 6px solid var(--grp); border-radius: 10px; background: var(--panel); }
.group-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.group-head h3 { margin: 12px 0 8px; color: var(--grp); font-size: 18px; }
.group-head .group-total { margin-left: auto; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.group .tablewrap { margin: 0; }

/* Camembert de l'accueil */
.card.pie h3 { margin-top: 0; }
.pie-body { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 240px; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto 64px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.legend li:last-child { border-bottom: 0; }
.legend .sw { width: 14px; height: 14px; border-radius: 3px; }
.legend .lg-v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.legend .lg-p { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Tableaux de bord */
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.dash-cols > .card { min-width: 0; }
.d-label { min-width: 120px; text-align: center; display: inline-block; text-transform: capitalize; }
.small { font-size: 12px; margin-bottom: 8px; }
.cat-row { display: grid; grid-template-columns: minmax(110px, 1.5fr) 1.5fr auto 38px 68px; gap: 8px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cat-row:hover, .cat-row.open { background: var(--accent-soft); }
.cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.cat-bar span { display: block; height: 100%; border-radius: 5px; }
.cat-bar .dep, .ychart .exp, .sw.exp { background: #c0504d; fill: #c0504d; }
.cat-bar .rev, .ychart .inc, .sw.inc { background: #2e8b57; fill: #2e8b57; }
.cat-amt, .cat-pct, .cat-delta { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.cat-amt { font-weight: 600; }
.cat-detail { padding: 6px 4px 12px 16px; border-bottom: 1px solid var(--line); }
table.mini { width: 100%; font-size: 13px; margin-bottom: 8px; }
table.mini td { padding: 3px 6px; }
.chartwrap { overflow-x: auto; }
.ychart { width: 100%; min-width: 480px; height: auto; }
.ychart .grid { stroke: var(--line); }
.ychart .ax { fill: var(--muted); font-size: 11px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
tr.cat-root td { background: var(--accent-soft); }

/* Ticket */
.ticket-wrap { display: grid; grid-template-columns: 140px 1fr; gap: 14px; margin-top: 12px; align-items: start; }
.ticket-wrap img { width: 140px; max-height: 260px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
@media (max-width: 560px) { .ticket-wrap { grid-template-columns: 1fr; } .ticket-wrap img { width: 100%; max-height: 200px; } }

/* Étiquettes, prévision, rappels */
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; margin: 2px 4px 0 0; border-radius: 10px; background: #e8f0fa; color: #1f4e79; border: 1px solid #c9dbef; }
.banner.warn-banner { background: #fdecea; border-color: #f0b4ad; color: #8a1f11; }
.banner.remind ul { margin: 6px 0 0; padding-left: 18px; }
.ychart .fc-line { fill: none; stroke: #1f6fb5; stroke-width: 2; }
.ychart .thr { stroke: #c0504d; stroke-dasharray: 5 4; }
.ychart .thr-t { fill: #c0504d; }
.ychart .zero { stroke: var(--muted); }
tr.below td { background: #fdecea; }
.small-inline { font-size: 11px; }
.card.loan { margin-bottom: 14px; }
details summary { cursor: pointer; color: var(--accent, #1f6fb5); margin: 6px 0; }
@media (prefers-color-scheme: dark) { .tag { background: #1d3550; color: #cfe2f7; border-color: #2c4c70; } .banner.warn-banner, tr.below td { background: #4a1f1a; color: #f6d4cf; } }
.ticket-wrap > .form { min-width: 0; }
.ticket-wrap .form input, .ticket-wrap .form select { min-width: 0; max-width: 100%; box-sizing: border-box; }

/* Sélection multiple des catégories */
.selbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 10px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px; }
.selbar[hidden] { display: none; }
.sel-list { max-height: 200px; overflow: auto; margin: 6px 0; padding-left: 20px; }
input.csel { width: 16px; height: 16px; }

/* Plusieurs tickets */
table.tm input { width: 100%; min-width: 0; box-sizing: border-box; }
table.tm input[type=checkbox] { width: 16px; }
table.tm td { vertical-align: middle; }
.tm-img { width: 46px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
tr.tm-warn td { background: #fff4d6; }
@media (prefers-color-scheme: dark) { tr.tm-warn td { background: #4a3b12; } }

.modal.wide { max-width: 980px; }

/* Rappels cliquables */
.banner.remind li.rem-item { cursor: pointer; padding: 3px 4px; border-radius: 4px; }
.banner.remind li.rem-item:hover { background: rgba(0,0,0,.06); text-decoration: underline; }
.rem-actions { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.rem-actions button { text-align: left; }

/* Barre latérale : menu et comptes bien séparés */
.sidebar .side-title { margin: 4px 16px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); }
.sidebar nav.menu a { border-left: 3px solid transparent; }
.sidebar nav.menu a.active { border-left-color: #8fc1ff; font-weight: 600; }
.side-accounts { margin-top: 18px; padding: 14px 0 6px; border-top: 2px solid rgba(255,255,255,.18); background: rgba(0,0,0,.18); }
.side-accounts .side-title { font-size: 12px; font-weight: 700; color: var(--side-ink); }
.side-group { margin: 10px 10px 12px; border-left: 4px solid var(--grp); border-radius: 6px; background: rgba(255,255,255,.04); padding-bottom: 4px; }
.side-group.grp-courant { --grp: #5aa7ff; } .side-group.grp-epargne { --grp: #5fd08f; } .side-group.grp-placements { --grp: #c99bf2; } .side-group.grp-biens { --grp: #f0a35e; }
.sidebar .side-group .grp { margin: 0; padding: 8px 10px 6px; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--grp); border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .side-group .grp span:last-child { color: var(--side-ink); font-weight: 600; letter-spacing: 0; }
.sidebar .side-group nav a.acc { padding: 6px 10px 6px 14px; font-size: 13px; color: var(--side-ink); opacity: .92; }
.sidebar .side-group nav a.acc.active { opacity: 1; font-weight: 600; background: var(--side-hover); }

/* Groupe Prêts */
.grp-prets { --grp: #c0504d; }
.side-group.grp-prets { --grp: #ff8f86; }

/* Accueil nouvel utilisateur */
.welcome { max-width: 980px; }
.welcome-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0; }
.welcome-steps .card h3, .welcome .card h3 { margin-top: 0; }
.welcome ol, .welcome ul { padding-left: 20px; line-height: 1.5; }
/* Écran de code */
.lockscreen { position: fixed; inset: 0; z-index: 1000; background: var(--side); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lockbox { background: var(--panel); color: var(--ink, inherit); border-radius: 12px; padding: 24px; width: 100%; max-width: 320px; text-align: center; }
.lockbox input { font-size: 22px; text-align: center; letter-spacing: .3em; width: 100%; box-sizing: border-box; margin: 8px 0; }
.lockbox button { width: 100%; }

/* Tableau d'amortissement */
details.amort { margin-top: 8px; }
details.amort tr.paid td { color: var(--muted, #6b7280); }
details.amort tr.nextdue td { font-weight: 600; background: rgba(30, 80, 140, .08); }

/* Logos dans la barre latérale */
#sidebar a.acc .accrow { min-width: 0; }
#sidebar a.acc .accname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar a.acc .logo { width: 20px; height: 20px; font-size: 9px; border-radius: 5px; margin-right: 7px; }
#sidebar a.acc .logo.img { border-color: transparent; }

/* Bandeau sauvegarde automatique */
.autobar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 900; background: #fff7e6; color: #5a3b00; border: 1px solid #f0c36d; border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: calc(100vw - 32px); }
.autobar button { white-space: nowrap; }

#syncbar { flex-wrap: wrap; }
@media (max-width: 600px) { .autobar { left: 16px; right: 16px; transform: none; bottom: 12px; } }
/* Suggestions de tiers */
.suggest { position: fixed; z-index: 30; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-height: 280px; overflow-y: auto; }
.suggest[hidden] { display: none; }
.suggest .sg-item { padding: 9px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .sg-item:hover, .suggest .sg-item.on { background: var(--accent-soft); }

.dropping { outline: 3px dashed var(--accent); outline-offset: -6px; }
.dropzone .small, .small { font-size: .85em; margin-top: 6px; }
.pl-box { display: flex; gap: 16px; align-items: center; margin-top: 12px; }
.pl-box[hidden] { display: none; }
.pl-qr { flex: 0 0 auto; width: 190px; background: #fff; border-radius: 8px; line-height: 0; }
.pl-qr svg { width: 100%; height: auto; }
@media (max-width: 600px) { .pl-box { flex-direction: column; align-items: flex-start; } }

/* Registre d'un compte : tri par en-tête et ligne d'en-têtes toujours visible */
/* Écran large : le tableau suit le défilement de la page et les en-têtes se collent en haut de la fenêtre. */
@media (min-width: 1024px) { .tablewrap.reg { overflow: visible; overflow: clip; } }
/* Écran étroit (téléphone) : le tableau défile dans son cadre (aussi en largeur), en-têtes collés en haut du cadre. */
@media (max-width: 1023px) { .tablewrap.reg { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); } }
.tablewrap.reg thead th { z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
th.sortable { cursor: pointer; user-select: none; -webkit-user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); background: var(--accent-soft); }
th.sorted { color: var(--accent); }
/* En-têtes du registre : fond bleu foncé (couleur du menu) pour les distinguer des lignes pendant le défilement */
.tablewrap.reg thead th { background: var(--side); color: var(--side-muted); border-bottom-color: var(--side); box-shadow: 0 2px 4px rgba(0, 0, 0, .18); }
.tablewrap.reg thead th.sortable:hover { background: var(--side-hover); color: #fff; }
.tablewrap.reg thead th.sorted { color: #fff; }
.tablewrap.reg thead th.dim { opacity: 1; color: #7f93a8; }
/* Opération qui vient d'être enregistrée */
tr.just-saved td, tr.click.just-saved:hover td { background: var(--hl); }
tr.just-saved td:first-child { box-shadow: inset 4px 0 0 var(--accent); font-weight: 600; }
tr.just-saved.flash td { animation: saved-flash 1.6s ease-out; }
@keyframes saved-flash { 0%, 30% { background: var(--hl-strong); } 100% { background: var(--hl); } }
@media (prefers-reduced-motion: reduce) { tr.just-saved.flash td { animation: none; } }
.banner.saved-hidden { background: var(--hl); color: var(--ink); border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; }
.sort-ind { display: inline-block; min-width: 1em; margin-left: 3px; font-size: 10px; }
td.dim, th.dim { opacity: .55; }
.sort-note { margin: 0 0 8px; font-size: 13px; }
/* Vérification de la carte bancaire d'un ticket */
.card-note { margin-top: 8px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); }
.card-note.ok { border-color: var(--pos); color: var(--pos); }
.card-note.warn { background: var(--warn); color: var(--warn-ink); border-color: var(--warn-ink); }
.card-note button.link { font-weight: 600; }
.tm-cardnote { margin-top: 2px; white-space: nowrap; }
.reg-filters { margin-bottom: 6px; }
.reg-filters input[type=date] { padding: 4px 6px; }
.reg-count { margin-bottom: 8px; font-size: 13px; }

/* Rapprochement : présentation groupée */
.recon-layout { align-items: center; gap: 10px; margin: 6px 0 10px; }
.recon-grp td { background: var(--accent-soft); font-weight: 600; border-top: 2px solid var(--accent); }
.recon-grp .g-info { font-weight: normal; margin-left: 8px; }
.badge.plan { background: #ede3f7; color: #5b2a86; }
tr.recon-plan td:first-child { box-shadow: inset 3px 0 0 #8a5cc2; }
@media (prefers-color-scheme: dark) { .badge.plan { background: #352a45; color: #d4b8f0; } }
.pl-inner { display: flex; gap: 16px; align-items: center; }
@media (max-width: 600px) { .pl-inner { flex-direction: column; align-items: flex-start; } }
.pl-inner.pl-on .pl-qr, .pl-inner.pl-on .pl-help { display: none; }
.pl-inner:not(.pl-on) .pl-showqr { display: none; }
.pl-actions { margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.pl-inner.pl-on .pl-status { color: var(--pos); font-weight: 600; }
.t-done { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.side-ver { font-size: .75em; opacity: .55; padding: 10px 16px 0; }

.nowrap { white-space: nowrap; }

/* Registre : barre du compte (nom + Nouvelle opération, Ticket, Virement...) toujours visible au défilement (v47) */
.head.reg-head { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 10px 0; margin-top: -10px; box-shadow: 0 6px 6px -6px rgba(0, 0, 0, .25); }
@media (min-width: 1024px) { .tablewrap.reg thead th { top: var(--reg-head-h, 0px); } }
/* Cadre du tableau (écran étroit) : hauteur écran moins la barre figée et la marge du bas, pour que les en-têtes ne passent pas sous la barre */
@media (max-width: 1023px) { .tablewrap.reg { max-height: calc(100vh - var(--reg-head-h, 0px) - 70px); max-height: calc(100dvh - var(--reg-head-h, 0px) - 70px); } }
@media (max-width: 760px) { .tablewrap.reg { max-height: calc(100vh - var(--reg-head-h, 0px) - 24px); max-height: calc(100dvh - var(--reg-head-h, 0px) - 24px); } }
/* Téléphone : boutons sur une seule ligne qui défile latéralement, pour garder la barre compacte */
@media (max-width: 760px) {
  .head.reg-head { gap: 8px; }
  .head.reg-head .toolbar { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .head.reg-head .toolbar::-webkit-scrollbar { display: none; }
  .head.reg-head .toolbar button { flex: 0 0 auto; white-space: nowrap; }
}

/* Équilibrer ce compte : barre du compte + soldes figés en haut (même principe que le registre) */
.reg-head.recon-stick { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 10px 0 0; margin-top: -10px; margin-bottom: 10px; box-shadow: 0 6px 6px -6px rgba(0, 0, 0, .25); }
.recon-stick .head { margin-bottom: 4px; }
.recon-stick .recon-sum { position: static; }
@media (max-width: 760px) {
  .recon-stick .head { gap: 8px; }
  .recon-stick .toolbar { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .recon-stick .toolbar::-webkit-scrollbar { display: none; }
  .recon-stick .toolbar button, .recon-stick .toolbar .btn { flex: 0 0 auto; white-space: nowrap; }
  .recon-stick .recon-sum { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0 8px; }
  .recon-stick .recon-sum .kpi:nth-child(-n+2) { display: none; }
  .recon-stick .recon-sum .kpi { padding: 6px 8px; }
  .recon-stick .recon-sum .val { font-size: 16px; }
}
/* Écran étroit : le cadre du tableau (qui défile en interne) se cale sous la barre figée, en-têtes toujours visibles. */
@media (max-width: 1023px) { .tablewrap.reg.recon { position: sticky; top: var(--reg-head-h, 0px); } }
