/* PALETTE — source unique de vérité.
   Aucune couleur ne doit être écrite ailleurs que dans ce bloc : ni dans le
   reste de cette feuille, ni dans le HTML, ni dans le JS. Changer de thème
   doit rester un changement de valeurs ici, pas une tournée dans dix fichiers. */
:root {
  /* surfaces — blanc cassé pour la page, blanc pur pour ce qui est posé dessus */
  --bg: #f7f8fa; --panel: #ffffff; --panel-2: #f3f4f6; --line: #e4e7ec;
  /* texte — gris très foncé, jamais noir pur. --dim tient 4,8:1 sur blanc (AA),
     pour que « statut attendu » ou « aucune réponse » restent lisibles */
  --txt: #16191f; --muted: #4b5563; --dim: #6b7280;
  /* accent, unique : bleu profond. Onglet actif, liens, bouton principal */
  --accent: #1e40af; --accent-fg: #ffffff; --accent-weak: #eef2ff;
  --accent-line: #c7d2fe;
  /* états : la couleur porte du sens sur un écran de monitoring et de finances.
     Fond très pâle + texte foncé de la même teinte + bordure fine — pas de
     pastilles saturées, qui piquent sur du blanc */
  --ok: #15803d;    --ok-bg: #f0fdf4;    --ok-line: #bbf7d0;
  --warn: #b45309;  --warn-bg: #fffbeb;  --warn-line: #fde68a;
  --bad: #b91c1c;   --bad-bg: #fef2f2;   --bad-line: #fecaca;
  --extra: #6d28d9; --extra-bg: #f5f3ff; --extra-line: #ddd6fe;
  /* divers */
  --overlay: rgba(16,20,28,.40);
  --hover: #f9fafb;
  --line-strong: #d4d9e0;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 28px rgba(16,24,40,.08);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --radius: 6px; --radius-sm: 5px;
  /* diagramme de la page prêteur — deux teintes du même bleu, pas une couleur
     de plus : capital en plein, intérêts en clair */
  --chart-principal: #1e40af; --chart-interest: #93a8d8;
  --chart-grid: #e9ecf1; --chart-axis: #6b7280; --chart-today: #9aa3b2;
  --chart-warn: #d97706;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

header { display: flex; align-items: center; gap: 24px; padding: 14px 22px;
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 10; }
header h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .3px; }
nav { display: flex; gap: 4px; }
nav a { padding: 6px 14px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover { background: var(--panel-2); color: var(--txt); }
nav a.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.spacer { flex: 1; }
.btn { background: var(--panel); border: 1px solid var(--line); color: var(--txt);
  padding: 6px 12px; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); border-color: var(--line-strong); }
.ro { font-size: 11px; color: var(--dim); background: var(--panel-2); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px; font-weight: 500; }

main { padding: 22px; max-width: 1400px; margin: 0 auto; }
h2 { font-size: 16px; margin: 0 0 14px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  margin: 26px 0 10px; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 13px 15px; }
.kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi .value { font-size: 21px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 11px; color: var(--dim); margin-top: 3px; }
.kpi.hl { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.kpi.danger .value { color: var(--bad); }

.banner { border-radius: 6px; padding: 14px 16px; margin-bottom: 20px;
  border: 1px solid var(--bad-line); background: var(--bad-bg); }
.banner h4 { margin: 0 0 6px; font-size: 14px; color: var(--bad); }
.banner p { margin: 0 0 8px; color: var(--txt); }
.banner ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.banner .note { font-size: 12px; color: var(--muted); margin-top: 10px; }

.empty { background: var(--panel-2); border: none; border-radius: 6px;
  padding: 26px; text-align: center; color: var(--dim); }
.empty strong { display: block; color: var(--txt); margin-bottom: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
/* --muted et non --dim : 10 px en gras ne compte pas comme « texte large »,
   il lui faut 4,5:1. Sur le fond d'en-tête, --dim tombait à 4,39:1. */
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600;
  background: var(--panel-2); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle;
  font-variant-numeric: tabular-nums; }
/* Contractuel remplacé par un net : le barré s'efface, le net porte */
td s, .cal-chip s { color: var(--dim); text-decoration-thickness: 1px; }
td strong { color: var(--txt); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.off td { color: var(--dim); }
.scroll { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 500; border: 1px solid transparent; }
.b-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.b-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.b-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.b-dim { background: var(--panel-2); color: var(--muted); }
.b-extra { background: var(--extra-bg); color: var(--extra); border-color: var(--extra-line); }

details { background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  margin-bottom: 10px; }
summary { padding: 11px 14px; cursor: pointer; font-weight: 500; display: flex;
  align-items: center; gap: 10px; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸"; color: var(--muted); }
details[open] > summary::before { content: "▾"; }
details > div { padding: 0 14px 14px; }
details table { border: none; border-top: 1px solid var(--line); border-radius: 0; }

.muted { color: var(--muted); } .dim { color: var(--dim); }
.loading { color: var(--muted); padding: 30px; text-align: center; }

.login { max-width: 340px; margin: 14vh auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); }
.login h1 { font-size: 17px; margin: 0 0 18px; }
.login input { width: 100%; padding: 10px 12px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--panel); color: var(--txt); font-size: 14px; }
.login input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.login button { width: 100%; margin-top: 14px; padding: 10px; border-radius: 5px; border: none;
  background: var(--accent); color: var(--accent-fg); font-weight: 600; cursor: pointer; font-size: 14px; }
.login .err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* --- Bouton d'action en fin de ligne --------------------------------------- */
.btn-sm { padding: 4px 10px; font-size: 12px; }
td.act, th.act { text-align: right; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* --- Confirmation après écriture ------------------------------------------ */
.flash { border: 1px solid var(--ok-line); background: var(--ok-bg); color: var(--txt);
  border-radius: 6px; padding: 11px 14px; margin-bottom: 16px; font-size: 13px; }
.flash.warn { border-color: var(--warn-line); background: var(--warn-bg); }

/* --- Modale de saisie ------------------------------------------------------ */
.backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 22px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 4px; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--txt); }
.modal .sub { margin: 0 0 18px; font-size: 12px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; padding: 9px 11px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--bg); color: var(--txt); font-size: 14px; font-variant-numeric: tabular-nums; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit em { font-style: normal; color: var(--muted); font-size: 12px; font-weight: 600; }

.modal .preview { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.modal .err { margin: 8px 0 0; font-size: 12px; color: var(--bad); min-height: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --- Bascule Liste / Calendrier -------------------------------------------- */
.subnav { display: flex; gap: 4px; margin: -6px 0 16px; }
.subnav a { padding: 5px 13px; border-radius: 6px; color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 500; border: 1px solid var(--line); }
.subnav a:hover { color: var(--txt); background: var(--panel-2); }
.subnav a.on { background: var(--panel-2); color: var(--txt); border-color: var(--accent); }
.ro.rw { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }

/* --- Navigation et bandeau du mois ----------------------------------------- */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title { font-size: 15px; min-width: 150px; text-align: center; text-transform: capitalize; }
.cal-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 13px 15px; margin-bottom: 16px; }
.cal-band .lbl { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cal-band .val { display: block; font-size: 19px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.cal-band .val.hl { color: var(--accent); }
.cal-band .val.pos { color: var(--warn); }
.cal-band .val.neg { color: var(--ok); }
.cal-band .sub { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; }

/* --- Grille mensuelle ------------------------------------------------------ */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-head div { font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); text-align: center; font-weight: 600; }
.cal-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  min-height: 92px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.out { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--accent); }
.cal-day { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: space-between; }
.cal-today { font-size: 9px; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); }

.cal-chip { display: flex; align-items: center; gap: 5px; width: 100%; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 5px; padding: 4px 6px; cursor: pointer; color: var(--txt);
  font: inherit; font-size: 11px; overflow: hidden; }
.cal-chip:hover { border-color: var(--accent); }
.cal-chip .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.cal-chip .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-chip s { color: var(--dim); }
.cal-chip.s-paid { border-left-color: var(--ok); }
.cal-chip.s-paid .dot { background: var(--ok); }
.cal-chip.s-pending { border-left-color: var(--dim); }
.cal-chip.s-pending .dot { background: var(--dim); }
.cal-chip.s-overdue { border-left-color: var(--bad); background: var(--bad-bg); }
.cal-chip.s-overdue .dot { background: var(--bad); }
.cal-chip.s-skipped { opacity: .5; text-decoration: line-through; border-left-color: var(--dim); }
.cal-chip.s-skipped .dot { background: var(--dim); }
.cal-chip.adj { border-color: var(--extra); border-left-color: var(--extra); }

/* --- Panneau latéral ------------------------------------------------------- */
.drawer-back { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw;
  background: var(--panel); border-left: 1px solid var(--line); z-index: 41;
  padding: 20px; overflow-y: auto; box-shadow: var(--shadow); }
.drawer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.drawer h3 { margin: 0 0 4px; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--txt); }
.drawer h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  margin: 22px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer p { margin: 0 0 8px; }

table.kv { width: 100%; border: 1px solid var(--line); }
table.kv td { padding: 7px 11px; font-size: 13px; }
table.kv tr.sep td { border-top: 1px solid var(--line); }
table.kv tr.tot td { background: var(--panel-2); }
table.kv .pos { color: var(--warn); } table.kv .neg { color: var(--ok); }
.warn { color: var(--warn); }

.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn-xs { padding: 2px 7px; font-size: 11px; }

.adjs { list-style: none; margin: 0; padding: 0; }
.adjs li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.adjs li.adj.credit { border-left: 3px solid var(--ok); }
.adjs li.adj.debit { border-left: 3px solid var(--warn); }
.adjs .sens { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.adjs li.credit .sens { color: var(--ok); }
.adjs li.debit .sens { color: var(--warn); }
.adjs .lab { flex: 1; min-width: 120px; }
.adjs .note { flex-basis: 100%; }
.adjs .adj-btns { display: flex; gap: 5px; }

pre.notes { background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 10px; font-size: 11px; color: var(--muted); white-space: pre-wrap;
  word-break: break-word; margin: 0; max-height: 220px; overflow-y: auto; }

/* --- Modales : variantes larges, segment, invariant ------------------------ */
.modal.wide { max-width: 620px; }
.modal.wide table { font-size: 12px; }
.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.check input { margin-top: 2px; }
.seg { display: flex; gap: 6px; }
.seg-b { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 10px; cursor: pointer; color: var(--muted); font: inherit; font-size: 13px; text-align: left; }
.seg-b em { display: block; font-style: normal; font-size: 10px; color: var(--dim); margin-top: 2px; }
.seg-b.on { border-color: var(--accent); color: var(--txt); background: var(--panel-2); }

.inv { border: 1px solid var(--ok-line); background: var(--ok-bg); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px; font-size: 12px; display: grid; gap: 2px; }
.inv.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.inv > span:first-child { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.inv strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.inv em { font-style: normal; color: var(--ok); }
.inv.bad em { color: var(--bad); }
.modal .pos { color: var(--warn); }

@media (max-width: 780px) {
  .cal-cell { min-height: 70px; }
  .cal-chip .who { display: none; }
  .drawer { width: 100%; }
}

/* --- Colonne Actions dans la liste ----------------------------------------- */
table.inst tr.clickable { cursor: pointer; }
table.inst tr.clickable:hover { background: var(--panel-2); }
table.inst td.act { text-align: right; white-space: nowrap; }
table.inst td.act .btn { margin-left: 4px; }

/* --- Contrat verrouillé ---------------------------------------------------- */
.lock { opacity: .55; font-size: 10px; }
.locknote { font-size: 11px; margin: 8px 0 14px; }

/* --- Sélecteur (règlement des intérêts) ------------------------------------ */
.sel { width: 100%; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--bg); color: var(--txt); font: inherit; font-size: 13px; }
.sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.sel:disabled { opacity: .5; cursor: not-allowed; }

/* --- Note métier ----------------------------------------------------------- */
.note-edit { width: 100%; padding: 9px 11px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--bg); color: var(--txt); font: inherit; font-size: 13px; resize: vertical; }
.note-edit:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.note-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11px; }

/* --- Historique d'audit ---------------------------------------------------- */
ul.audit { list-style: none; margin: 0; padding: 0; }
ul.audit li { padding: 8px 10px; border-left: 2px solid var(--line); margin-bottom: 6px;
  font-size: 12px; display: grid; gap: 2px; background: var(--panel-2); border-radius: 0 6px 6px 0; }
ul.audit .when { font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
ul.audit .what { color: var(--txt); }
ul.audit .verb { font-size: 10px; color: var(--dim); font-family: ui-monospace, Menlo, monospace; }

/* --- Page publique prêteur : lignes ajustées ------------------------------- */
tr.adjusted td { border-bottom: none; }
tr.adj-row td { padding-top: 0; }
ul.adj-pub { list-style: none; margin: 0 0 4px; padding: 0; }
ul.adj-pub li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  font-size: 12px; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); }
ul.adj-pub li.credit { border-left-color: var(--ok); }
ul.adj-pub li.debit { border-left-color: var(--warn); }
ul.adj-pub .sens { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; min-width: 92px; }
ul.adj-pub li.credit .sens { color: var(--ok); }
ul.adj-pub li.debit .sens { color: var(--warn); }
ul.adj-pub .lab { flex: 1; min-width: 180px; color: var(--txt); }

/* --- Accessibilité : le focus clavier doit se voir, partout ---------------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ═══ Page prêteur : progression et graphe ═════════════════════════════════ */
.prog { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; }
.prog-head { display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px; font-size: 13px; }
.prog-pct { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); }
.prog-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel-2); }
.prog-bar .seg { display: block; height: 100%; }
.prog-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 22px;
  margin: 12px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.prog-legend li { display: flex; align-items: center; gap: 7px; }
.prog-legend b { color: var(--txt); font-variant-numeric: tabular-nums; }

.sw { width: 10px; height: 10px; border-radius: 2px; flex: none; display: inline-block; }
.s-paid, .sw.s-paid { background: var(--chart-principal); }
.s-todo, .sw.s-todo { background: var(--chart-interest); }
.s-other, .sw.s-other { background: var(--chart-warn); }

.chart { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 20px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 11px;
  color: var(--muted); margin-bottom: 12px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.sw.c-cap { background: var(--chart-principal); }
.sw.c-int { background: var(--chart-interest); }
.sw.c-fut { background: var(--chart-principal); opacity: .42; }
.sw.c-skip { background: var(--warn-bg); border: 1px solid var(--warn); }
.sw.c-adj { background: var(--txt); height: 3px; border-radius: 1px; }
.chart-scroll { overflow-x: auto; }
.chart-svg { display: block; max-width: 100%; height: auto; }
.chart-svg .bar { cursor: default; }
.chart-svg .bar:hover rect[fill^="var"], .chart-svg .bar:focus rect[fill^="var"] { fill-opacity: 1; }
.chart-svg .bar:focus { outline: none; }
.chart-sum { font-size: 11px; color: var(--dim); margin: 10px 0 0; }

.tip { position: absolute; z-index: 60; max-width: 300px; background: var(--txt); color: var(--panel);
  font-size: 11px; line-height: 1.45; padding: 7px 9px; border-radius: var(--radius-sm);
  pointer-events: none; box-shadow: var(--shadow); }

@media (max-width: 600px) {
  .prog-legend { gap: 6px 14px; }
  .chart-svg { max-width: none; }   /* on défile plutôt que d'écraser */
}

/* --- Crédit séjour par prêteur (vue Liste) --------------------------------- */
.credit-box { border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin: 10px 0 4px; background: var(--panel-2); }
.credit-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.credit-head .btn { margin-left: auto; }
ul.sejours { list-style: none; margin: 8px 0 0; padding: 0; }
ul.sejours li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 6px 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 5px; font-size: 12px; }
ul.sejours .when { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 92px; }
ul.sejours .where { flex: 1; min-width: 140px; }
ul.sejours .howmuch { font-weight: 600; font-variant-numeric: tabular-nums; }
ul.sejours .note { flex-basis: 100%; }

/* --- Lien de suivi prêteur ------------------------------------------------- */
/* Poussé à droite du résumé, sans gêner le repli du bloc. */
.share-actions { margin-left: auto; display: flex; gap: 6px; white-space: nowrap; align-items: center; }
.share-actions .btn { text-decoration: none; }
.btn.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }

.share-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin: 10px 0 4px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius); }
.share-row .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 600; }
input.share-url { flex: 1; min-width: 240px; padding: 7px 10px; font-size: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--txt);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
input.share-url:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak); }

@media (max-width: 780px) {
  .share-actions { margin-left: 0; flex-basis: 100%; }
}

/* ═══ Bandeau de tête — vue Prêts / Liste ══════════════════════════════════ */
.hero { display: grid; grid-template-columns: 30% 45% 25%; gap: 0;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
.hero > * { padding: 20px 22px; }
.hero > * + * { border-left: 1px solid var(--line); }

.hero-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--dim); font-weight: 600; }

/* --- Zone 1 : anneau ------------------------------------------------------ */
.hero-ring { display: flex; flex-direction: column; align-items: center; text-align: center; }
.ring-wrap { position: relative; width: 160px; height: 160px; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset 800ms cubic-bezier(.4, 0, .2, 1); }
.ring-mid { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; }
.ring-mid strong { font-size: 32px; font-weight: 600; color: var(--txt);
  font-variant-numeric: tabular-nums; line-height: 1; }
.ring-mid span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.ring-l1 { margin: 14px 0 0; font-size: 14px; font-weight: 600; color: var(--txt);
  font-variant-numeric: tabular-nums; }
.ring-l2 { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ring-l3 { margin: 6px 0 0; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* --- Zone 2 : frise ------------------------------------------------------- */
.hero-time { display: flex; flex-direction: column; justify-content: center; }
.tl-big { font-size: 28px; font-weight: 600; color: var(--txt); margin-top: 10px;
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.tl-sub { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tl-bar { position: relative; height: 8px; border-radius: 999px;
  background: var(--line); margin: 26px 0 8px; }
.tl-done { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px;
  background: var(--accent); }
.tl-now { position: absolute; top: 50%; width: 3px; height: 20px; border-radius: 2px;
  background: var(--txt); transform: translate(-50%, -50%); }
.tl-now::after { content: ''; position: absolute; left: 50%; top: -5px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--txt); transform: translateX(-50%); }
.tl-nowlbl { position: absolute; top: 15px; white-space: nowrap; font-size: 10px;
  font-weight: 600; color: var(--txt); letter-spacing: .2px; }
.tl-ends { display: flex; justify-content: space-between; font-size: 11px;
  margin-top: 20px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* --- Zone 3 : chiffres clés ----------------------------------------------- */
.hero-key { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.kf { display: flex; flex-direction: column; gap: 1px; }
.kf-val { font-size: 19px; font-weight: 600; color: var(--txt);
  font-variant-numeric: tabular-nums; line-height: 1.2; }
.kf-val.bad { color: var(--bad); }
.kf-val.none { color: var(--dim); font-size: 15px; font-weight: 500; }
.kf-sub { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.kf-next .kf-val { font-size: 28px; color: var(--accent); line-height: 1.1; }
.kf-6m .kf-val { font-size: 23px; }
.kf-badge { display: inline-block; padding: 1px 7px; margin-right: 4px; border-radius: 999px;
  background: var(--accent-weak); color: var(--accent); font-weight: 600; font-size: 11px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero > * + * { border-left: none; border-top: 1px solid var(--line); }
  .ring-wrap { width: 120px; height: 120px; }
  .ring-mid strong { font-size: 24px; }
  .tl-big { font-size: 24px; margin-top: 8px; }
  .kf-next .kf-val { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { .ring-fg { transition: none; } }
