/* ============================================================================
   TrustFlow — design system « Titane » (refonte 04/09, variante C validée)
   Albert Sans (variable) + Spline Sans Mono. Gris Apple, bleu système en seul
   accent, chrome sombre, pilules, pictogrammes. KISS : peu de mots, tout guidé.
   ========================================================================== */
:root {
  --font-display: 'Albert Sans', system-ui, -apple-system, sans-serif;
  --font-sans: 'Albert Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, monospace;

  /* Contraste durci (remontée 06/09) : tout texte porteur d'information tient
     le AA sur fond clair — les gris pâles sont réservés au décoratif. */
  --ink: #16202c;          /* texte principal (encre froide) */
  --ink-soft: #2e3a48;
  --muted: #4f5b69;        /* labels & méta LUS (4.5:1 sur blanc) */
  --faint: #82909f;        /* décoratif uniquement */
  --line: #dbe5ea;         /* hairline bleutée */
  --line-2: #bfd0da;
  /* « Thème montagne » (remontée 09/09) : fond glacier bleuté, barres latérales
     plus sombres en bleu translucide, chrome bleu-nuit, accents électriques. */
  --bg: #eef4f7;           /* fond appli — glacier */
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --surface-3: #e9eef6;
  --chrome: #6f9db6;       /* bandeau GLACIER (palette 11/09 : #608FA6→#80B3CC) */
  --chrome-soft: rgba(255,255,255,.34);
  --chrome-txt: #16323f;
  --chrome-mut: #2d5265;
  --panel: linear-gradient(180deg, rgba(45,86,106,.15), rgba(45,86,106,.24)); /* barres latérales */
  --panel-line: #a9c3d2;
  --panel-card: rgba(255,255,255,.84);
  --electric: rgba(63,114,166,.15); /* bleu acier translucide (états) */

  --primary: #3f72a6;      /* bleu ACIER élégant — remplissages (boutons, pastilles) */
  --primary-d: #305a86;
  --primary-wash: #e9eff7;
  --link: #2d5f91;         /* bleu TEXTE — lisible sur blanc (AA) */
  --gold: #3f72a6;         /* hérité : les anciens accents laiton suivent le bleu */
  --gold-wash: #e9eff7;

  --ok: #1d7a3e;  --ok-wash: #e4f8ea;
  --warn: #a34a00; --warn-wash: #fff3e0;
  --error: #c22f24; --error-wash: #fdecea;
  --info: #2d5f91; --info-wash: #e9eff7;

  /* Rayons adoucis + courbe d'animation commune (passe « confort » 03/09). */
  --r: 14px; --r-sm: 10px; --r-lg: 18px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --sh-sm: 0 1px 3px rgba(0,0,0,.06);
  --sh: 0 8px 24px -14px rgba(0,0,0,.18);
  --sh-lg: 0 18px 48px -20px rgba(0,0,0,.28);
  --ring: 0 0 0 3px rgba(63,114,166,.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Navigation clavier : focus toujours repérable, sans polluer le clic souris. */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px;
}
/* Champs de saisie : anneau doux au focus (confort, cf. macOS) — pas d'outline. */
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary) !important; box-shadow: var(--ring);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: 13.5px; line-height: 1.55;
  font-feature-settings: 'tnum' 0;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.num, .bal-amt, td.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
::selection { background: var(--primary-wash); }

/* ---------- Topbar ---------------------------------------------------------*/
/* Chrome SOMBRE (variante « Titane ») : la barre tient l'écran comme un coffre
   tient les valeurs — tout le reste est clair et calme. */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 2.5vw, 30px); height: 60px;
  background: linear-gradient(100deg, #5d8ba4, #74a3bd 55%, #8fbcd4); /* glacier */
  color: #16323f;
  border-bottom: 1px solid rgba(20,50,70,.22);
  position: sticky; top: 0; z-index: 20;
}
/* Le titre est un lien de retour à « Mes opérations » (03/09). */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; border-radius: var(--r-sm); }
a.brand:hover h1, a.brand:hover .tagline { color: #0b2836; }
.brand .emblem { width: 29px; height: 29px; flex: none; }
.topbar h1 {
  font-family: var(--font-sans); font-size: 18px; font-weight: 700;
  letter-spacing: -.02em; line-height: 1; color: #12303f; transition: color .15s var(--ease);
}
.topbar h1 .sf-dot { color: #fff; }
.tagline { margin: 3px 0 0; font-size: 10.5px; color: var(--chrome-mut); letter-spacing: .04em; transition: color .15s var(--ease); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--chrome-txt); font-size: 12px; font-weight: 500; cursor: pointer; user-select: none; }
.switch input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.badge-local { background: var(--chrome-soft); color: var(--chrome-txt); }
.badge-local:hover { background: rgba(255,255,255,.52); color: #0b2836; }

/* Retour « Mes opérations » : un vrai bouton-pilule, plus un lien gris perdu. */
.btn-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); text-decoration: none; border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 999px; padding: 4px 13px; margin-bottom: 9px; transition: .12s; }
.btn-back:hover { border-color: var(--ink-soft); color: var(--ink); background: var(--surface-2); }

.op-actions { display: flex; align-items: center; gap: 10px; }
/* Boutons posés SUR le chrome sombre. */
.btn-light { background: var(--chrome-soft); border-color: transparent; color: var(--chrome-txt); }
.btn-light:hover { background: rgba(255,255,255,.55); border-color: transparent; color: #0b2836; }
/* Indicateur d'enregistrement automatique (remplace le bouton Enregistrer). */
.save-state { font-size: 12px; color: var(--chrome-mut); white-space: nowrap; }
.export-wrap { position: relative; }
.export-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--sh-lg); padding: 6px; min-width: 250px; z-index: 40; display: flex; flex-direction: column; animation: menuin .16s var(--ease); }
@keyframes menuin { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.export-menu button { text-align: left; background: transparent; border: none; padding: 9px 11px; border-radius: var(--r-sm); cursor: pointer; font-family: var(--font-sans); font-size: 13px; color: var(--ink); }
.export-menu button:hover { background: var(--surface-2); }

/* Mes opérations (accueil) */
.ops-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-top: 22px; }
.op-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 17px 19px; box-shadow: var(--sh-sm); cursor: pointer; transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease); text-align: left; }
.op-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--sh); }
.op-card:active { transform: translateY(0); transition-duration: .06s; }
.op-card .oc-name { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.op-card .oc-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(12,26,43,.42); display: flex; align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(7px); animation: ovin .18s ease; }
.modal-overlay[hidden] { display: none; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-lg); padding: 26px; width: 440px; max-width: 92vw; max-height: 88vh; overflow-y: auto; animation: modalin .24s var(--ease); }
@keyframes ovin { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalin { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.modal h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 14px; }
.fm-lbl { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.fm-lbl input, .fm-lbl select { width: 100%; margin-top: 5px; padding: 9px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-sans); font-size: 13.5px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); }
.fm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.modal-lg { width: 520px; }
/* Aperçu « Coller depuis Excel » (11/09) : large, tableau + mapping par colonne. */
.modal-xl { width: 780px; }
.pi-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pi-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.pi-chip.ok { background: var(--ok-wash); color: var(--ok); }
.pi-chip.new { background: var(--primary-wash); color: var(--link); }
.pi-chip.skip { background: var(--warn-wash); color: var(--warn); }
.pi-body { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: auto; max-height: 46vh; }
.pi-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pi-table th { padding: 6px 8px; background: var(--surface-3); position: sticky; top: 0; }
.pi-table th select { width: 100%; padding: 5px 6px; border: 1px solid var(--line-2); border-radius: 7px; font: 600 11.5px var(--font-sans); color: var(--link); background: var(--surface); }
.pi-table td { padding: 6px 9px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.pi-table td.num { text-align: right; font-family: var(--font-mono); font-size: 11.5px; }
.pi-table tr.pi-bad td { background: var(--error-wash); color: var(--error); }
.pi-badge-new { font-size: 9.5px; font-weight: 700; color: var(--link); background: var(--primary-wash); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.pi-notes { font-size: 12px; color: var(--muted); margin: 10px 2px 6px; line-height: 1.6; }
.pi-notes b { color: var(--warn); }
.fx-paste-hint { font-size: 11px; color: var(--faint); white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
/* Modal « partie prenante » : lignes de comptes */
.cat-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.acct-rows { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.acct-row { display: flex; gap: 7px; align-items: center; }
.acct-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-sans); font-size: 13px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 400; }
.acct-row .acct-del { flex: none; width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
.acct-row .acct-del:hover { color: var(--error); border-color: var(--error); }
.acct-add { align-self: flex-start; margin-top: 9px; }
/* Modal « lien d'invitation » (data room) */
.lm-row { display: flex; gap: 8px; }
.lm-row .lm-link { flex: 1; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); background: var(--surface-2); min-width: 0; }
.lm-warn { background: var(--warn-wash); color: var(--warn); border-radius: var(--r-sm); padding: 8px 11px; font-size: 12.5px; font-weight: 500; margin-bottom: 10px; }
.lm-sent { background: var(--ok-wash); color: var(--ok); border-radius: var(--r-sm); padding: 8px 11px; font-size: 12.5px; font-weight: 500; margin-bottom: 10px; }
/* Sollicitation d'une partie : envoi par TrustFlow ou transmission manuelle. */
.inv-choice { display: grid; gap: 8px; }
.inv-choice .btn { width: 100%; }

.fx-add { font-size: 12px; padding: 5px 11px; }
/* Séparateur de section dans le tableau des flux */
.fx-table tr.fx-section td { background: var(--surface-3); font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--ink-soft); border-top: 2px solid var(--line-2); letter-spacing: .01em; }

/* ---------- Buttons --------------------------------------------------------*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; border: 1px solid transparent; border-radius: 999px;
  padding: 9px 18px; font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  letter-spacing: .005em;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease),
    transform .16s var(--ease), box-shadow .16s var(--ease);
}
/* Micro-interaction sobre : l'action se soulève d'un souffle, puis se pose. */
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.995); transition-duration: .06s; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--sh-sm); }
.btn-primary:hover { background: var(--primary-d); box-shadow: 0 8px 18px -10px rgba(63,114,166,.55); }
/* Bouton secondaire : aplat gris discret, sans bordure (KISS 28/08). */
.btn-ghost { background: var(--surface-3); border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #e8ecf1; border-color: transparent; color: var(--ink); }
/* Action tertiaire : simple lien — zéro chrome. */
.btn-link { background: none; border: none; padding: 0; font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--link); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* Large : le constructeur profite de tout l'écran (remontée 03/09) ; le reste
   des onglets respire aussi, sans jamais coller aux bords. */
main { padding: clamp(18px, 2.6vw, 32px) clamp(14px, 2.2vw, 28px) 48px; max-width: 1600px; margin: 0 auto; }

/* ---------- Dropzone -------------------------------------------------------*/
.dropzone {
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
  padding: 64px 24px; text-align: center; transition: .2s; box-shadow: var(--sh);
}
.dropzone.drag { border-color: var(--primary); background: var(--primary-wash); }
.dz-icon { font-size: 30px; color: var(--primary); font-weight: 300; }
.dropzone h2 { font-family: var(--font-display); font-size: 23px; margin: 14px 0 8px; font-weight: 500; }
.dropzone p { color: var(--muted); }

/* ---------- Tabs — SEGMENTED CONTROL (idiome Apple, variante C) ------------*/
.tabs { display: inline-flex; gap: 2px; background: rgba(45,86,106,.12); padding: 3px; border-radius: 12px; margin-bottom: 22px; overflow-x: auto; max-width: 100%; }
.tab {
  background: transparent; border: none; padding: 9px 17px; cursor: pointer; border-radius: 9px;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
  letter-spacing: .005em; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.tabpane { display: none; }
.tabpane.active { display: block; animation: fade .28s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- Section titles -------------------------------------------------*/
.replay-side h3, .builder-side h3, .builder-palette h3 {
  font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -.01em;
}

/* ---------- Panneaux (rejeu, constructeur) ----------------------------------*/
.replay-main, .replay-side, .builder-palette, .builder-main, .builder-side {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm);
}
/* Barres LATÉRALES en bleu translucide plus sombre (thème montagne 09/09) :
   la surface de travail reste blanche, les rives se teintent. */
.builder-palette, .builder-side, .replay-side {
  background: var(--panel), var(--surface); border-color: var(--panel-line);
}
.hint { font-size: 11.5px; color: var(--faint); margin-left: auto; }
.graph { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden;
  background: radial-gradient(circle at center, #e4ecf7 1px, transparent 1px) 0 0 / 24px 24px, var(--surface); }
/* Rejeu : hauteur généreuse + DÉFILEMENT (le SVG garde sa taille naturelle,
   molette = défiler, pincement/double-clic = zoomer). */
.graph-replay { height: min(64vh, 640px); overflow-y: auto; }


.tag { display: inline-block; padding: 1.5px 8px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.tag.error { background: var(--error-wash); color: var(--error); }
.tag.warn { background: var(--warn-wash); color: var(--warn); }
.tag.info { background: var(--info-wash); color: var(--info); }
.tag.ok { background: var(--ok-wash); color: var(--ok); }

/* ---------- Replay ---------------------------------------------------------*/
.replay-layout { display: grid; grid-template-columns: 1fr 330px; gap: 16px; }
.replay-main, .replay-side { padding: 18px; }
.replay-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.replay-controls .step-label { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scrubber { width: 100%; margin-bottom: 10px; accent-color: var(--primary); }
/* Bandeau d'étape du rejeu (20/09) : au-dessus du graphe, montant en grand. */
.replay-step-info { margin: 2px 0 10px; padding: 11px 16px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.replay-step-info.breach { background: var(--error-wash); border-color: #f1c9c4; }
.rsi-main { display: flex; align-items: center; gap: 14px; min-height: 38px; }
.rsi-n { flex: none; font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--link);
  background: var(--primary-wash); border-radius: 999px; padding: 5px 13px; font-variant-numeric: tabular-nums; }
.rsi-n small { font-size: 11px; color: var(--muted); font-weight: 500; }
.rsi-txt { min-width: 0; }
.rsi-path { font-weight: 700; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rsi-arrow { color: var(--link); font-weight: 400; padding: 0 2px; }
.rsi-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rsi-amt { margin-left: auto; flex: none; font-family: var(--font-mono); font-size: 19px; font-weight: 600; color: #2f5b88; font-variant-numeric: tabular-nums; }
.replay-step-info.breach .rsi-amt { color: var(--error); }
.rsi-breach { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--error); }
/* Trait de l'étape en cours : pointillés en marche (l'argent circule). */
.replay-cur { animation: rp-dash 1.1s linear infinite; }
@keyframes rp-dash { to { stroke-dashoffset: -28; } }
.balance-panel { margin-top: 10px; }
.bal-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); margin-bottom: 5px; background: var(--panel-card); border: 1px solid var(--panel-line); font-size: 12.5px; }
.bal-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-row .bal-amt { font-weight: 700; white-space: nowrap; flex: none; }
.bal-row.neg { background: var(--error-wash); border-color: #f1c9c4; }
.bal-row.neg .bal-amt { color: var(--error); }
.bal-row.active { outline: 2px solid var(--primary); outline-offset: -1px; }

/* ---------- Builder --------------------------------------------------------*/
.builder-layout { display: grid; grid-template-columns: 256px 1fr 268px; gap: 16px; align-items: start; }
/* Modes d'affichage : le tableau et le schéma sont deux vues de la MÊME
   séquence — on choisit laquelle occupe l'écran, et dans quel ordre. */
.builder-main { display: flex; flex-direction: column; min-width: 0; /* le canvas scrolle au lieu de faire déborder la grille */ }
.view-modes { display: flex; gap: 4px; align-items: center; margin-bottom: 12px; order: 0; }
.vm-btn, .vm-swap { font-family: var(--font-sans); font-size: 12px; font-weight: 600; padding: 7px 14px;
  border: 1px solid transparent; background: var(--surface-3); color: var(--ink-soft);
  border-radius: 999px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.vm-btn:hover, .vm-swap:hover { background: var(--surface-3); color: var(--ink); }
.vm-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.vm-swap { padding: 7px 12px; font-size: 13px; line-height: 1; }
/* Zoom du plan : segment pilule − / ⤢ / + (le pincement marche aussi). */
.zoom-seg { display: inline-flex; margin-left: auto; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.zoom-seg button { border: none; background: transparent; width: 32px; padding: 7px 0; font: 600 14px/1 var(--font-sans); color: var(--ink-soft); cursor: pointer; transition: background .14s, color .14s; }
.zoom-seg button:hover { background: var(--electric); color: var(--ink); }
.zoom-seg #zoomFit { font-size: 12px; }
#builderVerdict { order: 1; }
#builderTip { order: 2; }
#builderCanvas { order: 3; }
#builderSeq { order: 4; }
/* Intervertir : le tableau passe au-dessus du schéma. */
.builder-main.swapped #builderCanvas { order: 5; }
.builder-main.swapped #builderSeq { order: 3; margin-top: 0; }
.builder-main.swapped #builderCanvas { margin-top: 16px; }
.builder-main.mode-table #builderCanvas, .builder-main.mode-graph #builderSeq { display: none; }
/* Vue tableau seule : l'aide « cliquez l'émetteur puis le destinataire » parle
   du plan — inutile quand il est masqué. */
.builder-main.mode-table #builderTip { display: none; }
/* Vue schéma seule : le canvas prend TOUTE la hauteur libérée par le tableau. */
.builder-main.mode-graph #builderCanvas { height: calc(100vh - 285px); min-height: 520px; }
.builder-palette, .builder-main, .builder-side { padding: 19px; }
.builder-palette h3, .builder-side h3 { margin-bottom: 8px; }
.builder-palette #paletteSearch { width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-sans); font-size: 12.5px; margin: 10px 0; }
.na-form { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px; margin-bottom: 10px; background: var(--surface-2); }
.na-form input, .na-form select { width: 100%; padding: 7px; border: 1px solid var(--line-2); border-radius: 6px; font-family: var(--font-sans); font-size: 12.5px; margin-top: 4px; }
.na-lbl { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 9px; }
.na-actions { display: flex; gap: 6px; margin-top: 10px; }
.na-actions .btn { flex: 1; padding: 7px; font-size: 12px; }
.palette-list { max-height: calc(100vh - 340px); min-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.palette-group { font-size: 10px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; margin: 10px 0 3px; }
.palette-group:first-child { margin-top: 0; }
/* En-tête de groupe = entité (construction locale ou data room) : nom + catégorie + « + compte » */
.palette-group.ent { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; text-transform: none; letter-spacing: 0; margin-top: 13px; }
.palette-group.ent .pg-name { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0; }
.palette-group.ent .pg-type { font-size: 9px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin-left: 6px; }
.palette-group.ent .pg-add { flex: none; border: 1px solid var(--line-2); background: var(--surface); color: var(--link); border-radius: 5px; padding: 2px 7px; font-size: 10.5px; font-weight: 600; cursor: pointer; font-family: var(--font-sans); text-transform: none; letter-spacing: 0; }
.palette-group.ent .pg-add:hover { background: var(--primary-wash); border-color: var(--primary); }
.palette-chip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; font-size: 12.5px; font-weight: 500; background: var(--surface); transition: .12s; min-width: 0; }
.palette-chip:hover { background: var(--surface-2); border-color: var(--line-2); transform: translateX(2px); }
.palette-chip.placed { opacity: .42; }
.palette-chip .pdot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.palette-chip .pc-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Statut RIB : simple point coloré (l'info-bulle précise) — un badge texte par
   compte devenait criard sur une grosse palette. */
.rib-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.rib-dot.ok { background: var(--ok); }
.rib-dot.ko { background: #e4a33c; }
.builder-seed { display: flex; gap: 8px; margin-top: 12px; }
.builder-seed .btn { flex: 1; padding: 7px; font-size: 12px; }

.builder-verdict { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px; border-radius: var(--r-sm); font-weight: 700; margin-bottom: 10px; font-size: 13.5px; border: 1px solid transparent; }
.builder-verdict .vd-total { font-weight: 500; font-size: 12.5px; opacity: .85; font-variant-numeric: tabular-nums; }
.builder-verdict.ok { background: var(--ok-wash); color: #14612f; border-color: #cce6d4; }
.builder-verdict.bad { background: var(--error-wash); color: #8f1d17; border-color: #f1c9c4; }
.builder-tip { margin-bottom: 10px; padding: 9px 13px; border-radius: var(--r-sm); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); line-height: 1.55; }
.builder-tip.selecting { background: var(--gold-wash); border-color: #e6d6b0; color: #6f5114; display: flex; align-items: center; gap: 10px; }
.builder-tip button { margin-left: auto; border: 1px solid currentColor; background: transparent; border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 600; cursor: pointer; color: inherit; }

/* Hauteur asservie au VIEWPORT (l'écran est enfin optimisé) : en écran scindé
   le plan et le tableau se partagent la hauteur ; en schéma seul il prend tout. */
.builder-canvas { position: relative; height: clamp(380px, calc(100vh - 445px), 760px); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: auto;
  background: radial-gradient(circle at center, #e4ecf7 1px, transparent 1px) 0 0 / 20px 20px, var(--surface); }
.builder-canvas svg { display: block; }
.canvas-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--muted); pointer-events: none; }
.canvas-hint[hidden] { display: none; }
.canvas-hint .ch-ic { font-size: 34px; color: var(--line-2); font-weight: 300; }
.canvas-hint button { pointer-events: auto; }

/* nœuds & liens du constructeur (SVG) — refonte 03/09 : cartes calmes, une
   pastille « n° · montant » par lien, commandes révélées au survol. */
.bk-node { cursor: grab; }
.bk-rect { fill: #fff; stroke: var(--line-2); stroke-width: 1;
  filter: drop-shadow(0 1px 2px rgba(12,26,43,.07)); transition: filter .14s; }
.bk-rect.breach { stroke: var(--error) !important; fill: var(--error-wash); }
.bk-rect.selected { stroke: var(--primary) !important; stroke-width: 2 !important; stroke-dasharray: 6 3; }
.bk-node:hover .bk-rect { stroke: #b9c4cf; filter: drop-shadow(0 5px 14px rgba(12,26,43,.16)); }
.bk-name { font-family: var(--font-sans); font-size: 12px; font-weight: 600; fill: var(--ink); }
.bk-bal { font-family: var(--font-mono); font-size: 10.5px; }
.bk-inport, .bk-outport { fill: #fff; stroke-width: 1.4; }
.bk-del { fill: #fff; stroke: var(--line-2); cursor: pointer; }
/* Gestes de glisser-déposer (18/10) : aperçu du lien, cible survolée, fantôme S/€, poignée d'entité */
.bk-temp { stroke: var(--primary); stroke-width: 2.5; stroke-dasharray: 6 4; fill: none; pointer-events: none; }
.bk-rect.drop-target { stroke: var(--primary) !important; stroke-width: 2.5 !important; fill: var(--primary-wash); }
.bk-ghost { fill: #ff9f0a; stroke: #fff; stroke-width: 1.5; pointer-events: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.bk-ghosttxt { font-family: var(--font-sans); font-size: 9.5px; font-weight: 800; fill: #fff; pointer-events: none; }
.bk-outportg:hover .bk-outport { stroke-width: 2.4; r: 8; }
.bk-srcg.on, .bk-balg.on { cursor: grab; }
.ent-handle { fill: transparent; cursor: grab; }
.ent-handle:hover { fill: rgba(63,114,166,.06); }
g.ent.dragging .ent-box { stroke-opacity: .8; stroke-width: 1.5; }
g.ent.dragging .ent-handle { cursor: grabbing; }
.builder-main.dropping { outline: 2px dashed var(--primary); outline-offset: -4px; background: var(--primary-wash); }
.dr-wrap.dropping { outline: 2px dashed var(--primary); outline-offset: 6px; border-radius: var(--r); background: var(--primary-wash); }
.dr-drophint { margin: -8px 0 14px; }
/* Sécurité : MFA, sessions, step-up */
.code-inp { width: 100%; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 22px; letter-spacing: .18em; text-align: center; color: var(--ink); background: var(--surface); }
.sec-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r); background: var(--info-wash); border: 1px solid #c7d8ea; font-size: 13px; }
.sec-banner.warn { background: var(--warn-wash); border-color: #efd9b0; }
.sec-block { padding: 12px 0; border-top: 1px solid var(--line); }
.sec-block:first-of-type { border-top: 0; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sess-list { display: flex; flex-direction: column; gap: 8px; }
.sess-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.mfa-qr { display: flex; gap: 16px; align-items: center; }
.mfa-qr svg { width: 168px; height: 168px; flex: none; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.mfa-key { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mfa-key code { font-size: 12px; word-break: break-all; }
.rc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0 4px; }
.rc-list code { padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13px; text-align: center; }
.palette-group[draggable] { cursor: grab; }
.ent-bal[draggable] { cursor: grab; }
.ent-bal[draggable]:hover { border-color: var(--primary); box-shadow: var(--sh-sm); }
.fx-table tr[draggable] td.fx-seq { cursor: grab; }
.fx-table tr.dragging td { opacity: .45; }
.fx-table tr.drop-before td { box-shadow: inset 0 2px 0 var(--primary); }
.fx-table tr.drop-after td { box-shadow: inset 0 -2px 0 var(--primary); }
/* Saisie directe dans le tableau (brief 01/11) */
.fx-cell { position: relative; }
.fx-table td[data-drop] { transition: background .12s, box-shadow .12s; }
.fx-table td.drop-target { background: var(--primary-wash) !important; box-shadow: inset 0 0 0 2px var(--primary); border-radius: 6px; }
.fx-table td.drop-bad { background: var(--error-wash) !important; box-shadow: inset 0 0 0 2px var(--error); border-radius: 6px; cursor: not-allowed; }
.fx-acct-empty { color: var(--faint); font-style: italic; font-size: 12px; }
.fx-table td.fx-err { box-shadow: inset 0 0 0 2px var(--error); border-radius: 6px; }
.fx-errmsg { font-size: 11px; color: var(--error); margin-top: 3px; font-weight: 600; }
.fx-inp { width: 100%; min-width: 90px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 6px; font-family: var(--font-sans); font-size: 13px; color: var(--ink); background: var(--surface); box-sizing: border-box; }
.fx-amount .fx-inp { font-family: var(--font-mono); text-align: right; width: calc(100% - 64px); min-width: 80px; display: inline-block; }
.fx-cur { width: 58px; padding: 6px 4px; border: 1px solid var(--line-2); border-radius: 6px; font-family: var(--font-sans); font-size: 12px; background: var(--surface); color: var(--ink); }
.fx-table td.editing { background: var(--primary-wash) !important; }
.fx-table tr.fx-editing td { background: var(--surface-2); }
.fx-table tr.fx-quick td { background: #f3f7fc !important; border-top: 2px dashed var(--line-2); vertical-align: middle; }
.fx-table tr.fx-quick td.fx-q.has { background: #eef5ee !important; }
.fx-quick-seq { color: var(--primary); font-weight: 800; font-size: 15px; }
.fx-quick .fx-acct-name { font-weight: 600; }
.fx-q-clear { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; opacity: 0; transition: opacity .12s; }
.fx-quick td:hover .fx-q-clear { opacity: 1; }
.fx-q-ops button { opacity: 1; }
.fx-q-ok { color: var(--ok) !important; font-weight: 700; }
.fx-table tr.fx-quick:focus-within td { background: #eaf1fa !important; }
/* Fantôme d'un compte pris sur le graphe (poignée = bande colorée) */
.sf-drag-ghost { position: fixed; z-index: 90; pointer-events: none; display: flex; align-items: center; gap: 7px; padding: 7px 11px; background: var(--surface); border: 1px solid var(--primary); border-radius: 999px; box-shadow: var(--sh-lg); font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sf-drag-ghost .pdot { width: 9px; height: 9px; border-radius: 3px; }
.sf-drag-ghost small { color: var(--muted); font-weight: 500; }
body.sf-dragging { cursor: grabbing; user-select: none; }
body.sf-dragging #builderSeq td[data-drop] { box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 6px; }
.bk-strip:hover { filter: brightness(1.15); }
.save-state.err { color: var(--error); font-weight: 700; }
/* Les commandes d'un compte (S, €, ×) n'apparaissent qu'au survol du bloc —
   sauf quand elles sont ACTIVES (source déclarée, solde initial posé). */
.bk-srcg, .bk-balg, .bk-delg { opacity: 0; transition: opacity .14s; }
.bk-node:hover .bk-srcg, .bk-node:hover .bk-balg, .bk-node:hover .bk-delg,
.bk-srcg.on, .bk-balg.on { opacity: 1; }
.bk-delg:hover .bk-delx { fill: var(--error); }
.bk-link { fill: none; stroke-linecap: round; stroke-opacity: .8; }
g.lk { cursor: pointer; }
g.lk:hover .bk-link { stroke-opacity: 1; stroke-width: 2.5; }
/* Pastille de lien : n° d'ordre + montant, blanc cassé, hairline. */
.bk-pill { fill: #fff; fill-opacity: .96; stroke: var(--line-2); stroke-width: 1; }
.bk-pilltxt { font-family: var(--font-mono); font-size: 10px; font-weight: 600; fill: var(--ink-soft); }
g.lk.breach .bk-pill { stroke: var(--error); fill: var(--error-wash); }
g.lk.breach .bk-pilltxt { fill: var(--error); }
g.lk:hover .bk-pill { stroke: var(--ink-soft); }
/* Mode dense (gros tableaux) : traits allégés, pastilles masquées — le survol
   d'un lien le met en avant et révèle sa pastille. Les ruptures restent visibles. */
svg.dense .bk-link { stroke-opacity: .42; stroke-width: 1.6; }
svg.dense .bk-pillg { opacity: 0; pointer-events: none; }
svg.dense g.lk:hover .bk-link, svg.dense g.lk.breach .bk-link { stroke-opacity: 1; stroke-width: 2.5; }
svg.dense g.lk:hover .bk-pillg, svg.dense g.lk.breach .bk-pillg { opacity: 1; }
.ent-label, .ent-balance { font-family: var(--font-sans); }
.ent-balance { font-variant-numeric: tabular-nums; }

.link-form { position: absolute; z-index: 5; width: 230px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--sh-lg); padding: 14px; }
.link-form .lf-title { font-size: 12.5px; font-weight: 700; margin-bottom: 9px; color: var(--ink); }
.link-form input { width: 100%; padding: 8px; border: 1px solid var(--line-2); border-radius: 6px; font-family: var(--font-sans); font-size: 13px; margin-bottom: 7px; }
.link-form .lf-row { display: flex; gap: 6px; margin-bottom: 7px; }
.link-form .lf-row input { margin-bottom: 0; flex: 1; }
.link-form .lf-row select { width: 78px; padding: 8px 6px; border: 1px solid var(--line-2); border-radius: 6px; font-family: var(--font-sans); font-size: 13px; }
.link-form .lf-actions { display: flex; gap: 6px; }
.link-form .lf-actions .btn { flex: 1; padding: 7px; font-size: 12px; }

.builder-seq { margin-top: 16px; }
.sf-flash { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r); box-shadow: var(--sh-lg); font-size: 13px; font-weight: 500; z-index: 60; animation: flashin .2s ease; }
@keyframes flashin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.fx-headright { display: inline-flex; align-items: center; gap: 14px; }
.fx-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fx-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.fx-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fx-total b { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
/* Gros tableaux (remontée 28/08) : hauteur généreuse selon le mode d'affichage,
   cellules qui REPLIENT leur texte (fini le scroll horizontal qui cachait le
   montant), zébrage léger pour suivre les lignes. */
.fx-wrap { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: auto; max-height: 42vh; }
.builder-main.mode-table .fx-wrap { max-height: 72vh; }
.fx-table { width: 100%; }
.fx-table th, .fx-table td { padding: 8px 12px; }
.fx-table td { vertical-align: top; white-space: normal; }
.fx-table td.num, .fx-table td.fx-ops, .fx-table td.fx-seq { white-space: nowrap; }
.fx-table tbody tr:nth-child(even):not(.bad):not(.fx-section) td { background: #fafbfd; }
/* Rupture (remontée 09/09) : la LIGNE entière passe en rouge — la ligne à
   corriger se repère d'un coup d'œil, montant en gras rouge. */
.fx-table tr.bad td { background: var(--error-wash); }
.fx-table tr.bad td:first-child { box-shadow: inset 3px 0 0 var(--error); }
.fx-table tr.bad td.num { color: var(--error); font-weight: 700; }
.fx-table tr.bad:hover td { background: #fadfdb; }
.fx-seq { color: var(--faint); font-variant-numeric: tabular-nums; width: 30px; }
.fx-ent { font-size: 10.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.fx-table thead th:nth-child(5) { text-align: right; }
.fx-ops { white-space: nowrap; text-align: right; }
/* Actions de ligne discrètes (KISS 28/08) : révélées au survol de la ligne. */
.fx-ops button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 5px; cursor: pointer; width: 24px; height: 24px; font-size: 12px; color: var(--ink-soft); margin-left: 2px; opacity: .15; transition: opacity .12s; }
.fx-table tr:hover .fx-ops button, .fx-ops button:focus-visible { opacity: 1; }
.fx-ops button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-soft); }
.fx-ops button:disabled { opacity: .35; cursor: default; }
.fx-ops button[data-del]:hover { color: var(--error); border-color: var(--error); }

/* Bilan par entité — noms ellipsés, montants insécables : plus de collision
   nom/montant sur les libellés longs (remontée 28/08). */
.ent-bal { border-left: 3px solid var(--line-2); padding: 9px 11px; margin-bottom: 9px; background: var(--panel-card); border-radius: var(--r-sm); }
.ent-bal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 700; font-size: 13px; }
.ent-bal-head > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent-bal-head > span:last-child { white-space: nowrap; flex: none; }
.ent-bal-sub2 { font-size: 11px; color: var(--muted); margin: 2px 0 7px; font-variant-numeric: tabular-nums; }
.bal-sub { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2.5px 0 2.5px 10px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bal-sub span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-sub span:last-child { white-space: nowrap; flex: none; }
.bal-sub.neg { color: var(--error); font-weight: 600; }

/* ---------- Validation -----------------------------------------------------*/
#validationHeader { margin-bottom: 14px; }
.val-banner { padding: 15px 18px; border-radius: var(--r); font-weight: 700; border: 1px solid transparent; }
.val-banner.ok { background: var(--ok-wash); color: #14612f; border-color: #cce6d4; }
.val-banner.warn { background: var(--warn-wash); color: #7c3a06; border-color: #f0d8b8; }
.val-banner.error { background: var(--error-wash); color: #8f1d17; border-color: #f1c9c4; }
.val-note { margin-top: 9px; font-size: 12.5px; font-weight: 400; line-height: 1.55; }
.val-note code { font-family: var(--font-mono); background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }
.rib-guard { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 12.5px; color: var(--ink-soft); }
.validation-filters { display: flex; gap: 8px; margin-bottom: 14px; }
.vfilter { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--ink-soft); transition: .12s; }
.vfilter:hover { border-color: var(--ink-soft); }
.vfilter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.findings { display: flex; flex-direction: column; gap: 7px; }
.finding { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--r-sm); padding: 11px 14px; box-shadow: var(--sh-sm); }
.finding.error { border-left-color: var(--error); }
.finding.warn { border-left-color: var(--warn); }
.finding.info { border-left-color: var(--info); }
.finding .f-ic { font-size: 13px; margin-top: 1px; }
.finding .f-msg { flex: 1; font-size: 13px; }
.finding .f-detail { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); margin-top: 3px; }

/* ---------- Data tables ----------------------------------------------------*/
.data-tabs { display: flex; gap: 8px; }
.data-tab { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 7px 14px; cursor: pointer; font-family: var(--font-sans); font-weight: 600; font-size: 12.5px; color: var(--ink-soft); }
.data-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.data-table-wrap { margin-top: 14px; overflow: auto; max-height: 64vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-3); position: sticky; top: 0; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; z-index: 1; }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; }
tr.bad td { background: var(--error-wash); }
tr.bad:hover td { background: #f7ddd9; }

/* ---------- Data Room (collaboratif) --------------------------------------*/
.dr-wrap { max-width: 1080px; margin: 0 auto; }
.dr-narrow { max-width: 560px; margin: 30px auto; }
.dr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dr-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 4px 0; }
.dr-sub { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.dr-cols { display: grid; grid-template-columns: 1fr 330px; gap: 22px; }
.dr-entity { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 19px; margin-bottom: 12px; box-shadow: var(--sh-sm); transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.dr-entity:hover { border-color: var(--line-2); box-shadow: var(--sh); }
.dr-entity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dr-entity-actions { display: flex; gap: 6px; flex-shrink: 0; }
.dr-head-actions { display: flex; gap: 8px; align-items: flex-start; flex-shrink: 0; }
.dr-team { display: flex; flex-direction: column; gap: 6px; }
.dr-member { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dr-member-mail { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-member select, .dr-member input { padding: 5px 7px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-sans); font-size: 12px; background: var(--surface); color: var(--ink); }
/* Le NOM d'abord (remontée 11/09) : « P. Basquin » en gras, sélecteur resserré. */
.dr-member-mail { font-weight: 600; }
.dr-member .dr-role-sel { flex: none; width: 104px; }
.dr-member-add { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.dr-member-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* Grille alignée : membre | rôle | signataire | actions (retour Philibert 12/11) */
.dr-team .dr-member { display: grid; grid-template-columns: minmax(0, 1fr) 96px 36px 64px; align-items: center; gap: 6px; }
.dr-team .tm-role { width: 100%; min-width: 0; }
.dr-team .tm-sig { justify-self: center; }
.dr-team .tm-act { display: inline-flex; gap: 4px; justify-content: flex-end; }
.dr-signer { flex: none; display: inline-flex; justify-content: center; }
.dr-signer input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.tm-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tm-btn:hover { border-color: var(--ink-soft); color: var(--ink); }
.tm-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.dr-rmmember:hover { color: var(--error) !important; border-color: var(--error) !important; }
.dr-member-add { grid-template-columns: minmax(0, 1fr) 96px 36px 64px; }
.dr-member-add input.dr-member-mail { min-width: 0; }
.rep-role { margin-top: 6px; align-items: end; }
.na-check { display: flex; align-items: center; gap: 8px; padding-bottom: 9px; }
.na-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.dr-addform.pulse { box-shadow: 0 0 0 3px var(--primary-wash), 0 0 0 5px var(--primary); transition: box-shadow .3s; }
.op-card.orphan { border-color: #efd9b0; background: var(--warn-wash); cursor: default; }
.chip-submitter { background: #57a877; }
.chip-neutral { background: #b0b0b5; }
.dr-member-add input { flex: 1; min-width: 0; }
.dr-access { max-height: 34vh; }
.dr-acc { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.dr-acc .mono { font-size: 11.5px; }
.dr-aside { background: var(--panel), var(--surface); border: 1px solid var(--panel-line); border-radius: var(--r); padding: 19px; box-shadow: var(--sh-sm); height: fit-content; }
.dr-audit { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.dr-audit-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--panel-card); border-radius: var(--r-sm); font-size: 12.5px; }
.dr-invite-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--sh); }
.dr-rib { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-top: 12px; background: var(--surface-2); }
.dr-rib-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.dr-rib input { width: 100%; padding: 9px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 13px; margin-bottom: 8px; }
.dr-rib .ri-save { width: 100%; margin-top: 4px; }
.dr-rib .ri-msg { min-height: 16px; margin-bottom: 6px; }
.dr-chain b { color: var(--ink); font-weight: 600; }
.tag.doc { background: var(--surface-3); color: var(--ink-soft); border: 1px solid var(--line-2); font-weight: 500; font-family: var(--font-mono); font-size: 10px; }
.ri-drop { border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); padding: 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-soft); text-align: center; background: var(--surface); transition: border-color .15s, background .15s; }
.ri-drop.drag { border-color: var(--primary); background: var(--info-wash); }
.ri-drop .ri-browse { display: inline-block; margin-top: 8px; padding: 6px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); font-weight: 600; cursor: pointer; color: var(--ink); }
.ri-drop .ri-browse:hover { background: var(--surface-3); }
.ri-docinfo { margin-bottom: 8px; padding: 7px 10px; background: var(--ok-wash); border-radius: var(--r-sm); }

.foot { text-align: center; color: var(--faint); font-size: 11px; padding: 20px; letter-spacing: .03em; }

/* Réassurance de l'écran de connexion : uniquement des garanties effectives. */
.lg-trust {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  max-width: 380px; margin: 22px auto 0; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); letter-spacing: .01em;
}
.lg-trust svg { width: 11px; height: 13px; flex: none; fill: var(--surface-3); stroke: var(--gold); }

/* ===== Responsive (passe 03/09) : lisible et complet à TOUTE taille ======= */
/* Portable 13-14" : la palette se resserre, le bilan passe sous le plan
   (pleine largeur, cartes en grille) — le canvas garde le maximum d'espace. */
@media (max-width: 1240px) {
  .builder-layout { grid-template-columns: 218px 1fr; }
  .builder-side { grid-column: 1 / -1; }
  .builder-side .balance-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
  .builder-side .ent-bal { margin-bottom: 0; }
  .dr-cols { grid-template-columns: 1fr 300px; }
}
@media (max-width: 1020px) {
  .replay-layout, .builder-layout { grid-template-columns: 1fr; }
  .palette-list { max-height: 240px; }
  .builder-canvas { height: clamp(340px, 58vh, 560px); }
  .dr-cols { grid-template-columns: 1fr; }
  .graph { height: 480px; }
}
@media (max-width: 720px) {
  .topbar { height: 56px; }
  .tagline { display: none; }
  .topbar h1 { font-size: 18px; }
  .topbar-right { gap: 8px; }
  .dr-head { flex-direction: column; }
  .dr-head-actions .btn { width: 100%; }
  .modal { padding: 20px; }
  th, td { padding: 8px 10px; }
  .fx-ops button { opacity: 1; } /* pas de survol au doigt : actions visibles */
  .dr-delacc, .dr-delent { opacity: 1; }
}
/* Confort : les animations s'effacent pour qui les refuse. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .btn:hover, .op-card:hover { transform: none; }
}

/* ===== Remontées 15/07 : menu d'opération, suppressions, validation ===== */
.op-card { position: relative; }
.oc-menu-btn { float: right; border: none; background: transparent; color: var(--faint); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 4px; border-radius: var(--r-sm); }
.oc-menu-btn:hover { color: var(--ink); background: var(--surface-3); }
.oc-menu { position: absolute; right: 10px; top: 34px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--sh-lg); padding: 6px; min-width: 170px; z-index: 40; display: flex; flex-direction: column; animation: menuin .16s var(--ease); }
.oc-menu button { text-align: left; background: transparent; border: none; padding: 8px 11px; border-radius: var(--r-sm); cursor: pointer; font-family: var(--font-sans); font-size: 13px; color: var(--ink); }
.oc-menu button:hover { background: var(--surface-3); }
.oc-menu button.danger { color: var(--error); }
.btn-danger { background: var(--error) !important; border-color: var(--error) !important; color: #fff !important; }
/* Suppressions révélées au survol (KISS 28/08) : jamais un bouton en trop. */
.dr-delacc { border: none; background: transparent; color: var(--faint); cursor: pointer; font-size: 14px; padding: 0 3px; border-radius: var(--r-sm); opacity: 0; transition: opacity .12s; }
.dr-acc:hover .dr-delacc, .dr-delacc:focus-visible { opacity: 1; }
.dr-delacc:hover { color: var(--error); }
.dr-delent { color: var(--faint); opacity: 0; transition: opacity .12s; }
.dr-entity:hover .dr-delent, .dr-delent:focus-visible { opacity: 1; }
.dr-delent:hover { color: var(--error); border-color: var(--error); }
.dr-import { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Rejeu : 3 vitesses (lent / moyen / rapide) */
.speed-seg { display: inline-flex; gap: 0; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.speed-seg button { border: none; background: transparent; padding: 6px 13px; font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.speed-seg button.active { background: var(--primary); color: #fff; }

/* Synthèse des flux : séparateurs de section + totaux */
.data-table-wrap tr.dt-section td { background: var(--surface-3); font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--ink-soft); border-top: 2px solid var(--line-2); }
.data-table-wrap tr.dt-total td { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-soft); background: var(--surface-2); border-bottom: 2px solid var(--line-2); }
.data-toolbar { display: flex; justify-content: flex-end; margin: 0 0 10px; }

/* ===== Remontées 28/08 : interface épurée (cf. DocuSign) ================== */
/* Pastille d'aide « ? » : les instructions quittent l'écran, l'info-bulle les
   garde à portée de survol. */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
  font-family: var(--font-sans); font-size: 9.5px; font-weight: 700;
  text-transform: none; letter-spacing: 0; line-height: 1;
  cursor: help; position: relative; vertical-align: 1px; margin-left: 7px;
}
.help::before { content: '?'; }
.help:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.help::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(-2px); width: max-content; max-width: min(280px, 62vw);
  background: var(--ink); color: #e8eef2; font-size: 11.5px; font-weight: 400; line-height: 1.55;
  padding: 9px 12px; border-radius: 8px; box-shadow: var(--sh-lg); text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transition: opacity .12s ease, transform .12s ease;
  pointer-events: none; z-index: 80;
}
.help:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
/* Pastilles proches du bord droit (asides) : bulle alignée à droite. */
.dr-aside .help::after, .replay-side .help::after, .builder-side .help::after { left: auto; right: -6px; transform: translateY(-2px); }
.dr-aside .help:hover::after, .replay-side .help:hover::after, .builder-side .help:hover::after { transform: translateY(0); }
/* Palette (bord gauche) : bulle alignée à gauche. */
.builder-palette .help::after { left: -6px; transform: translateY(-2px); }
.builder-palette .help:hover::after { transform: translateY(0); }

/* Statut du contrôle en pastille d'onglet (remplace le bandeau KPI). */
.tab-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700; vertical-align: 1px; font-variant-numeric: tabular-nums;
}
.tab-score.ok { background: var(--ok-wash); color: var(--ok); }
.tab-score.warn { background: var(--warn); color: #fff; }
.tab-score.error { background: var(--error); color: #fff; }

/* Journaux repliables de l'Espace RIB (masquables pour ne pas polluer). */
.dr-fold { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.dr-fold summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 15px; font-weight: 600; user-select: none; }
.dr-fold summary::-webkit-details-marker { display: none; }
.dr-fold summary::before { content: '▸'; font-size: 11px; color: var(--faint); transition: transform .15s; flex: none; }
.dr-fold[open] summary::before { transform: rotate(90deg); }
.dr-fold summary:hover .fold-title { color: var(--link); }
.dr-fold .fold-n { font-family: var(--font-sans); font-size: 10.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.dr-fold > :not(summary) { margin-top: 10px; animation: foldin .22s var(--ease); }
@keyframes foldin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
/* Bandeau replié : l'équipe reste lisible sous forme de pastilles d'initiales. */
.fold-chips { display: inline-flex; gap: 3px; margin-left: 2px; }
.dr-fold[open] .fold-chips { display: none; }
.chip { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; font-family: var(--font-sans); font-size: 9.5px; font-weight: 700; letter-spacing: .02em; color: #fff; background: var(--muted); border: 1.5px solid var(--surface); }
.chip-master { background: var(--primary); }
.chip-administrator { background: #57a877; }
.chip-reviewer { background: #8e8e93; }
.chip-more { background: var(--surface-3); color: var(--muted); }
.dr-rib-done { background: var(--ok-wash); border-color: #cce6d4; }

/* Onglet Validation (figer + signatures) */
.sig-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; max-width: 720px; box-shadow: var(--sh-sm); margin-bottom: 14px; }
.sig-card h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 6px; }
.sig-hash { font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); border-radius: var(--r-sm); padding: 8px 10px; word-break: break-all; margin: 10px 0; }
.sig-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.sig-row .sig-who { overflow: hidden; text-overflow: ellipsis; }
.sig-row .sig-name { color: var(--muted); font-size: 12px; }
