/* ============================================================
   TRAYO — Design System
   Sobre / premium "style Apple", fintech sérieuse.
   Le chiffre est le héros. Dark par défaut, light maîtrisé.
   ============================================================ */

/* ---- Fonts ---------------------------------------------------
   On met -apple-system en tête : les vrais Mac/iPhone rendent SF
   (le vrai "style Apple"). Ailleurs on retombe sur Hanken Grotesk.
*/
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* radii — generous, Apple-like */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* spacing — 4pt base */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 80px;

  /* type scale */
  --t-display: 56px;
  --t-h1: 36px;
  --t-h2: 26px;
  --t-h3: 20px;
  --t-body: 15px;
  --t-small: 13px;
  --t-meta: 12px;
  --t-figure: 40px;   /* hero financial number */

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --t-fast: 130ms;
  --t-normal: 220ms;
  --t-slow: 360ms;
}

/* ---- DARK (default) ----------------------------------------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0B0D;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(10,132,255,0.06), transparent 60%);
  --surface: #141518;
  --surface-2: #1B1D22;
  --surface-3: #24272E;
  --surface-inset: #0E0F12;

  --line: rgba(255,255,255,0.08);
  --line-2: rgba(255,255,255,0.14);
  --line-strong: rgba(255,255,255,0.22);

  --ink: #F4F5F7;
  --ink-2: #A7ADB8;
  --ink-3: #6E747F;
  --ink-4: #474C55;

  --brand: #0A84FF;
  --brand-press: #0066D6;
  --brand-soft: rgba(10,132,255,0.16);
  --brand-line: rgba(10,132,255,0.42);
  --on-brand: #FFFFFF;

  --gain: #30D158;
  --gain-soft: rgba(48,209,88,0.15);
  --loss: #FF453A;
  --loss-soft: rgba(255,69,58,0.15);
  --warn: #FF9F0A;
  --warn-soft: rgba(255,159,10,0.15);
  --info: #64D2FF;
  --info-soft: rgba(100,210,255,0.14);
  --violet: #BF8CFF;
  --violet-soft: rgba(191,140,255,0.14);

  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 4px 14px rgba(0,0,0,0.45);
  --shadow-3: 0 12px 32px rgba(0,0,0,0.55);
  --shadow-4: 0 24px 60px rgba(0,0,0,0.65);
  --scrim: rgba(0,0,0,0.6);
  --shadow-focus: 0 0 0 3px rgba(10,132,255,0.4);
}

/* ---- LIGHT -------------------------------------------------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F5F7;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(0,113,227,0.05), transparent 60%);
  --surface: #FFFFFF;
  --surface-2: #F2F3F5;
  --surface-3: #E9EBEF;
  --surface-inset: #EFEFF2;

  --line: rgba(0,0,0,0.09);
  --line-2: rgba(0,0,0,0.14);
  --line-strong: rgba(0,0,0,0.22);

  --ink: #1D1D1F;
  --ink-2: #515257;
  --ink-3: #86868B;
  --ink-4: #B0B0B5;

  --brand: #0071E3;
  --brand-press: #0058B0;
  --brand-soft: rgba(0,113,227,0.10);
  --brand-line: rgba(0,113,227,0.30);
  --on-brand: #FFFFFF;

  --gain: #1A8F3C;
  --gain-soft: rgba(26,143,60,0.12);
  --loss: #E0322B;
  --loss-soft: rgba(224,50,43,0.10);
  --warn: #B7700A;
  --warn-soft: rgba(183,112,10,0.12);
  --info: #0A7AA8;
  --info-soft: rgba(10,122,168,0.10);
  --violet: #7B4DD6;
  --violet-soft: rgba(123,77,214,0.10);

  --shadow-1: 0 1px 2px rgba(20,30,55,0.06), 0 1px 1px rgba(20,30,55,0.04);
  --shadow-2: 0 4px 14px rgba(20,30,55,0.08);
  --shadow-3: 0 12px 30px rgba(20,30,55,0.12);
  --shadow-4: 0 24px 60px rgba(20,30,55,0.18);
  --scrim: rgba(20,30,55,0.32);
  --shadow-focus: 0 0 0 3px rgba(0,113,227,0.28);
}

/* ---- Reset / base ------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1,h2,h3,h4,p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand-soft); }

/* All financial figures use tabular, lining numerals */
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---- Discretion mode -----------------------------------------
   Blurs sensitive figures when working in public. Hover/focus to
   reveal a single value. Toggled via the topbar (cookie-persisted). */
[data-discreet="on"] .num,
[data-discreet="on"] .figure,
[data-discreet="on"] .v2-discreet {
  filter: blur(7px);
  transition: filter 0.18s ease;
  cursor: default;
  user-select: none;
}
[data-discreet="on"] .num:hover,
[data-discreet="on"] .figure:hover,
[data-discreet="on"] .v2-discreet:hover,
[data-discreet="on"] .num:focus-within,
[data-discreet="on"] .figure:focus-within,
[data-discreet="on"] .v2-discreet:focus-within {
  filter: blur(0);
  user-select: auto;
}

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }

/* ---- Typography helpers ------------------------------------- */
.eyebrow {
  font-size: var(--t-meta);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.h1 { font-size: var(--t-h1); font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; }
.h2 { font-size: var(--t-h2); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.h3 { font-size: var(--t-h3); font-weight: 650; letter-spacing: -0.01em; }
.meta { font-size: var(--t-meta); color: var(--ink-3); }
.muted { color: var(--ink-2); }

/* ---- Card --------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--s-5); }

/* ---- Buttons ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  font-size: var(--t-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 10px 16px;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn .lucide { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-press); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--loss); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-sm { padding: 6px 12px; font-size: var(--t-small); border-radius: var(--r-xs); }
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Inputs ------------------------------------------------- */
.input, .select {
  width: 100%;
  background: var(--surface-inset);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: var(--t-body);
  font-family: inherit;
  padding: 11px 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.input::placeholder { color: var(--ink-3); }
/* Selects natifs : on neutralise le rendu OS et on garde de la place verticale
   pour éviter que le texte (et ses jambages) soit rogné, quelle que soit la
   hauteur imposée en ligne. */
select.input, select.select, .select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-height: 40px;
  line-height: 1.4;
  padding-top: 0;
  padding-bottom: 0;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2390A0B5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}
select.input option, select.select option { color: var(--ink); background: var(--surface-1); }
.input:focus, .select:focus { border-color: var(--brand-line); box-shadow: var(--shadow-focus); }
.field-label { display:block; font-size: var(--t-small); font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }

/* ---- Badges ------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-meta);
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-gain    { color: var(--gain);  background: var(--gain-soft); }
.badge-loss    { color: var(--loss);  background: var(--loss-soft); }
.badge-warn    { color: var(--warn);  background: var(--warn-soft); }
.badge-info    { color: var(--info);  background: var(--info-soft); }
.badge-brand   { color: var(--brand); background: var(--brand-soft); }
.badge-violet  { color: var(--violet);background: var(--violet-soft); }
.badge-neutral { color: var(--ink-2); background: var(--surface-2); border-color: var(--line); }

/* ---- Amount semantics --------------------------------------- */
.amt-gain { color: var(--gain); }
.amt-loss { color: var(--loss); }
.amt-neutral { color: var(--ink); }

/* ---- Divider ------------------------------------------------ */
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- Tables (transparent bg, subtle dividers) --------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  font-size: var(--t-meta);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 14px; border-bottom: 1px solid var(--line); font-size: var(--t-body); }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* ---- Utility ------------------------------------------------ */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.gap-6{gap:24px}
.grow { flex: 1; }
.center { align-items: center; justify-content: center; }
.between { justify-content: space-between; }

/* focus ring for keyboard */
.focusable:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* fade-in animation for screen transitions */
@keyframes riseIn { from { transform: translateY(9px); } to { transform: none; } }
/* Transform-only entrance: content is always opaque, so print/PDF/screenshot
   renderers (which re-trigger keyframes at frame 0) never trap it invisible. */
.rise { animation: riseIn var(--t-normal) var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* count-up shimmer for figures (subtle) */
.figure {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================================
   v2 shell — responsive helpers + CSS-only tooltip
   (ported from prototype index.html inline styles)
   ============================================================ */
.only-mobile { display: none; }
.only-desktop-inline { display: inline-flex; }
.sidebar-desktop { display: block; height: 100%; }

.shop-grid { display: grid; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 1000px) {
  .wm-grid { grid-template-columns: 1fr !important; }
  .mgr-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 900px) {
  .answers-grid { grid-template-columns: 1fr 1fr !important; }
  .two-col { grid-template-columns: 1fr !important; }
  .shop-grid { grid-template-columns: 1fr !important; }
  .onb-hero { grid-template-columns: 1fr !important; }
  .sidebar-desktop { display: none; }
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none !important; }
  .only-desktop-inline { display: none !important; }
}
@media (max-width: 620px) {
  .answers-grid { grid-template-columns: 1fr !important; }
  .kpi-grid { grid-template-columns: 1fr !important; }
  main { padding: var(--s-5) var(--s-4) !important; }
  .h1 { font-size: 28px !important; }
}

/* ============================================================
   PWA / mobile — safe-area (encoche + barre d'accueil iOS),
   scroll fluide, contenu jamais masqué en mode standalone
   ============================================================ */
#main-scroll {
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--s-7) + env(safe-area-inset-bottom)) !important;
  padding-left: max(var(--s-6), env(safe-area-inset-left)) !important;
  padding-right: max(var(--s-6), env(safe-area-inset-right)) !important;
}
/* topbar collé en haut : décalé sous l'encoche / la barre de statut */
.col.grow > header {
  padding-top: calc(14px + env(safe-area-inset-top)) !important;
  padding-left: max(var(--s-6), env(safe-area-inset-left)) !important;
  padding-right: max(var(--s-6), env(safe-area-inset-right)) !important;
}
/* sidebar desktop : respecte l'encoche gauche/haut */
.sidebar-desktop {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
}
@media (max-width: 620px) {
  #main-scroll {
    padding-left: max(var(--s-4), env(safe-area-inset-left)) !important;
    padding-right: max(var(--s-4), env(safe-area-inset-right)) !important;
  }
}
/* sous la barre de nav du bas : le contenu n'est jamais masqué */
@media (max-width: 900px) {
  #main-scroll {
    padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
}

/* ============================================================
   Bottom nav (mobile) + bottom-sheet « Menu »
   Remplace le burger menu : navigation au pouce, modale montante.
   ============================================================ */
.bottom-nav-root { display: none; }

@media (max-width: 900px) {
  .bottom-nav-root { display: block; }

  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 2px;
    border: none;
    background: transparent;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: var(--r-sm);
    cursor: pointer;
    text-decoration: none;
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bottom-nav-item.is-active { color: var(--brand); }
  .bottom-nav-item.is-active .lucide { transform: translateY(-1px); }

  /* overlay + scrim */
  .sheet-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 200;
  }
  .sheet-scrim {
    position: absolute; inset: 0;
    background: var(--scrim, rgba(0,0,0,0.5));
    opacity: 0;
    transition: opacity var(--t-normal) var(--ease);
  }
  .bottom-nav-root.is-open .sheet-scrim { opacity: 1; }

  /* panneau montant depuis le bas */
  .sheet-panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-top-left-radius: var(--r-lg);
    border-top-right-radius: var(--r-lg);
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow-3);
    transform: translateY(100%);
    transition: transform var(--t-normal) var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav-root.is-open .sheet-panel { transform: translateY(0); }

  .sheet-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px var(--s-5) 8px;
    border-bottom: 1px solid var(--line);
  }
  .sheet-grabber {
    width: 38px; height: 4px;
    border-radius: 999px;
    background: var(--line-2);
  }
  .sheet-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px var(--s-4) var(--s-5);
  }
}

/* ============================================================
   Tables → cartes empilées sur mobile (mobile-first, ZÉRO scroll
   horizontal). Chaque ligne devient une carte ; chaque cellule
   affiche son intitulé (data-label, posé automatiquement par le
   contrôleur v2-table) à gauche et sa valeur à droite.
   ============================================================ */
@media (max-width: 640px) {
  /* le wrapper overflow-x ne sert plus : pas de débordement à scroller */
  .tbl-wrap, .card > [style*="overflow-x"] { overflow-x: visible !important; }

  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .tbl tr {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    padding: 2px 14px;
    margin-bottom: 10px;
  }
  .tbl tr:hover { background: var(--surface-2); }
  .tbl tr:last-child { margin-bottom: 0; }
  .tbl td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: auto;
    padding: 11px 0 !important;
    border-bottom: 1px solid var(--line);
    text-align: right !important;
    min-height: 0;
  }
  .tbl tr td:last-child { border-bottom: 0; }
  .tbl td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    text-align: left;
    font-size: var(--t-meta);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-3);
    white-space: nowrap;
  }
  /* cellule sans intitulé (actions, etc.) : pleine largeur */
  .tbl td[data-label=""]::before,
  .tbl td:not([data-label])::before { content: none; }
  .tbl td[data-label=""],
  .tbl td:not([data-label]) { justify-content: flex-end; }
  /* le contenu d'une cellule occupe l'espace restant, aligné à droite */
  .tbl td > * { text-align: right; }
  .tbl td .col { align-items: flex-end; }
  /* panneau « trades par bot » : reprend toute la largeur, aligné à gauche */
  .tbl td > .bot-trades-panel { text-align: left; width: 100%; }
}

/* ============================================================
   Détail par bot → trades horodatés dépliables (accordéon).
   La ligne de bot est cliquable ; le chevron pivote à l'ouverture
   et le panneau liste chaque trade (instrument, sens, date, P&L).
   ============================================================ */
.bot-row { cursor: pointer; }
.bot-row[aria-disabled="true"] { cursor: default; }
.bot-row:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.bot-chevron { transition: transform var(--t-fast) var(--ease); }
.bot-row[data-state="open"] .bot-chevron { transform: rotate(180deg); }

.bot-trades-panel { padding: 4px 14px 14px; }
.bot-trades-cap {
  font-size: var(--t-meta); font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 10px 0 6px;
}
.bot-trade {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.bot-trade:last-child { border-bottom: 0; }
.bot-trade-l { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bot-trade-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bot-trade-sym { font-weight: 600; }
.bot-trade-sub { display: flex; gap: 12px; font-size: var(--t-meta); color: var(--ink-3); }
.bot-trade-pnl { font-weight: 650; white-space: nowrap; }
.bot-trades-more { margin-top: 10px; }

/* Visuel « avant → après » du plafond commission (pédagogie client) */
.bot-cap-before {
  font-weight: 600; color: var(--ink-3); text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.bot-cap-after { font-weight: 750; color: var(--ink); font-size: 17px; }
.bot-cap-save {
  margin-left: auto; font-size: var(--t-meta); font-weight: 650;
  color: var(--gain); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  white-space: nowrap;
}

/* CSS-only info tooltip */
.v2-tip { position: relative; display: inline-flex; vertical-align: middle; color: var(--ink-3); border-radius: 999px; outline: none; }
.v2-tip-trigger { display: inline-flex; }
.v2-tip-bubble {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 250px; background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); box-shadow: var(--shadow-3); padding: 12px 14px;
  font-size: var(--t-small); line-height: 1.45; font-weight: 400; text-transform: none; letter-spacing: 0;
  z-index: 50; opacity: 0; visibility: hidden; transition: opacity var(--t-fast) var(--ease);
  pointer-events: none;
}
.v2-tip:hover .v2-tip-bubble,
.v2-tip:focus-visible .v2-tip-bubble { opacity: 1; visibility: visible; }
.v2-tip:focus-visible { box-shadow: var(--shadow-focus); }

/* theme toggle icon: show the icon for the *target* theme */
.v2-theme-sun, .v2-theme-moon { display: inline-flex; }
[data-theme="dark"] .v2-theme-moon { display: none; }
[data-theme="light"] .v2-theme-sun { display: none; }

/* discretion toggle icon: eyeOff when active, eye when inactive */
.v2-discreet-on { display: none !important; }
[data-discreet="on"] .v2-discreet-on { display: inline-flex !important; }
[data-discreet="on"] .v2-discreet-off { display: none !important; }
[data-discreet="on"] .v2-discretion-btn { color: var(--brand); }

/* role switcher dropdown (CSS-driven open state) */
.v2-rolemenu { position: relative; }
.v2-rolemenu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 248px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  box-shadow: var(--shadow-4); padding: 6px; z-index: 100;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.v2-rolemenu[data-open="true"] .v2-rolemenu-panel { opacity: 1; visibility: visible; transform: none; }

/* segmented control */
.v2-seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; gap: 2px; border: 1px solid var(--line); }
.v2-seg-btn {
  border: none; background: transparent; color: var(--ink-3); font-weight: 600; font-size: var(--t-small);
  padding: 6px 14px; border-radius: var(--r-pill); transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.v2-seg-btn[data-active="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---- commission payment flow ---- */
.pay-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: var(--s-5); align-items: start; }
/* min-width:0 empêche le « grid blowout » (enfants en min-width:auto) qui
   débordait la carte au-delà du viewport sur mobile. */
.pay-grid > * { min-width: 0; }
@media (max-width: 900px) { .pay-grid { grid-template-columns: 1fr !important; } }

/* Action row (Retour + CTA) : le CTA « btn-lg » ne tient pas à côté de Retour
   sous 420px → on passe en pleine largeur empilée pour éviter tout débordement. */
@media (max-width: 420px) {
  .pay-actions { flex-wrap: wrap; gap: 10px; }
  .pay-actions > * { flex: 1 1 100%; }
  .pay-actions .btn-ghost { order: 2; }
  .pay-actions-cta { order: 1; width: 100%; }
  .pay-actions-cta .btn { width: 100%; }
}

.v2-stepper { display: flex; align-items: center; gap: 0; margin-bottom: var(--s-5); }
.v2-step-item { display: flex; align-items: center; gap: 8px; }
.v2-step-dot {
  width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; background: var(--surface-3); color: var(--ink-3);
  transition: all var(--t-normal) var(--ease);
}
.v2-step-check { display: none; }
.v2-step-item[data-state="done"] .v2-step-dot { background: var(--gain); color: #fff; }
.v2-step-item[data-state="done"] .v2-step-num { display: none; }
.v2-step-item[data-state="done"] .v2-step-check { display: grid; }
.v2-step-item[data-state="active"] .v2-step-dot { background: var(--brand); color: #fff; }
.v2-step-label { font-size: var(--t-small); font-weight: 550; color: var(--ink-3); }
.v2-step-item[data-state="active"] .v2-step-label { font-weight: 700; color: var(--ink); }
.v2-step-conn { flex: 1; height: 1.5px; margin: 0 12px; background: var(--line-2); }
.v2-step-conn[data-state="done"] { background: var(--gain); }

.v2-method {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; transition: all var(--t-fast) var(--ease); color: var(--ink);
}
.v2-method[data-active="true"] { background: var(--brand-soft); border-color: var(--brand); }
.v2-method-ico { width: 42px; height: 42px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); display: grid; place-items: center; flex-shrink: 0; }
.v2-method[data-active="true"] .v2-method-ico { background: var(--brand); color: #fff; }
.v2-method-radio { width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--line-2); display: grid; place-items: center; flex-shrink: 0; }
.v2-method[data-active="true"] .v2-method-radio { border-color: var(--brand); }
.v2-method-radio-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--brand); opacity: 0; transition: opacity var(--t-fast); }
.v2-method[data-active="true"] .v2-method-radio-dot { opacity: 1; }

.v2-toggle { width: 46px; height: 28px; border-radius: 999px; border: none; cursor: pointer; padding: 3px; background: var(--surface-3); transition: background var(--t-fast) var(--ease); display: flex; flex-shrink: 0; }
.v2-toggle[data-on="true"] { background: var(--brand); }
.v2-toggle-knob { width: 22px; height: 22px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-1); transition: transform var(--t-fast) var(--ease); }
.v2-toggle[data-on="true"] .v2-toggle-knob { transform: translateX(18px); }
