/* Suivi Grue — style « registre sans couleur » (achromatic-ledger, tirage 488911031).
   Le chrome reste à l'encre ; la seule teinte (#1d5fbf) va sur la donnée principale : le bénéfice
   cumulé qui monte vers le prix de la grue, et le mois en cours. Son visage : un fond gris acier
   (#f2f4f7) au lieu du gris neutre, et la courbe de remboursement de la grue.

   Grille à 1440 px : 1440 - 240 (menu) - 2 x 24 (marges) = 1152 de contenu.
   12 colonnes de 85 + 11 gouttières de 12 = 1152. Ligne 7 + 5 : 667 + 12 + 473 = 1152. */

:root {
  --ground: #f2f4f7;
  --surface: #ffffff;
  --raised: #eef0f3;
  --active: #e3e6ea;
  --border: #e3e6ea;
  --rule: #eef0f2;
  --control: #cfd3d8;
  --text: #0a0a0a;
  --muted: #5d6167;
  --faint: #6b6f75;
  --primary: #141414;
  --primary-ink: #ffffff;
  --hue: #1d5fbf;
  --accent: #141414;
  --positive: #2e7d32;
  --negative: #c4242a;
  --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #eceef1;  --pill-neutral-ink: #3d3d3d;
  /* charts.js lit ces variables */
  --chart-1: #1d5fbf; --chart-2: #8a8a8a; --chart-muted: #c8ccd2; --chart-mark: #141414;
  --chart-span: 0.06; --grid: #eceef1; --axis-ink: #5d6167; --ink: #0a0a0a;

  /* les quatre associés : une teinte pâle d'identité chacun, à plus de 60 degrés l'une de l'autre */
  --as-1-bg: #e4ecfa; --as-1-ink: #1b3f78;
  --as-2-bg: #e1f2e7; --as-2-ink: #1d5a35;
  --as-3-bg: #f7ebd8; --as-3-ink: #74460f;
  --as-4-bg: #f5e3ee; --as-4-ink: #78234f;

  --font: "Geist", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --fs-title: 24px; --fs-section: 16px; --fs-kpi: 30px; --fs-lead: 36px; --fs-body: 14px; --fs-small: 12px;

  --sidebar-width: 240px;
  --pad: 24px;
  --gap: 12px;
  --card-pad: 20px;
  --radius-card: 8px;
  --radius-control: 6px;
  --control-height: 36px;
  --row-height: 44px;
  --nav-row: 32px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms; --t-hover: 150ms; --t-ui: 200ms;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--hue); outline-offset: 2px; border-radius: 4px; }
h1, h2 { text-wrap: balance; }
button, a, select, input, [data-a] { touch-action: manipulation; -webkit-tap-highlight-color: rgba(29, 95, 191, 0.12); }
[data-a][tabindex] { cursor: pointer; }
.aller-contenu { position: absolute; left: 12px; top: -48px; z-index: 70; padding: 8px 12px; border-radius: 6px; background: var(--primary); color: var(--primary-ink); }
.aller-contenu:focus { top: 12px; }
.feuille .corps { overscroll-behavior: contain; }
select.input { color: var(--text); background-color: var(--surface); }
@media (max-width: 860px) { html { scroll-padding-top: 64px; } }
.num, table, .kpi-value, .chiffre { font-variant-numeric: tabular-nums; }
.dh { color: var(--muted); font-weight: 400; font-size: 0.72em; margin-left: 3px; }
.gris { color: var(--muted); }
.tiret { color: var(--faint); }
.ref { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.visuel-masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.chargement { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); }

/* ---------- coque : menu + canevas ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 16px; overflow: auto; }
.produit { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.produit .marque { width: 28px; height: 28px; flex: none; }
.produit strong { display: block; font-size: 15px; font-weight: 600; line-height: 18px; }
.produit span { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.group-label { margin: 22px 8px 6px; font-size: var(--fs-small); color: var(--faint); }
.nav-item { display: flex; align-items: center; gap: 10px; height: var(--nav-row); padding: 0 10px; border-radius: 8px; color: var(--muted); transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); }
.nav-item .compte { margin-left: auto; font-size: var(--fs-small); color: var(--negative); font-weight: 500; }
.sidebar .bas { margin-top: auto; display: grid; gap: 8px; padding-top: 16px; }
.moi { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.moi div { min-width: 0; }
.moi strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moi span { display: block; color: var(--muted); font-size: var(--fs-small); }
.canvas { min-width: 0; padding: 28px var(--pad) 48px; }
.barre-mobile { display: none; }

.bandeau-demo { margin-bottom: 16px; padding: 10px 14px; border: 1px solid #fde68a; background: var(--pill-warning-bg); color: var(--pill-warning-ink); border-radius: var(--radius-control); font-size: 13px; }

/* ---------- titre ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); font-size: 15px; }
.title-row .sub.alerte { color: var(--text); }
.title-row .sub.alerte::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--negative); vertical-align: 1px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fil { display: inline-flex; gap: 6px; color: var(--muted); margin-bottom: 6px; }
.fil a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- panneaux et grille ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.grid.top { align-items: start; }
.s12 { grid-column: span 12; } .s8 { grid-column: span 8; } .s7 { grid-column: span 7; } .s6 { grid-column: span 6; } .s5 { grid-column: span 5; } .s4 { grid-column: span 4; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); min-width: 0; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.panel .meta { color: var(--muted); font-size: var(--fs-small); }
.panel .pied { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-link { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; cursor: pointer; text-underline-offset: 3px; white-space: nowrap; }
.card-link::after { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; }
.card-link:hover { text-decoration: underline; }
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* ---------- le remboursement de la grue (l'élément propre à ce produit) ---------- */
.rembourse { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 28px; align-items: start; }
.rembourse .lead { font-size: var(--fs-lead); line-height: 40px; font-weight: 700; letter-spacing: -0.02em; }
.rembourse .lead .dh { font-size: 18px; }
.rembourse .phrase { margin-top: 8px; font-size: 15px; line-height: 22px; max-width: 34ch; }
.piste { position: relative; height: 10px; margin: 22px 0 8px; background: var(--raised); border-radius: 999px; }
.piste .rempli { position: absolute; inset: 0 auto 0 0; background: var(--hue); border-radius: 999px; }
.piste .cran { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--surface); }
.piste-legende { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-small); }
.prevision { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--muted); line-height: 20px; }
.prevision strong { color: var(--text); font-weight: 500; }

/* ---------- chiffres clés : une bande divisée, pas de tuiles ---------- */
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi { padding: 16px var(--card-pad); min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: var(--fs-kpi); line-height: 34px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.kpi-value.argent { font-weight: 700; }
.kpi-value.zero { color: var(--muted); }
.kpi-note { margin-top: 4px; font-size: var(--fs-small); color: var(--muted); }
.kpi-note .neg { color: var(--negative); }
.kpi .card-link { margin-top: 6px; font-size: 13px; }

/* ---------- lignes et tableaux ---------- */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 48px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--rule); }
.row .lib { min-width: 0; flex: 1; }
.row .lib strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .lib span { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .val .sous { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 18px; }
/* le graphique mensuel reste à l'encre : la seule teinte de l'écran est la courbe de remboursement */
#ch-mois { --chart-1: var(--text); --chart-muted: #c3c8cf; }
.row.cliquable { cursor: pointer; }
.row.cliquable:hover .lib strong { text-decoration: underline; text-underline-offset: 3px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 36px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th:first-child, td:first-child { padding-left: 0; } th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; white-space: nowrap; }
td .sub { display: block; font-size: var(--fs-small); color: var(--muted); line-height: 18px; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td:first-child strong { text-decoration: underline; text-underline-offset: 3px; }
tr.mois td { padding-top: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-weight: 600; }
tr.mois td.n { font-weight: 500; }
td strong { font-weight: 500; }
.moins { color: var(--text); }
.plus { color: var(--positive); }

.pill { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* les associés : une pastille d'initiale à leur teinte */
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; font-size: 13px; font-weight: 600; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.avatar.a1 { background: var(--as-1-bg); color: var(--as-1-ink); }
.avatar.a2 { background: var(--as-2-bg); color: var(--as-2-ink); }
.avatar.a3 { background: var(--as-3-bg); color: var(--as-3-ink); }
.avatar.a4 { background: var(--as-4-bg); color: var(--as-4-ink); }
.associes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.associe header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.associe header strong { font-size: var(--fs-section); font-weight: 600; }
.associe dl { display: grid; gap: 0; }
.associe dl > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--rule); }
.associe dt { color: var(--muted); }
.associe dd { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.associe .fort dd { font-weight: 700; }
.jauge { position: relative; height: 6px; margin: 4px 0 4px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.jauge span { position: absolute; inset: 0 auto 0 0; background: var(--text); border-radius: 999px; }
.jauge-leg { display: flex; justify-content: space-between; font-size: var(--fs-small); color: var(--muted); }

/* ---------- boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { background: #2b2b2b; }
.btn.danger { color: var(--negative); border-color: #e9b9bb; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: 1; color: var(--faint); cursor: not-allowed; background: var(--raised); }
.btn svg { width: 16px; height: 16px; }

.segmented { display: inline-flex; width: max-content; max-width: 100%; padding: 2px; border-radius: 8px; background: var(--raised); }
.segmented button { height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); border-color: var(--border); }

/* occupation de la grue : une ligne par location sur l'axe du temps, les trous = la grue à l'arrêt */
.occupation { position: relative; }
.occ-ligne { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 12px; height: 40px; }
.occ-ligne .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ-piste { position: relative; height: 22px; }
.occ-barre { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--text); color: #fff; font-size: 12px; line-height: 22px; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.occ-barre.ouverte { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.occ-barre.avenir { background: var(--surface); color: var(--text); border: 1px dashed var(--control); line-height: 20px; }
.occ-axe { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; margin-top: 6px; }
.occ-axe .graduations { position: relative; height: 18px; color: var(--muted); font-size: var(--fs-small); }
.occ-axe .graduations span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.occ-axe .graduations span:first-child { transform: none; }
.occ-jour { position: absolute; top: -9px; bottom: -9px; width: 2px; margin-left: -1px; background: var(--hue); }
@media (max-width: 860px) { .occ-ligne, .occ-axe { grid-template-columns: 96px minmax(0, 1fr); } }
.filtres { display: flex; align-items: center; gap: 8px; margin-bottom: var(--gap); flex-wrap: wrap; }
.filtres .espace { flex: 1; }

.form { display: grid; gap: 16px; }
.form .deux { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.field label, .field .label { font-weight: 500; }
.field .hint { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
select.input { appearance: none; padding-right: 32px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5l3-3' fill='none' stroke='%235d6167' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") right 12px center / 12px no-repeat; }
.input::placeholder { color: var(--faint); }
.input:focus-visible { outline: 2px solid var(--hue); outline-offset: 0; border-color: transparent; }
.input.montant { text-align: right; font-variant-numeric: tabular-nums; }
.raccourcis { display: flex; gap: 6px; flex-wrap: wrap; }
.raccourcis button { height: 28px; padding: 0 10px; border: 1px solid var(--control); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13px; }
.raccourcis button:hover { background: var(--raised); }
.erreur-champ { color: var(--negative); font-size: 13px; }
.resume { padding: 12px 14px; border-radius: var(--radius-control); background: var(--raised); line-height: 20px; }
.resume strong { font-weight: 600; }

/* ---------- feuilles (fenêtres) ---------- */
.voile { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(10, 12, 16, 0.32); }
.feuille { width: min(560px, 100%); max-height: calc(100svh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 10px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18); }
.feuille.large { width: min(760px, 100%); }
.feuille > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.feuille > header h2 { font-size: 18px; line-height: 24px; font-weight: 600; }
.feuille .corps { padding: 18px 20px; overflow: auto; }
.feuille > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--rule); }
.feuille > footer .gauche { margin-right: auto; }
.fermer { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--muted); }
.fermer:hover { background: var(--raised); color: var(--text); }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 8px; background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.toast.erreur { background: var(--negative); }

.empty { display: grid; place-items: center; min-height: 88px; padding: 16px; border: 1px dashed #d8dce1; border-radius: var(--radius-control); color: var(--muted); text-align: center; gap: 10px; }
.rows .empty, .grid > .empty { grid-column: 1 / -1; width: 100%; }
.erreur-bloc { padding: 14px; border-radius: var(--radius-control); background: var(--pill-negative-bg); color: var(--pill-negative-ink); }

/* premier lancement : les étapes à faire */
.etapes { display: grid; gap: 0; }
.etape { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.etape + .etape { border-top: 1px solid var(--rule); }
.etape .coche { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--control); display: grid; place-items: center; }
.etape.faite .coche { background: var(--text); border-color: var(--text); color: #fff; }
.etape .lib { flex: 1; }
.etape .lib span { display: block; color: var(--muted); font-size: 13px; }

/* ---------- connexion ---------- */
.connexion { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.connexion .boite { width: min(400px, 100%); }
.connexion .produit { padding: 0 0 28px; }
.connexion h1 { font-size: 22px; line-height: 28px; font-weight: 600; margin-bottom: 6px; }
.connexion p.gris { margin-bottom: 22px; }
.connexion .btn.primary { width: 100%; height: 44px; }
.connexion .autre { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.points { display: flex; justify-content: center; gap: 14px; margin: 8px 0 10px; }
.points span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text); }
.points span.plein { background: var(--text); }
.points.secousse { animation: secousse 360ms var(--ease-out); }
@keyframes secousse { 25% { transform: translateX(-8px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }
.clavier { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.clavier button { height: 60px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 22px; font-weight: 500; cursor: pointer; font-variant-numeric: tabular-nums; }
.clavier button:active { background: var(--active); }
.clavier button.vide { visibility: hidden; }
.message-pin { min-height: 20px; text-align: center; color: var(--negative); }

.marque-grande { display: block; width: 44px; height: 44px; }

/* ---------- message WhatsApp ---------- */
.message { white-space: pre-wrap; padding: 16px; border-radius: var(--radius-control); background: var(--raised); font-size: 14px; line-height: 21px; }
.panel .pied { flex-wrap: wrap; }

/* ---------- tablette et téléphone : le menu se replie ---------- */
@media (max-width: 1100px) {
  .associes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rembourse { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; background: var(--surface); transform: translateX(-100%); transition: transform var(--t-ui) var(--ease-out); visibility: hidden; }
  .sidebar.ouvert { transform: none; visibility: visible; }
  .sidebar .fermer-menu { display: grid; }
  .barre-mobile { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 6px; background: var(--ground); border-bottom: 1px solid var(--border); }
  .barre-mobile .titre { flex: 1; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .barre-mobile .menu { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
  .barre-mobile .btn { height: 36px; padding: 0 12px; }
  .canvas { padding: 18px 16px 40px; }
  .grid > * { grid-column: 1 / -1 !important; }
  .title-row { flex-wrap: wrap; align-items: flex-start; }
  .title-row h1 { font-size: 22px; }
  .title-row .actions .btn.primary { display: none; }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 22px; line-height: 28px; }
  .rembourse .lead { font-size: 30px; line-height: 34px; }
  .form .deux { grid-template-columns: 1fr; }
  .voile { padding: 0; place-items: end stretch; }
  .feuille, .feuille.large { width: 100%; max-height: 92svh; border-radius: 14px 14px 0 0; }
  .feuille > footer { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .feuille > footer .btn { flex: 1; height: 44px; }
  .feuille > footer .gauche { flex: none; }
  /* les tableaux deviennent des lignes à deux niveaux */
  table.liste thead { display: none; }
  table.liste, table.liste tbody, table.liste tr, table.liste td { display: block; }
  table.liste tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  table.liste td { padding: 0; border: 0; }
  table.liste td.cache-tel { display: none; }
  table.liste td.n { text-align: right; }
  table.liste td.l2 { grid-column: 1 / -1; color: var(--muted); font-size: 13px; margin-top: 2px; }
  table.liste tr.mois { padding: 18px 0 6px; border-bottom: 1px solid var(--border); }
  table.liste tr.mois td { border: 0; padding: 0; }
}
.sidebar .fermer-menu { display: none; position: absolute; top: 14px; right: 12px; }
@media (min-width: 861px) { .seul-tel { display: none !important; } }
@media (max-width: 480px) {
  .associes { grid-template-columns: minmax(0, 1fr); }
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: 1; padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; } }
@media print {
  .sidebar, .barre-mobile, .actions, .toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
