:root {
  --cmd-rouge: #b42318; --cmd-rouge-bg: #fdecec; --cmd-ambre: #b45309; --cmd-ambre-bg: #fff3df; --cmd-vert: #1d7a46; --cmd-vert-bg: #e7f6ed;
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6ec;
  --accent: #1f5fae; --accent-soft: #e8f0fb; --ok: #1d7a46; --warn: #b54708; --err: #c0262d;
  --tiers: #0f766e; --tiers-soft: #d3f2ec; --tiers-row: #eef9f6;
  --resv: #b45309; --resv-soft: #fde7c2; --resv-row: #fde9c4; --resv-row-partiel: #fff7ea;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2128; --text: #e6e8ec; --muted: #98a2b3; --line: #2e333d; --accent: #6ea8fe; --accent-soft: #1e2b3f;
    --cmd-rouge: #fca5a5; --cmd-rouge-bg: #3a1d1f; --cmd-ambre: #fbbf24; --cmd-ambre-bg: #3a2b10; --cmd-vert: #6ee7a0; --cmd-vert-bg: #15291e;
    --tiers: #5eead4; --tiers-soft: #12403a; --tiers-row: #14231f;
    --resv: #fbbf24; --resv-soft: #43300a; --resv-row: #3b2b0e; --resv-row-partiel: #262012;
    --ok: #4ade80; --err: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 1rem; } h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
.topbar { display: flex; gap: 1.5rem; align-items: center; padding: .7rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.brand img, .login-logo { display: block; background: #fff; border-radius: 4px; }
.login-logo { justify-self: center; margin-bottom: .2rem; }
.login h1 { text-align: center; }
@media (prefers-color-scheme: dark) { .brand img, .login-logo { padding: 2px 4px; } }
.topbar nav { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); flex-wrap: wrap; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.topbar button.logout { background: var(--bg); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: .3rem .8rem; font-size: .9rem; }
.topbar button.logout { display: inline-flex; align-items: center; padding: .3rem .5rem; }
.topbar button.logout .ico { width: 18px; height: 18px; }
.topbar button.logout:hover { color: var(--text); }
.topbar a.prefs { display: inline-flex; align-items: center; padding: .3rem .5rem; background: var(--bg); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; }
.topbar a.prefs .ico { width: 18px; height: 18px; }
.topbar a.prefs:hover, .topbar a.prefs.active { color: var(--accent); }
.topbar nav a { text-decoration: none; color: var(--muted); padding: .25rem .7rem; border-radius: 6px; font-size: .9rem; white-space: nowrap; }
.topbar nav a { display: inline-flex; align-items: center; gap: .35rem; }
.topbar nav a .ico { width: 15px; height: 15px; flex: none; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a .pastille { min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.15rem; text-align: center; box-sizing: border-box; }
.topbar nav a .pastille.urgente { background: var(--err); }
@media (prefers-color-scheme: dark) { .topbar nav a .pastille { color: #14171c; } .topbar nav a .pastille.urgente { color: #fff; } }
.topbar nav a.active { background: var(--card); color: var(--accent); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.who { color: var(--muted); font-size: .9rem; margin-right: 1rem; }
main { max-width: 1400px; margin: 0 auto; padding: 1.2rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi .v { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login form { width: min(360px, 92vw); display: grid; gap: .8rem; }
label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .55rem; }
textarea { min-height: 5rem; resize: vertical; }
button { font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; padding: .4rem .8rem; }
button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--err); border-color: var(--err); }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button.small { padding: .15rem .5rem; font-size: .85rem; }
.toolbar { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: .9rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.cat td { background: var(--accent-soft); font-weight: 600; }
tr.zero td { color: var(--muted); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--accent-soft); }
.tag { display: inline-block; padding: 0 .4rem; border-radius: 4px; font-size: .78rem; background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: #fff1e5; color: var(--warn); }
.tag.resv { background: var(--resv-soft); color: var(--resv); font-weight: 600; }
.tag.tiers { background: var(--tiers-soft); color: var(--tiers); white-space: nowrap; }
.disweb { color: var(--muted); font-size: .85rem; }
/* Couleur de ligne : la réservation l'emporte sur l'article du confrère (règle placée après) */
tr.tiers td { background: var(--tiers-row); }
tr.reserved-partiel td { background: var(--resv-row-partiel); }
tr.reserved-partiel td:first-child { box-shadow: inset 4px 0 0 var(--resv-soft); }
tr.reserved td { background: var(--resv-row); }
tr.reserved td:first-child { box-shadow: inset 4px 0 0 var(--resv); }
td.dispo { font-weight: 700; }
td.dispo.ok { color: var(--ok); }
td.dispo.nul { color: var(--err); }
.resas { list-style: none; margin: .25rem 0 0; padding: 0; font-size: .8rem; color: var(--resv); }
.resas li { margin: .1rem 0; }
.legende { display: flex; gap: .4rem 1rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: 0 0 .4rem; }
.leg { display: inline-block; width: 1.1rem; height: .8rem; border-radius: 3px; vertical-align: middle; margin-right: .3rem; }
.leg-tiers { background: var(--tiers-row); border: 1px solid var(--tiers); }
.leg-resv { background: var(--resv-row); border: 1px solid var(--resv); box-shadow: inset 3px 0 0 var(--resv); }
.leg-resv-partiel { background: var(--resv-row-partiel); border: 1px solid var(--resv-soft); box-shadow: inset 3px 0 0 var(--resv-soft); }
.muted { color: var(--muted); }
.error { color: var(--err); min-height: 1.2em; margin: 0; }
.form { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.timeline li { border-left: 3px solid var(--accent); padding: .2rem .7rem; }
.timeline .meta { font-size: .8rem; color: var(--muted); }
.cols { display: grid; gap: 1rem; grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .hide-sm { display: none; } }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); width: min(820px, 95vw); padding: 1.2rem; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
.scroll { overflow-x: auto; }
.pre { white-space: pre-wrap; }
label.check { display: flex; gap: .5rem; align-items: center; color: inherit; }

/* --- Stock : vue compacte (0.4.0) --- */
.compact { overflow: visible; }
.stock-compact .modele { font-weight: 600; }
.stock-compact .caract { color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.dispo-gros { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dispo-gros.ok { color: var(--ok); }
.dispo-gros.nul { color: var(--err); }
.sur { color: var(--muted); font-size: .78rem; }
.actions-cell { white-space: nowrap; }
details.menu { position: relative; display: inline-block; vertical-align: middle; }
details.menu > summary { list-style: none; cursor: pointer; border: 1px solid var(--accent); color: var(--accent); border-radius: 6px; padding: .1rem .55rem; font-size: .95rem; line-height: 1.3; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--accent-soft); }
details.menu .menu-items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 9rem; display: grid; gap: .1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .3rem; box-shadow: 0 6px 18px rgb(0 0 0 / .18); }
details.menu .menu-items button { background: none; border: none; color: var(--text); text-align: left; padding: .4rem .6rem; border-radius: 5px; }
details.menu .menu-items button:hover { background: var(--accent-soft); }
@media (max-width: 640px) {
  .hide-xs { display: none; }
  .stock-compact td, .stock-compact th { padding: .35rem .3rem; }
  .toolbar label { flex: 1 1 45%; }
}

/* --- Stock : onglets par catégorie (0.4.1) --- */
.onglets { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: 0 0 .8rem; overflow-x: auto; scrollbar-width: thin; }
.onglets button { background: none; border: none; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted);
  padding: .5rem .9rem; white-space: nowrap; font-weight: 600; }
.onglets button:hover { color: var(--text); }
.onglets button.active { color: var(--text); border-bottom-color: var(--accent); }
.onglets .nb { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; font-size: .78rem; background: var(--accent-soft); color: var(--accent); }
@media (max-width: 640px) {
  .onglets { flex-wrap: wrap; overflow: visible; }
  .onglets button { padding: .4rem .6rem; }
}

/* --- À commander (0.5.0) --- */
.cmd-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.cmd { display: flex; gap: .8rem; align-items: flex-start; justify-content: space-between; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.cmd-texte { min-width: 0; }
.cmd .meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.cmd-note { font-size: .85rem; margin-top: .2rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmd-actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }
.a-commander-accueil { margin: 1rem 0; }
.a-commander-accueil h2 { margin-top: 0; }
.a-commander-accueil .cmd { background: var(--bg); }
details.historique > summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
@media (max-width: 640px) {
  .cmd { flex-direction: column; }
  .cmd-actions { align-self: flex-end; }
}
@media (max-width: 640px) {
  .topbar { gap: .5rem 1rem; padding: .6rem .8rem; }
  .topbar nav { gap: .4rem .9rem; flex-wrap: wrap; flex-basis: 100%; order: 3; }
  .topbar nav a { white-space: nowrap; }
}

/* Boutons d'étape (À commander) : une action, pas un état */
button { transition: filter .15s, background-color .15s; }
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: wait; }
/* Bouton d'étape : neutre (contour), distinct de la pastille d'état ; il décrit l'action à faire */
button.etape { font-weight: 600; padding: .3rem .8rem; background: var(--card); color: var(--text); border: 1px solid var(--muted); }
button.etape:hover:not(:disabled) { filter: none; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* --- À commander : états colorés (0.6.0) --- */
.pastille { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
  border: 1px solid currentColor; white-space: nowrap; vertical-align: .1em; }
.etat-a-commander { color: var(--cmd-rouge); background: var(--cmd-rouge-bg); }
.etat-attente { color: var(--cmd-ambre); background: var(--cmd-ambre-bg); }
.etat-livre { color: var(--cmd-vert); background: var(--cmd-vert-bg); }
.cmd-titre { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: baseline; }
.cmd.cmd-a_commander, .a-commander-accueil .cmd.cmd-a_commander { background: var(--cmd-rouge-bg); border-left: 4px solid var(--cmd-rouge); }
.cmd.cmd-commande { background: var(--cmd-ambre-bg); border-left: 4px solid var(--cmd-ambre); }
.cmd.cmd-recu { background: var(--cmd-vert-bg); border-left: 4px solid var(--cmd-vert); }
.note-livre { display: flex; gap: .5rem; align-items: center; margin-top: .4rem; font-size: .85rem; color: var(--muted); }
.note-livre input { flex: 1; min-width: 0; padding: .3rem .45rem; font-size: .9rem; background: var(--card); }
.enregistre { color: var(--cmd-vert); font-weight: 600; font-size: .8rem; }
.tag.stock-ok { background: var(--cmd-vert-bg); color: var(--cmd-vert); border: 1px solid currentColor; text-decoration: none; white-space: nowrap; }

/* --- Étapes de commande : cases à cocher (0.6.1) --- */
.case-etape { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.2rem; padding: .3rem .8rem;
  border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--text);
  font-weight: 600; font-size: .9rem; cursor: pointer; user-select: none; white-space: nowrap; }
.case-etape input { width: 1.2rem; height: 1.2rem; margin: 0; cursor: pointer; accent-color: var(--cmd-vert); }
.case-etape:hover { border-color: var(--accent); background: var(--accent-soft); }
.case-etape:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.case-etape.coche { border-color: var(--cmd-vert); color: var(--cmd-vert); background: var(--cmd-vert-bg); }
.etape-faite { font-size: .78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .case-etape { min-height: 2.6rem; padding: .35rem 1rem; font-size: 1rem; }
  .case-etape input { width: 1.4rem; height: 1.4rem; }
  .cmd-actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* --- Note sur chaque ligne, compteur (0.6.2) --- */
.compteur { color: var(--muted); font-size: .9rem; margin: 1.2rem 0 .5rem; }
.cmd-texte { flex: 1; }
.note-livre { max-width: 36rem; }
@media (max-width: 640px) {
  .cmd-texte { width: 100%; }
  .note-livre { max-width: none; }
}

/* --- Trésorerie (0.7.0) --- */
.neg { color: var(--err); }
.pos { color: var(--ok); }
.nul-m { color: var(--muted); }
.petit { font-size: .8rem; }
.alerte { background: var(--cmd-ambre-bg); color: var(--cmd-ambre); border: 1px solid currentColor; border-radius: 8px; padding: .5rem .8rem; }
.soldes .kpi .v { font-size: 1.35rem; }
.actions-solde { margin-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; }
table.treso th:first-child, table.treso td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 11rem; }
table.treso tr.depart td, table.treso tr.fin td { font-weight: 700; }
table.treso tr.fin td { border-top: 2px solid var(--line); }
button.cellule { background: none; border: none; padding: .1rem .2rem; color: inherit; font: inherit; font-variant-numeric: tabular-nums; border-radius: 4px; }
button.cellule:hover { background: var(--accent-soft); filter: none; }
.synthese .ligne-synthese { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.synthese .ligne-synthese input { width: 9rem; text-align: right; margin-left: auto; }
.synthese .ligne-synthese.total { font-size: 1.1rem; border-bottom: none; }
tr.ignoree td { opacity: .55; }
.tag.source-fp { background: var(--cmd-vert-bg); color: var(--cmd-vert); }
h2 .small { margin-left: .6rem; vertical-align: middle; }
.treso-actu { align-items: center; }

/* --- Trésorerie : saisie des soldes directement dans la carte (0.7.2) --- */
.saisie-solde { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.saisie-solde input[name=montant] { flex: 1 1 7rem; min-width: 0; text-align: right; font-weight: 600; background: var(--card); border-color: var(--muted); }
.saisie-solde input[name=date] { flex: 0 1 9.5rem; min-width: 0; font-size: .85rem; }
.solde-carte .error { min-height: 0; }
.solde-carte .actions-solde { justify-content: space-between; align-items: center; }
.solde-ok { color: var(--cmd-vert); margin: .3rem 0 0; }
.avertissement { color: var(--cmd-ambre); background: var(--cmd-ambre-bg); border-radius: 6px; padding: .3rem .5rem; margin: .3rem 0 0; }
.saisie-solde input[name=montant]::placeholder { font-weight: 400; font-style: italic; text-align: left; }
.amex-a-venir { list-style: none; margin: .2rem 0 0; padding: 0; font-size: .8rem; display: grid; gap: .1rem; }
.carte-amex .amex-cycle { border-top: 1px solid var(--line); padding-top: .45rem; margin-top: .45rem; }
.carte-amex .petit-v { font-size: 1.15rem; }
.case-preleve { margin: .3rem 0; min-height: 1.9rem; padding: .2rem .7rem; font-size: .85rem; }
.rappel-preleve { display: inline-block; margin: 0 0 0 .4rem; padding: .1rem .45rem; }
.amex-compact .ligne-compacte { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .4rem; font-size: .9rem; }
.amex-compact .case-preleve { margin: 0; min-height: 1.7rem; padding: .1rem .55rem; }
details.corriger > summary { cursor: pointer; font-size: .8rem; color: var(--accent); margin-top: .2rem; display: inline-block; }
details.corriger[open] > summary { color: var(--muted); }

/* --- Saisie au clic sur la valeur (0.7.6) --- */
.valeur-edit { background: none; border: none; padding: 0; color: var(--text); font: inherit; font-size: 1.35rem; font-weight: 700;
  font-variant-numeric: tabular-nums; cursor: pointer; display: inline-flex; align-items: baseline; gap: .35rem; border-radius: 4px; }
.valeur-edit:hover:not(:disabled) { filter: none; color: var(--accent); }
.valeur-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.valeur-edit .crayon { font-size: .85rem; color: var(--accent); opacity: 0; transition: opacity .15s; }
.valeur-edit:hover .crayon, .valeur-edit:focus-visible .crayon { opacity: 1; }
@media (hover: none) { .valeur-edit .crayon { opacity: .75; } }
.valeur-edit.petit-v { font-size: 1.15rem; }
.valeur-edit.valeur-poste { font-size: 1rem; }
.saisie-solde button[data-fermer], .saisie-poste button[data-fermer] { margin-left: 0; }
.saisie-poste { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.saisie-poste input { width: 9rem; text-align: right; }
.synthese .ligne-synthese .editable { margin-left: auto; text-align: right; }
.carte-amex .case-preleve { margin: .3rem 0 0; min-height: 1.8rem; padding: .15rem .6rem; font-size: .85rem; }
.solde-carte > .case-preleve { margin: .3rem 0 0; min-height: 1.8rem; padding: .15rem .6rem; font-size: .85rem; }

/* --- Report d'un encaissement (0.8.1) --- */
.tag.reporte { background: var(--cmd-ambre-bg); color: var(--cmd-ambre); }
.actions-report { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; margin-top: .3rem; }

/* --- Trésorerie : détail d'une case (0.8.3, en fenêtre depuis la 0.8.5) --- */
.detail-entete { display: flex; align-items: flex-start; gap: .6rem; }
.detail-entete h2 { margin: 0; flex: 1; font-size: 1.05rem; }
.fermer-detail { font-size: 1.1rem; line-height: 1; padding: .1rem .3rem; color: var(--muted); }
.retour-detail { display: none; }
.detail-total { margin: .4rem 0 .6rem; font-weight: 600; }
.detail-lignes { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.detail-lignes li { border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.detail-ligne-haut { display: flex; justify-content: space-between; gap: .6rem; }
.detail-ligne-haut strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
button.cellule.active { outline: 2px solid var(--accent); background: var(--accent-soft); }

/* --- Trésorerie plus compacte (0.8.4) --- */
.grid.soldes { grid-template-columns: repeat(auto-fill, minmax(220px, 290px)); align-items: start; }
.grid.soldes .carte-amex { grid-column: span 1; }
.solde-carte .actions-solde button[data-historique] { font-size: .8rem; }
.detail-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .8rem; align-items: baseline; }
.tri-detail { font-size: .8rem; color: var(--muted); font-weight: 400; }
.tri-detail button.actif { font-weight: 700; text-decoration: underline; }
.detail-lignes { gap: 0; }
.detail-lignes li { padding: .35rem 0; }
.detail-ligne-haut { align-items: baseline; gap: .5rem; }
.detail-libelle { flex: 1; min-width: 0; font-size: .9rem; }
.detail-ligne-haut details.menu > summary { padding: 0 .45rem; font-size: .85rem; }
.detail-ligne-bas { font-size: .75rem; color: var(--muted); margin-top: .05rem; }
.detail-ligne-bas .tag { font-size: .7rem; }


/* Fenêtre de détail (0.8.5) : largeur confortable, défilement interne, plein écran sur téléphone */
dialog.detail-modal { width: min(720px, 95vw); max-height: 85vh; overflow: auto; overscroll-behavior: contain; }
dialog.detail-modal .fermer-detail { position: absolute; top: .9rem; right: 1rem; font-size: 1.15rem; line-height: 1; color: var(--muted); }
dialog.detail-modal h2 { margin: 0 2rem .4rem 0; }
.retour-detail { display: none; }
@media (max-width: 640px) {
  dialog.detail-modal { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; border: none; }
  dialog.detail-modal .retour-detail { display: inline-block; margin-bottom: .4rem; }
  dialog.detail-modal .fermer-detail { display: none; }
}

/* --- 0.9.0 : cartes alignées sur le tableau, lignes prévisionnelles, opérations repliées --- */
.grid.soldes { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
table.treso tr.previsionnel td { font-style: italic; }
table.treso tr.previsionnel .pos { color: var(--ok); opacity: .7; }
details.section-ops > summary { cursor: pointer; list-style: none; }
details.section-ops > summary::-webkit-details-marker { display: none; }
details.section-ops > summary h2 { display: inline-block; }
details.section-ops > summary h2::before { content: "▸ "; color: var(--muted); }
details.section-ops[open] > summary h2::before { content: "▾ "; }
#op-add-haut { margin-right: .5rem; }

/* --- 0.9.1 : déplacer d'un mois en un clic --- */
.report-mini { display: inline-flex; gap: .25rem; white-space: nowrap; }
button.mini { font-size: .72rem; padding: .05rem .4rem; background: var(--card); color: var(--accent); border: 1px solid var(--line); border-radius: 5px; }
button.mini:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); filter: none; }
button.mini:disabled { color: var(--muted); opacity: .45; cursor: default; }
.detail-ligne-bas { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .2rem .6rem; }

/* 0.9.3 : objet des factures, encaissements issus de récurrentes / uniques */
.detail-objet { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-groupe { font-size: .85rem; font-weight: 600; margin: .9rem 0 .3rem; }
.detail-groupe:first-of-type { margin-top: .3rem; }
table.treso tr.sous-ligne td { font-size: .8rem; color: var(--muted); padding-top: 0; padding-bottom: .15rem; border-top: none; }
table.treso tr.sous-ligne td:first-child { padding-left: 1.2rem; }


/* 0.10.0 : TVA à payer */
table.treso button.cellule.estimation { font-style: italic; }
.bloc-tva { margin-bottom: 1rem; }
table.tva-calcul { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .2rem 0 .4rem; }
table.tva-calcul td { padding: .2rem 0; border-bottom: 1px solid var(--line); }
table.tva-calcul td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.tva-calcul tr.fin td { font-weight: 600; border-bottom: none; }
details.tva-pieces { font-size: .83rem; margin: .25rem 0; }
details.tva-pieces summary { cursor: pointer; color: var(--muted); }
details.tva-pieces ul { list-style: none; margin: .3rem 0 0; padding: 0; max-height: 14rem; overflow: auto; }
details.tva-pieces li { display: flex; justify-content: space-between; gap: .6rem; padding: .1rem 0; border-bottom: 1px dotted var(--line); }
details.tva-pieces li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.tva-pieces li .n { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 0.10.1 : case « Acompte congés » sur une ligne */
.toolbar label.case-inline { display: flex; flex-direction: row; align-items: center; gap: .35rem; flex-wrap: nowrap; }
.toolbar label.case-inline select { width: auto; }

/* 0.10.2 : poste de synthèse compté en dette */
.ligne-synthese.dette strong { color: var(--err); }

/* 0.10.6 : estimations (fournisseur, Amex) en italique dans le détail */
.detail-lignes li.estimation .detail-libelle, .detail-lignes li.estimation strong { font-style: italic; }

/* 0.10.12 : solde prévu, ligne d'information sous le total */
.ligne-synthese.info { color: var(--muted); font-style: italic; border-top: 1px dashed var(--line); }

/* 0.10.13 : cartes du haut compactes — une rangée de 4 (2 sur écran étroit), montant et date / « Prélevé » sur une ligne,
   Historique en petite icône, aides dans une icône « ? » (title), Amex : arrêté et en cours côte à côte */
.grid.soldes { grid-template-columns: minmax(150px, .7fr) minmax(150px, .7fr) minmax(0, 1fr) minmax(0, 1.75fr) minmax(0, .95fr); align-items: stretch; gap: .6rem; }
@media (max-width: 900px) { .grid.soldes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .grid.soldes { grid-template-columns: 1fr; } }
.grid.soldes .solde-carte { padding: .6rem .8rem; }
.grid.soldes .kpi .v, .grid.soldes .valeur-edit { font-size: 1.2rem; }
.solde-carte .entete-carte { display: flex; align-items: baseline; gap: .3rem; flex-wrap: wrap; font-size: .85rem; }
.solde-carte .entete-carte .lien-histo { margin-left: auto; font-size: .9rem; text-decoration: none; padding: 0 .1rem; }
.solde-carte .aide { display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem; border-radius: 50%;
  border: 1px solid var(--line); color: var(--muted); font-size: .7rem; cursor: help; }
.solde-carte .ligne-compacte { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.solde-carte .ligne-compacte .editable:not(.ouvert) { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.solde-carte .ligne-compacte .editable:not(.ouvert) > .l { font-size: .75rem; margin: 0; }
.solde-carte .ligne-compacte .case-preleve { margin: 0; padding: .1rem .4rem; font-size: .78rem; }
.carte-amex .amex-cycles.deux { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.carte-amex .amex-cycle { padding-top: .25rem; margin-top: .25rem; border-top: none; }
.carte-amex .amex-cycles.deux .amex-cycle + .amex-cycle { border-left: 1px solid var(--line); padding-left: .6rem; }
.carte-amex .amex-cycle .l { font-size: .75rem; }
.carte-amex .valeur-edit.petit-v { font-size: 1.05rem; }

/* 0.10.14 : Amex plus large, « Prélevé » à droite du montant (une ligne de moins) */
.carte-amex .amex-cycle .ligne-compacte { flex-wrap: nowrap; }
.carte-amex .amex-cycle .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 0.10.15 : montants des comptes et de la CB pro alignés sur ceux de l'Amex (qui ont une ligne de sous-titre au-dessus) */
@media (min-width: 901px) { .grid.soldes .solde-carte:not(.carte-amex) > .ligne-compacte { margin-top: 1.3rem; } }

/* 0.10.21 : 5e carte « Virements perso » : montant et « + Virement » sur une ligne, reste estimé en dessous */
.carte-virements .ligne-compacte .v { font-size: 1.2rem; }
.carte-virements .ligne-compacte .vir-ajout { margin-left: auto; padding: .05rem .45rem; font-size: .75rem; white-space: nowrap; }
.carte-virements .sous-vir { font-size: .72rem; margin-top: .1rem; }
.grid.soldes .solde-carte .entete-carte { flex-wrap: nowrap; white-space: nowrap; }
.grid.soldes .solde-carte .entete-carte > .muted { overflow: hidden; text-overflow: ellipsis; }
/* 0.10.20 : icône « ? » dans la synthèse */
.ligne-synthese .aide { display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem; border-radius: 50%;
  border: 1px solid var(--line); color: var(--muted); font-size: .7rem; cursor: help; font-style: normal; }

/* 0.10.21 : pas de retour à la ligne dans les cartes du haut (montant, date, « Prélevé ») sur écran large */
@media (min-width: 901px) {
  .grid.soldes .solde-carte .ligne-compacte { flex-wrap: nowrap; }
  .grid.soldes .solde-carte .ligne-compacte .editable:not(.ouvert) { flex-wrap: nowrap; white-space: nowrap; }
  .grid.soldes .solde-carte .ligne-compacte .editable:not(.ouvert) > .l { overflow: hidden; text-overflow: ellipsis; }
  .grid.soldes .valeur-edit { white-space: nowrap; }
}
@media (min-width: 901px) and (max-width: 1300px) {
  .grid.soldes .solde-carte .ligne-compacte .editable:not(.ouvert) > .l { display: none; } /* dates : dans 🕘 */
  .grid.soldes .solde-carte { padding: .55rem .6rem; }
}
.grid.soldes .solde-carte { overflow: hidden; }
/* 0.10.22 : rappel échéancier Urssaf (janvier, mai) */
.rappel-urssaf { background: var(--accent-soft, #eef4ff); border-radius: 6px; padding: .35rem .6rem; display: inline-block; }
/* 0.10.24 : encadré « À vérifier » */
details.a-verifier { border: 1px solid #f0c36d; background: #fff8e6; border-radius: 8px; padding: .4rem .8rem; margin: .5rem 0; }
@media (prefers-color-scheme: dark) { details.a-verifier { background: #2e2716; border-color: #6b5420; } }
details.a-verifier summary { cursor: pointer; font-weight: 600; }
details.a-verifier .compteur { display: inline-block; min-width: 1.4rem; text-align: center; border-radius: 999px; background: #e0a526; color: #fff; font-size: .8rem; padding: 0 .35rem; margin: 0 .3rem; }
details.a-verifier ul { margin: .4rem 0 .2rem; padding-left: 1.1rem; font-size: .88rem; }
details.a-verifier li { margin: .2rem 0; }
.small:not(button) { font-size: .85rem; }
.joplin-fiche { border-style: dashed; }
.nw { white-space: nowrap; }
/* Commissions */
table.commissions tr.ouverte td { background: var(--card); font-weight: 600; }
table.commissions tr.detail-ligne > td { background: var(--card); padding: .6rem .8rem 1rem; }
table.articles { margin-bottom: .6rem; }
table.articles label.check { margin-right: .6rem; white-space: nowrap; }
table.totaux { width: 100%; }
table.totaux td { padding: .2rem 0; border: 0; }
table.totaux tr.total td { border-top: 1px solid var(--border, #ccc); padding-top: .4rem; }
table.totaux hr { border: 0; border-top: 1px dashed var(--muted); margin: .2rem 0; }
.tag.ok { background: #dff3e4; color: #1d6b34; }
.cols.cols-commissions { grid-template-columns: minmax(0, 1fr) 20rem; }
@media (max-width: 900px) { .cols.cols-commissions { grid-template-columns: 1fr; } }
table.commissions td:nth-child(3) { min-width: 14rem; }
.annulees { margin-top: .6rem; }

/* 0.12.1 : lignes du tableau déroulées, chaque élément sous la colonne de son mois */
table.treso button.depli { background: none; border: none; padding: .1rem .2rem .1rem 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
table.treso button.depli:hover { color: var(--accent); filter: none; }
table.treso .chevron { display: inline-block; width: 1em; color: var(--muted); font-style: normal; }
table.treso tr.depliee > td { background: var(--accent-soft); font-weight: 600; }
table.treso tr.depliee > td:first-child { background: color-mix(in srgb, var(--accent-soft) 60%, var(--card)); }
table.treso tr.depli-entete td { padding: .1rem .4rem .1rem 1.4rem; border-top: none; }
table.treso tr.depli-entete td:first-child { position: static; }
table.treso tr.depli-entete button.actif { font-weight: 700; text-decoration: underline; }
table.treso tr.sous-element td { font-size: .8rem; padding-top: .1rem; padding-bottom: .1rem; border-top: 1px dashed var(--line); font-style: normal; }
table.treso tr.sous-element td:first-child { padding-left: 1.4rem; max-width: 20rem; }
table.treso .petit-tag { font-size: .65rem; padding: 0 .3rem; }
table.treso .cel-element { display: inline-flex; align-items: center; justify-content: flex-end; gap: .1rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.treso .cel-element.estimation .montant-element { font-style: italic; }
table.treso .cel-element.retard .montant-element { text-decoration: underline wavy var(--cmd-ambre); text-underline-offset: 3px; }
table.treso .reporte-mini { color: var(--muted); margin-left: .1rem; }
table.treso button.fleche { background: none; border: 1px solid transparent; color: var(--accent); padding: 0 .2rem; font-size: .8rem; line-height: 1.2; border-radius: 4px; opacity: .35; }
table.treso tr.sous-element:hover button.fleche:not(:disabled), table.treso button.fleche:focus-visible { opacity: 1; }
table.treso button.fleche:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); filter: none; }
table.treso button.fleche:disabled { opacity: .12; cursor: default; }
table.treso .cel-element details.menu > summary { padding: 0 .35rem; font-size: .75rem; border-color: var(--line); }
table.treso .cel-element details.menu .menu-items { font-size: .85rem; text-align: left; white-space: normal; }
table.treso td.vient-de-bouger { animation: vient-de-bouger 1.6s ease-out; }
@keyframes vient-de-bouger { from { background: var(--cmd-ambre-bg); } to { background: transparent; } }
@media (hover: none) { table.treso button.fleche:not(:disabled) { opacity: .8; } }

/* 0.12.2 : achats perso à côté du salaire */
table.treso .perso-mois { font-size: .72rem; color: var(--muted); font-style: normal; cursor: help; white-space: nowrap; }
.tag.tag-perso { background: var(--cmd-ambre-bg); color: var(--cmd-ambre); }
.carte-virements .ligne-compacte .muted { margin-left: .4rem; }
.commission-accueil { margin-bottom: 1rem; }

/* 0.12.7 : lignes déroulées plus lisibles (nom, puis détail en dessous) ; montants empilés quand un élément revient deux fois dans un mois */
table.treso .libelle-element { width: 19rem; max-width: 19rem; line-height: 1.25; }
table.treso .nom-ligne { display: flex; align-items: baseline; gap: .3rem; min-width: 0; }
table.treso .nom-element { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
table.treso .detail-element { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.treso tr.sous-element td { vertical-align: middle; padding-top: .25rem; padding-bottom: .25rem; }
table.treso tr.sous-element td:first-child { max-width: none; }
table.treso td .cel-element { display: flex; }
table.treso td .cel-element + .cel-element { margin-top: .15rem; padding-top: .15rem; border-top: 1px dotted var(--line); }

/* 0.12.9 : montant déroulé cliquable (menu d'actions sans « ⋯ ») ; résumé d'actualisation en pastilles */
table.treso .cel-element details.menu.menu-montant > summary { border: 1px solid transparent; color: inherit; padding: 0 .25rem; font-size: inherit; border-radius: 4px; }
table.treso .cel-element details.menu.menu-montant > summary:hover { border-color: var(--line); background: var(--accent-soft); }
table.treso .cel-element details.menu.menu-montant[open] > summary { border-color: var(--accent); background: var(--accent-soft); }
table.treso details.menu-montant .menu-items { font-size: .85rem; text-align: left; white-space: normal; }
.treso-actu { flex-wrap: wrap; row-gap: .4rem; }
.actu-resume { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; flex: 1 1 30rem; min-width: 0; }
.actu-date { font-size: .85rem; font-weight: 600; color: var(--text); margin-right: .2rem; white-space: nowrap; }
.actu-chiffres { display: flex; flex-wrap: wrap; gap: .3rem; }
.actu-chiffre { font-size: .78rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .55rem; white-space: nowrap; }
.actu-ignorees { white-space: nowrap; }

/* 0.12.12 : résumé d'actualisation à droite, pastilles sur deux lignes alignées à droite */
.treso-actu { align-items: center; }
.actu-resume { flex-direction: column; align-items: flex-end; margin-left: auto; flex: 0 1 auto; text-align: right; }
.actu-chiffres { display: grid; grid-template-columns: repeat(3, auto); justify-content: end; justify-items: end; gap: .3rem; }
@media (max-width: 640px) {
  .actu-resume { align-items: flex-start; margin-left: 0; text-align: left; }
  .actu-chiffres { display: flex; justify-content: flex-start; }
}

/* Achats depuis un justificatif */
.titre-accueil { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.titre-accueil h1 { margin: 0; flex: 1; }
.depot { border-style: dashed; }
.depot.survol { border-color: var(--accent); background: var(--accent-soft); }
.liste-justif { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.liste-justif li { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; }
.liste-justif .meta, .timeline .meta { color: var(--muted); font-size: .85rem; }
.cols.cols-achat { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.apercu img { max-width: 100%; max-height: 75vh; display: block; margin: 0 auto; }
.apercu iframe { width: 100%; height: 75vh; border: 0; }
.form-achat { margin-top: .8rem; }
.achat-cree { max-width: 40rem; }
.actions-achat { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
@media (max-width: 900px) { .cols.cols-achat { grid-template-columns: 1fr; } .apercu img { max-height: 45vh; } .apercu iframe { height: 50vh; } }
.bandeau-cree { background: var(--cmd-vert-bg); border-radius: 6px; padding: .4rem .7rem; margin: 0 0 .8rem; }
.credit-api { margin-top: 1rem; }
.credit-api p { margin: .2rem 0; }
.reglages-lecture { margin-top: .6rem; }
.reglages-lecture summary { cursor: pointer; color: var(--accent); }
.reglages-lecture .form { margin-top: .6rem; }

/* ---------- Clients (0.15.0) ---------- */
.nw { white-space: nowrap; }
.onglets-statut { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.onglets-statut .onglet { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem; }
.onglets-statut .onglet .n { font-variant-numeric: tabular-nums; opacity: .8; margin-left: .2rem; }
.onglets-statut .onglet.actif { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.table-clients th.tri { cursor: pointer; user-select: none; white-space: nowrap; }
.table-clients th.tri.asc::after { content: " ▲"; font-size: .7em; }
.table-clients th.tri.desc::after { content: " ▼"; font-size: .7em; }
.tag.statut-prospect { background: var(--cmd-ambre-bg); color: var(--cmd-ambre); }
.tag.statut-ancien { background: var(--line); color: var(--muted); }
.fiche-titre { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.fiche-titre h1 { margin-bottom: .5rem; }
.fiche-tete { display: flex; gap: 1.5rem; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.fiche-tete .coord { display: grid; gap: .3rem; }
.fiche-tete .chiffres { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.fiche-tete .kpi .v { font-size: 1.25rem; }
.fiche-tete .kpi .v.du-alerte { color: var(--warn); }
.joplin-fiche .joplin-entete { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: baseline; margin-bottom: .6rem; }
.joplin-fiche .joplin-actions { display: flex; gap: .8rem; }
.jsections { display: grid; gap: .5rem; }
details.jsec { border: 1px solid var(--line); border-radius: 8px; padding: .1rem .8rem; background: var(--bg); }
details.jsec[open] { padding-bottom: .6rem; }
details.jsec > summary { cursor: pointer; font-weight: 600; padding: .45rem 0; }
details.jsec.a-faire { border-color: var(--cmd-ambre); background: var(--cmd-ambre-bg); }
details.jsec.secrete > summary { color: var(--muted); }
.jcorps { overflow-wrap: anywhere; }
.jcorps p { margin: .4rem 0; }
.jcorps h4 { margin: .8rem 0 .3rem; font-size: .95rem; }
.jcorps ul, .jcorps ol { margin: .3rem 0; padding-left: 1.3rem; }
.jcorps li { margin: .15rem 0; }
.jcorps img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); }
.jcorps code, .jcorps pre { font-family: ui-monospace, monospace; font-size: .85em; background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 0 .25rem; }
.jcorps pre { padding: .5rem; overflow-x: auto; }
.jcorps .joplin-table { font-size: .88rem; margin: .4rem 0; }
.jcorps .joplin-table th { white-space: nowrap; }
.jcorps .case { font-size: 1.05em; }
.jcorps .case.faite { color: var(--ok); }
.secret { filter: blur(5px); cursor: pointer; border-radius: 3px; transition: filter .15s; background: var(--accent-soft); }
.secret.vu { filter: none; background: transparent; user-select: all; }
.secret-retire { color: var(--muted); letter-spacing: .1em; }
h3.sous-titre { font-size: .95rem; margin: .2rem 0 .4rem; }
h3.sous-titre:not(:first-child) { margin-top: 1rem; }
.copier { background: none; border: none; padding: 0 .2rem; font-size: .85em; cursor: pointer; color: var(--muted); vertical-align: baseline; }
.secret:not(.vu) + .copier { display: none; }
.table-clients tr.groupe-ligne td { background: var(--accent-soft); cursor: pointer; user-select: none; }
.table-clients tr.groupe-ligne .chevron { display: inline-block; width: 1.1em; color: var(--accent); }
.table-clients tr.membre td:first-child { padding-left: 1.6rem; }
.groupe-fiche { margin-top: .2rem; }

/* Accueil (0.16.0) : « À faire », argent, chiffres en pied */
.accueil-a-faire { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin: 0 0 1rem; padding: .6rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.accueil-a-faire .tag { text-decoration: none; font-size: .85rem; padding: .1rem .5rem; }
.arg-entete { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .8rem; margin: .4rem 0 .5rem; }
.arg-entete h2 { margin: 0; }
.arg-solde { margin-left: auto; }
.arg-grille { margin-bottom: 1rem; align-items: start; }
.arg h2 { margin: 0; font-size: 1rem; }
.arg-tete { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.arg-tete .v { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.arg > .meta, .arg .meta { font-size: .8rem; color: var(--muted); }
.arg-liste { list-style: none; margin: .6rem 0 0; padding: 0; }
.arg-liste li { display: flex; justify-content: space-between; gap: .6rem; padding: .35rem 0; border-top: 1px solid var(--line); font-size: .88rem; }
.arg-liste a { text-decoration: none; }
.arg-mt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.retard { color: var(--err); }
.commission-accueil { margin-bottom: 1rem; }
.clients-accueil { list-style: none; margin: .3rem 0 0; padding: 0; }
.clients-accueil li { padding: .25rem 0; }
.clients-accueil .meta { font-size: .8rem; color: var(--muted); }
.chiffres-accueil { margin-top: 1.5rem; text-align: center; }
.card > h2:first-child { margin-top: 0; }
.fiches-accueil { margin-bottom: 1rem; }
.fiches-liens { list-style: none; margin: 0; padding: 0; columns: 2 200px; column-gap: 2rem; }
.fiches-liens li { padding: .2rem 0; break-inside: avoid; }
.fiches-liens a { text-decoration: none; }
.cols-accueil { align-items: start; }
.cols-accueil > div { display: grid; gap: 1rem; }
.cols-accueil .card { margin: 0; }
.commission-mois { list-style: none; margin: 0; padding: 0; }
.commission-mois li { padding: .25rem 0; }
.commission-mois li + li { border-top: 1px solid var(--line); }

/* Utilisateurs */
.table-users td { vertical-align: top; }
.table-users .meta { font-size: .8rem; color: var(--muted); }
.table-users tr.inactif td { color: var(--muted); }
.table-users .actions-cell button { margin: 0 .15rem .2rem 0; }
.mdp-ligne { display: flex; gap: .4rem; align-items: center; }
.mdp-ligne input { flex: 1; font-family: ui-monospace, monospace; letter-spacing: .03em; }

/* Rappels (0.18.0) */
.accueil-a-faire .tag.rappel { display: inline-flex; align-items: center; gap: .3rem; }
.accueil-a-faire .tag.rappel label { display: inline-flex; align-items: center; gap: .3rem; font-size: inherit; color: inherit; cursor: pointer; }
.accueil-a-faire .tag.rappel input { margin: 0; }
.accueil-a-faire .tag.rappel a { text-decoration: none; }
.rappels-liste { list-style: none; padding: 0; margin: 0; min-width: min(34rem, 80vw); }
.rappels-liste li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.rappel-actions { display: flex; flex-wrap: wrap; gap: .2rem .7rem; align-items: start; justify-content: flex-end; font-size: .85rem; }
.danger-link { color: var(--err) !important; }
.rappel-annuel { display: flex; gap: .5rem; }
.rappel-form [hidden] { display: none; }
.rappel-form { grid-template-columns: 1fr; width: min(28rem, 80vw); }
.rappel-annuel label { flex: 1; }

/* Espace client et double authentification (0.19.0) */
#brand-espace { font-size: 1rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.onglets-espace { display: flex; gap: .3rem; flex-wrap: wrap; margin: 0 0 1rem; }
.onglets-espace a { text-decoration: none; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.onglets-espace a.actif { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.cols-espace > div > .card + .card { margin-top: 1rem; }
.taches { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .45rem; }
.taches li .meta { font-size: .8rem; color: var(--muted); margin-left: 1.6rem; }
.taches li.faite label { color: var(--muted); text-decoration: line-through; }
.ligne-ajout { display: flex; gap: .4rem; }
.ligne-ajout input { flex: 1; min-width: 0; }
.codes-secours { font-size: 1.1rem; letter-spacing: .08em; columns: 2; background: var(--bg); padding: .6rem 1rem; border-radius: 6px; }
.qr svg { width: 200px; height: 200px; display: block; margin: .5rem 0; background: #fff; border-radius: 6px; }
.choix-2fa button { text-align: left; padding: .7rem 1rem; color: var(--text); }
.etape-2fa { display: grid; gap: .6rem; max-width: 32rem; margin-top: 1rem; }
.etape-2fa ol { display: grid; gap: .8rem; padding-left: 1.2rem; margin: 0; }
.etape-2fa label { display: grid; gap: .2rem; }
.securite { max-width: 46rem; }
.preferences .card + .card { margin-top: 1rem; }
.form-mdp { display: grid; gap: .6rem; max-width: 26rem; }
fieldset.champs-client { border: 1px solid var(--line); border-radius: 8px; display: grid; gap: .6rem; }
fieldset.champs-client[hidden] { display: none; }
.champs-client .droits { display: grid; gap: .25rem; }
.case-ligne { display: flex; gap: .4rem; align-items: center; }
.journal table { font-size: .9rem; }
.journal-court { padding-left: 1rem; margin: .4rem 0; }
.table-factures { width: 100%; }
.table-factures .meta { font-size: .8rem; color: var(--muted); }
.table-factures .meta.warn { color: var(--warn); }
@media print { body * { visibility: hidden; } #dialog, #dialog * { visibility: visible; } #dialog { position: absolute; inset: 0; } #dialog button { display: none; } }
.taches label { display: flex; gap: .45rem; align-items: flex-start; font-size: .95rem; color: var(--text); cursor: pointer; }
.taches input { margin: .25rem 0 0; }
.table-factures tr.cachee { display: none; }
.error.ok-msg { color: var(--ok); }
.cols-espace.une-colonne { grid-template-columns: minmax(0, 46rem); }

/* Page ⓘ : versions et nouveautés */
.nouveautes { max-width: 42rem; max-height: 65vh; overflow-y: auto; }
.nouveautes h3 { margin: 1rem 0 .3rem; font-size: 1rem; }
.nouveautes ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.nouveautes details > summary { cursor: pointer; color: var(--accent); margin-top: 1.2rem; }

/* Adresses IP de confiance (Préférences) */
.form-ips { display: grid; gap: .5rem; max-width: 32rem; }
.form-ips textarea { width: 100%; font-family: ui-monospace, monospace; }

/* Petite fenêtre du mot de passe : simple calque (Bitwarden ne remplit pas un <dialog> modal) */
.calque-mdp { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.boite-mdp { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; width: min(420px, 100%); box-shadow: 0 10px 40px rgb(0 0 0 / .3); }
.boite-mdp h2 { margin-top: 0; }
.boite-mdp .champ-mdp { width: 100%; margin-bottom: 1rem; }

/* Incohérences facturation.pro / CRM (0.23.0) */
ul.incoherences { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.incoherences li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
ul.incoherences li .muted { margin-left: .4rem; }
.facturation-espace { display: grid; gap: 1rem; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 900px) { .facturation-espace { grid-template-columns: 1fr; } }
.taches-espace.en-tete { margin-bottom: 1rem; border-left: 4px solid var(--accent); }
.tag.refuse { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.acces-espace { margin-top: 1rem; }
.equipements-espace { max-width: 60rem; }

/* ---------- Statistiques (0.24.0) ---------- */
:root { --stats-1: #2a78d6; --stats-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root { --stats-1: #3987e5; --stats-2: #d95926; } }
.stats-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 1rem; }
.stats-evol { font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-evol.pos { color: var(--ok); }
.stats-carte { margin-bottom: 1rem; }
.stats-graphe { position: relative; }
.stats-graphe svg { width: 100%; height: auto; display: block; }
.stats-grille { stroke: var(--line); stroke-width: 1; }
.stats-base { stroke: var(--muted); stroke-width: 1; }
.stats-axe { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.stats-zone { fill: transparent; }
.stats-zone:hover { fill: var(--accent-soft); fill-opacity: .45; }
.stats-barre { pointer-events: none; }
.stats-barre.serie-1 { fill: var(--stats-1); } .stats-barre.serie-2 { fill: var(--stats-2); }
i.serie-1 { background: var(--stats-1); } i.serie-2 { background: var(--stats-2); }
.stats-case { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.stats-case input { width: auto; margin: 0; }
.stats-legende { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); margin: -.3rem 0 .3rem; }
.stats-legende i, .stats-bulle i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.stats-bulle { position: absolute; top: 0; width: 180px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem;
  font-size: .82rem; box-shadow: 0 4px 14px rgba(0,0,0,.12); pointer-events: none; }
.stats-bulle b { float: right; font-variant-numeric: tabular-nums; }
.stats-table td.num, .stats-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats-table td.estime { font-style: italic; }
.stats-table tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.stats-deux { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 1rem; }
.stats-postes { list-style: none; padding: 0; margin: 0; }
.stats-postes li { display: grid; grid-template-columns: minmax(8rem, 1.3fr) 2fr auto 2.6rem; gap: .5rem; align-items: center; padding: .2rem 0; font-size: .9rem; }
.stats-postes .barre { width: 100%; height: .6rem; display: block; }
.stats-postes .barre .fond { fill: var(--line); }
.stats-postes .barre .plein { fill: var(--stats-2); }
.stats-postes .barre .hachure { fill: url(#stats-hachure); }
.stats-postes .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-defile { overflow-x: auto; }
.stats-defs { position: absolute; width: 0; height: 0; }
.hachure-trait { fill: var(--stats-2); }
.releves-a-classer td { vertical-align: middle; }
.releves-a-classer select, .releves-a-classer input:not([type=checkbox]) { width: auto; max-width: 13rem; padding: .15rem .3rem; font-size: .85rem; }
.releves-a-classer input.motif { max-width: 10rem; }
#st-releves details { margin-top: .8rem; }
#st-releves details summary { cursor: pointer; color: var(--accent); }
.avantages-edition input, .avantages-edition select { width: auto; padding: .15rem .3rem; font-size: .85rem; }
.avantages-edition input[name=libelle] { min-width: 14rem; }
.avantages-edition input[name=motif] { min-width: 12rem; }
#st-avantages { margin-top: .8rem; }
#st-avantages summary { cursor: pointer; color: var(--accent); }
.avantages-edition td { white-space: nowrap; }

/* 0.25.3 : cadre de saisie ouvert dans une carte étroite (soldes, Amex) : il prend toute la largeur de la carte, montant et date
   l'un sous l'autre, boutons en dessous ; rien ne déborde ni n'est coupé */
.solde-carte .ligne-compacte .editable.ouvert { flex: 1 1 100%; min-width: 0; }
.solde-carte .saisie-solde { min-width: 0; }
.solde-carte .saisie-solde input[name=montant], .solde-carte .saisie-solde input[name=date] { flex: 1 1 100%; width: 100%; min-width: 0; box-sizing: border-box; }
.solde-carte .saisie-solde button { flex: 1 1 auto; min-width: 0; }

/* Trésorerie : paiements vus à la banque (0.28.5) */
.paiements-banque .pai-liste { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.pai-ligne { display: grid; grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.pai-banque { min-width: 0; }
.pai-montant { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 6px; }
.pai-montant.credit { color: var(--ok); } .pai-montant.debit { color: var(--text); }
.pai-libelle { font-size: .88em; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.pai-fleche { color: var(--muted); font-size: 1.2em; }
.pai-piece { min-width: 0; }
.pai-piece select { max-width: 100%; margin: 2px 0; }
.pai-type { font-size: .8em; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pai-ref { margin: 2px 0; }
.pai-actions { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
@media (max-width: 760px) {
  .pai-ligne { grid-template-columns: 1fr; gap: 6px; }
  .pai-fleche { display: none; }
  .pai-actions { flex-direction: row; justify-content: flex-end; }
}
.amex-attente { white-space: nowrap; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; line-height: 1.3; }
.amex-attente form { display: inline-flex; align-items: center; gap: 4px; }
.amex-attente form[hidden] { display: none; }
.amex-attente input { width: 5.5em; padding: 1px 6px; }
