﻿/* =========================
   HUB
========================= */
.hub-topbar{
  position: sticky;
  top: 0;
  z-index: 30;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 14px;
  margin: -14px 0 12px;
  border-radius: 18px;
  background: rgba(12,18,27,.55);
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
}
.hub-avatarBtn{ display:flex; align-items:center; gap: 10px; padding: 8px 10px; border-radius: 16px; }
.hub-avatar{
  width: 38px; height: 38px;
  display:block;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  object-fit: contain;
  padding: 4px;
}
.hub-userMeta{ display:flex; flex-direction:column; align-items:flex-start; line-height:1.15; }
.hub-userName{ font-weight: 800; font-size: 13px; }
.hub-userTag{ font-size: 12px; color: var(--muted); }
.hub-badges{ display:flex; gap: 8px; flex-wrap:wrap; justify-content:flex-end; }
.hub-cardHead{ display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.hub-card{ padding: 16px; }
.hub-session-card{
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(122,162,255,.26);
  background:
    radial-gradient(120% 95% at 0% 0%, rgba(122,162,255,.20), transparent 55%),
    radial-gradient(100% 80% at 100% 100%, rgba(46,204,113,.10), transparent 58%),
    rgba(12,18,27,.78);
  box-shadow:
    0 20px 38px rgba(0,0,0,.34),
    inset 0 1px 0 rgba(255,255,255,.06);
}
.hub-session-layout{
  display:grid;
  grid-template-columns: clamp(120px, 20vw, 190px) minmax(0,1fr);
  gap: 14px;
  align-items: stretch;
}
.hub-session-main{
  min-width: 0;
  display:flex;
  flex-direction:column;
}
.hub-session-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}
.hub-session-titleWrap{ display:flex; flex-direction:column; gap:6px; }
.hub-session-kicker{
  font-size: 11px;
  letter-spacing: .12em;
  color: rgba(232,238,246,.62);
}
.hub-session-title{
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 900;
  letter-spacing: .01em;
}
.hub-session-status{
  border-color: rgba(122,162,255,.38);
  background: rgba(122,162,255,.16);
  color: #fff;
}
.hub-session-lead{
  margin: 10px 0 0;
  color: rgba(232,238,246,.80);
  font-size: 13px;
  line-height: 1.35;
}
.hub-session-visual{
  border-radius: 14px;
  border: 1px solid rgba(122,162,255,.24);
  background: rgba(7,11,16,.62);
  padding: 8px;
  display:flex;
}
.hub-mini-chart{
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 210px;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(122,162,255,.08), rgba(255,255,255,.01)),
    repeating-linear-gradient(
      to right,
      rgba(255,255,255,.04) 0,
      rgba(255,255,255,.04) 1px,
      transparent 1px,
      transparent 16px
    ),
    repeating-linear-gradient(
      to top,
      rgba(255,255,255,.035) 0,
      rgba(255,255,255,.035) 1px,
      transparent 1px,
      transparent 18px
    );
}
.hub-mini-candle{
  position: absolute;
  left: var(--x);
  top: 0;
  bottom: 0;
  width: 8px;
  transform: translateX(-50%);
  opacity: 0;
  animation: hubMiniBuild 4.8s linear infinite;
  animation-delay: var(--d);
}
.hub-mini-candle::before{
  content: "";
  position: absolute;
  left: 50%;
  bottom: var(--wb);
  width: 2px;
  height: var(--wh);
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(201,222,255,.76);
}
.hub-mini-candle::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--bb);
  border-radius: 2px;
  height: var(--bh);
}
.hub-mini-candle.up::after{
  background: linear-gradient(180deg, rgba(132,243,187,.96), rgba(80,206,145,.95));
}
.hub-mini-candle.down::after{
  background: linear-gradient(180deg, rgba(255,154,136,.96), rgba(255,112,112,.92));
}
.hub-mini-scanline{
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  bottom: 32%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(111,212,255,.95), transparent);
  box-shadow: 0 0 10px rgba(111,212,255,.45);
  animation: hubMiniScan 3.2s ease-in-out infinite;
}
.hub-session-grid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: minmax(0,1fr) 170px;
  gap: 12px;
}
.hub-session-field select{
  height: 46px;
  border-radius: 14px;
  background: rgba(6,10,14,.44);
}
/* CTA principal "Lancer la session" : aligné au bas de la grille (hauteur du select) */
.hub-session-launch{
  align-self: end;
  height: 46px;
  white-space: nowrap;
}
/* Toggle "Session aveugle" */
.hub-blind-toggle{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--sp-3);
  cursor: pointer;
  flex-wrap: wrap;
}
.hub-blind-toggle input{ width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); cursor: pointer; }
.hub-blind-label{ font-weight: var(--fw-semibold, 700); font-size: var(--fs-3, 13px); }
.hub-blind-toggle .hint{ margin: 0; }
/* Mode drill (config sur l'Accueil) */
.hub-drill-row{ display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: var(--sp-2); font-size: var(--fs-3, 13px); }
.hub-drill-lead{ font-weight: var(--fw-semibold, 700); }
.hub-drill-lead .hint{ font-weight: 400; }
.hub-drill-field{ display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.hub-drill-field input{ width: 64px; min-height: 34px; padding: 6px 8px; text-align: center; }
@media (max-width:700px){
  .hub-session-launch{ align-self: stretch; }
}
.hub-session-stat{
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(122,162,255,.14), rgba(255,255,255,.03));
  border-color: rgba(122,162,255,.26);
}
.hub-progress{
  margin-top: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(7,11,16,.72);
  border: 1px solid rgba(255,255,255,.10);
  overflow: hidden;
}
.hub-progressFill{
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f87ff 0%, #6fd4ff 52%, #84f3bb 100%);
  box-shadow: 0 0 14px rgba(111,212,255,.35);
  transition: width .28s ease;
}
.hub-session-hint{
  margin-top: 12px;
  color: rgba(232,238,246,.72);
}
@media (max-width:700px){
  .hub-session-layout{
    grid-template-columns: 112px minmax(0,1fr);
  }
  .hub-mini-chart{
    min-height: 190px;
  }
  .hub-session-grid{
    grid-template-columns: 1fr;
  }
}

@keyframes hubMiniBuild{
  0%, 8% { opacity: 0; }
  18%, 100% { opacity: 1; }
}
@keyframes hubMiniScan{
  0%, 100% { bottom: 22%; opacity: .55; }
  50% { bottom: 68%; opacity: .92; }
}

/* =========================
   TABBAR (2 lignes, NO OVERLAP)
========================= */
.tabbar{
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 70;

  height: var(--tabbar-h);

  display: grid;
  grid-template-rows: var(--tabbar-top) var(--tabbar-bottom);
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;

  /* ✅ padding-bottom MONTE la rangée du bas sans bouger la barre */
  padding: 10px 10px calc(10px + var(--tabbar-safe) + var(--tabbar-inner-bottom-gap));

  background: rgba(10, 16, 26, .93);
  border-top: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -16px 38px rgba(0,0,0,.52);
}

/* Petits tabs — rangée du bas */
.tabbar > .tab:not(.tab-main){
  grid-row: 2;
  width: 100%;
  height: var(--tab-btn-h);
  margin: 0;
  align-self: start;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  border-radius: 13px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.025);
  font-family: inherit;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tabbar > .tab:not(.tab-main):hover{
  background: rgba(255,255,255,.055);
  border-color: rgba(255,255,255,.14);
}
.tabbar > .tab:not(.tab-main):active{
  background: rgba(255,255,255,.08);
}

/* État actif — signal clair */
.tabbar > .tab.is-active{
  background: rgba(103, 183, 255, .18);
  border-color: rgba(103, 183, 255, .40);
  box-shadow: inset 0 1px 0 rgba(188, 222, 255, .16);
}
.tabbar > .tab.is-active .tab-txt{
  color: rgba(174, 216, 255, .96);
}
.tabbar > .tab.is-active .tab-ico{
  color: rgba(174, 216, 255, .92);
}

/* Bouton CHART/TRADER — rangée du haut, full width */
#tabTrader.tab-main{
  grid-row: 1;
  grid-column: 1 / -1;

  width: 100%;
  height: 100%;

  position: static !important;
  transform: none !important;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 18px;
  border: 1px solid rgba(103, 183, 255, .52);
  background: linear-gradient(155deg,
    rgba(103, 183, 255, .44) 0%,
    rgba(70, 128, 210, .26) 100%
  );
  box-shadow:
    0 12px 30px rgba(0,0,0,.50),
    inset 0 1px 0 rgba(200, 232, 255, .22);

  font-family: inherit;
  cursor: pointer;
  transition: filter .12s ease, border-color .14s ease, box-shadow .14s ease;
  -webkit-tap-highlight-color: transparent;
}
#tabTrader.tab-main:hover{
  filter: brightness(1.10);
  border-color: rgba(103, 183, 255, .70);
  box-shadow:
    0 14px 34px rgba(0,0,0,.52),
    0 0 0 2px rgba(103,183,255,.16),
    inset 0 1px 0 rgba(200, 232, 255, .26);
}
#tabTrader.tab-main:active{
  filter: brightness(.96);
}

/* Label #tabTrader */
#tabTrader .tab-mainTxt{
  display: block;
  width: 100%;
  text-align: center;
  font-size: clamp(15px, 4vw, 21px);
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.22), 0 6px 14px rgba(0,0,0,.28);
}

/* Icônes et labels */
.tab-ico{
  font-size: 16px;
  line-height: 1;
  color: rgba(255,255,255,.78);
}
.tab-txt{
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: rgba(255,255,255,.72);
}

/* =========================
   CHART (comme avant)
========================= */
.chart-shell{
  display:flex;
  flex-direction:column;
  gap: var(--sp-3);
  padding-bottom: calc(var(--sp-3) + var(--tabbar-safe));
}

/* === TRADE BAR === */
.trade-bar{
  position:sticky;
  top: 0;
  z-index: 40;
  display:grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-2);
  background: var(--glass2);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
}

/* BUY / SELL buttons */
.trade-btn{
  appearance:none;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 3px;
  min-height: 72px;
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: transform .09s ease, filter .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.trade-btn .lbl{
  font-weight: 900;
  letter-spacing: .14em;
  font-size: 13px;
  line-height: 1;
}

.trade-btn .px{
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  opacity: .98;
}

/* SELL */
.trade-btn.sell{
  background: linear-gradient(155deg, rgba(255, 80, 80, .28) 0%, rgba(150, 30, 30, .16) 100%);
  border-color: rgba(255, 92, 92, .42);
  box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,92,92,.08);
}
.trade-btn.sell .lbl{ color: rgba(255, 148, 148, 1); }
.trade-btn.sell:hover{
  background: linear-gradient(155deg, rgba(255, 80, 80, .40) 0%, rgba(150, 30, 30, .24) 100%);
  border-color: rgba(255, 92, 92, .62);
  box-shadow: 0 10px 24px rgba(200,40,40,.22), inset 0 0 0 1px rgba(255,92,92,.14);
}

/* BUY */
.trade-btn.buy{
  background: linear-gradient(155deg, rgba(46, 204, 113, .26) 0%, rgba(16, 130, 60, .16) 100%);
  border-color: rgba(46, 204, 113, .42);
  box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 0 0 1px rgba(46,204,113,.08);
}
.trade-btn.buy .lbl{ color: rgba(80, 225, 145, 1); }
.trade-btn.buy:hover{
  background: linear-gradient(155deg, rgba(46, 204, 113, .38) 0%, rgba(16, 130, 60, .24) 100%);
  border-color: rgba(46, 204, 113, .62);
  box-shadow: 0 10px 24px rgba(20,160,75,.22), inset 0 0 0 1px rgba(46,204,113,.14);
}

.trade-btn:active{ transform: translateY(1px) scale(.99); }

/* PENDING — pulse CSS pur pour signaler l'état actif */
.trade-btn.sell.pending-sell{
  background: linear-gradient(155deg, rgba(255, 167, 96, .32) 0%, rgba(80, 35, 0, .34) 100%);
  border-color: rgba(255, 178, 109, .68);
  box-shadow: 0 0 0 1px rgba(255,178,109,.22), 0 8px 20px rgba(0,0,0,.28);
  animation: tradePulse-sell 1.9s ease-in-out infinite;
}
.trade-btn.buy.pending-buy{
  background: linear-gradient(155deg, rgba(117, 179, 255, .32) 0%, rgba(10, 28, 72, .36) 100%);
  border-color: rgba(133, 194, 255, .68);
  box-shadow: 0 0 0 1px rgba(133,194,255,.22), 0 8px 20px rgba(0,0,0,.28);
  animation: tradePulse-buy 1.9s ease-in-out infinite;
}

@keyframes tradePulse-sell{
  0%,100%{ box-shadow: 0 0 0 1px rgba(255,178,109,.22), 0 8px 20px rgba(0,0,0,.28); }
  50%{ box-shadow: 0 0 0 4px rgba(255,160,80,.14), 0 0 18px rgba(255,160,80,.26), 0 8px 20px rgba(0,0,0,.28); }
}
@keyframes tradePulse-buy{
  0%,100%{ box-shadow: 0 0 0 1px rgba(133,194,255,.22), 0 8px 20px rgba(0,0,0,.28); }
  50%{ box-shadow: 0 0 0 4px rgba(100,170,255,.14), 0 0 18px rgba(100,170,255,.26), 0 8px 20px rgba(0,0,0,.28); }
}

/* Middle button */
.trade-mid{
  width: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}

.trade-mid.trade-mid-btn{
  width: 80px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  background: linear-gradient(180deg, rgba(88,182,255,.14), rgba(255,255,255,.04));
  border: 1px solid rgba(135,205,255,.30);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 8px 20px rgba(0,0,0,.22);
  font-family: inherit;
  transition: filter .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.trade-mid.trade-mid-btn:hover{ filter: brightness(1.14); border-color: rgba(135,205,255,.52); }

.trade-mid.trade-mid-btn .ico-clock{
  width: 22px;
  height: 22px;
  stroke: rgba(202,235,255,.92);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(103,198,255,.38));
}

/* Ordre en attente — bleu vif */
.trade-mid.trade-mid-btn.is-on{
  background: linear-gradient(180deg, rgba(77,205,255,.28), rgba(13,34,52,.44));
  border-color: rgba(115,221,255,.70);
  box-shadow: 0 0 0 2px rgba(115,221,255,.18), 0 0 20px rgba(77,205,255,.22);
}

/* Gestion trade actif — or (distinct du bleu) */
.trade-mid.trade-mid-btn.is-manage{
  background: linear-gradient(180deg, rgba(246,195,67,.24), rgba(100,65,0,.30));
  border-color: rgba(246,195,67,.60);
  box-shadow: 0 0 0 2px rgba(246,195,67,.14), 0 0 18px rgba(246,195,67,.20);
}


.plot-area{
  position:relative;
  border-radius: var(--radius-3);
  border: 1px solid rgba(255,255,255,.10);
  background: radial-gradient(900px 400px at 20% 0%, rgba(122,162,255,.10), transparent 60%),
              rgba(12,18,27,.55);
  box-shadow: 0 14px 42px rgba(0,0,0,.38);
  overflow:hidden;
}
.canvas-wrap{ position:relative; width:100%; min-height: 520px; }
@media(max-width:900px){ .canvas-wrap{ min-height: 58vh; } }
#mainCanvas, #overlayCanvas{ position:absolute; inset:0; width:100%; height:100%; display:block; }

/* === HUD OVERLAY === */
.hud-overlay{
  position:absolute;
  left: 12px;
  top: 12px;
  z-index: 15;
  display:flex;
  flex-wrap:wrap;
  gap: 6px;
  row-gap: 5px;
  max-width: min(88%, 560px);
  pointer-events:none;
}

/* Base pills sur canvas — lisibilité prioritaire
   Corrige l'override premium.css (trop transparent) */
.hud-overlay .pill{
  background: rgba(7, 12, 20, .72);
  border-color: rgba(255,255,255,.13);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  font-size: 12px;
  padding: 5px 9px;
  gap: 5px;
}

/* ── Tier 1 : État replay ───────────────────────── */

/* Mode — badge de statut, le plus proéminent du HUD */
#modeBox{
  background: rgba(10, 17, 30, .88);
  border-color: rgba(103, 183, 255, .40);
  color: rgba(188, 220, 255, .96);
  font-weight: 700;
  letter-spacing: .04em;
}

/* ── Tier 2 : Données prix ──────────────────────── */

/* OHLC — données prix : séparé du groupe A par margin-left */
#ohlcBox{
  margin-left: 8px;
  background: rgba(7, 12, 20, .82);
  border-color: rgba(103, 183, 255, .20);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .01em;
}

/* ── Tier 3 : Metadata technique — recule visuellement ─── */
#statSource,
#statReplayPos,
#periodPill{
  background: rgba(7, 12, 20, .50);
  border-color: rgba(255, 255, 255, .07);
  color: rgba(232, 238, 246, .48);
  font-size: 11.5px;
}

.price-scale{
  position:absolute; top:0; right:0;
  width: 74px; height:100%;
  border-left: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(15,22,32,.35), rgba(0,0,0,.08));
  box-shadow: inset 10px 0 24px rgba(0,0,0,.22);
  cursor: ns-resize;
  pointer-events: auto;
  touch-action: none;
}
.time-scale{
  position:absolute; left:0; bottom:0;
  height: 28px; width:100%;
  border-top: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(90deg, rgba(15,22,32,.32), rgba(0,0,0,.08));
  box-shadow: inset 0 10px 24px rgba(0,0,0,.18);
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
}

/* === BOTTOM BAR === */
.bottom-bar{
  position:sticky;
  bottom: 0;
  z-index: 45;
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap:wrap;
  padding: 8px 10px;
  min-height: 52px;
  border-radius: var(--radius-2);
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 26px rgba(0,0,0,.22);
  padding-bottom: calc(8px + var(--tabbar-safe));
}

/* Séparateurs de groupes — plus visibles dans ce contexte */
.bottom-bar .divider-v{
  height: 26px;
  background: rgba(255,255,255,.15);
  margin: 0 2px;
  flex-shrink: 0;
}

/* TF field — léger shrink autorisé */
.bottom-bar .field.tf-field{
  flex-shrink: 1;
  min-width: 90px;
}

/* Menu — utilitaire, discret */
#menuBtn{
  flex-shrink: 0;
  min-width: 52px;
  font-size: 12.5px;
  color: rgba(232,238,246,.65);
}
#menuBtn:hover{ color: var(--text); }

/* PLAY — action centrale, doit dominer */
#btnPlay{
  flex-shrink: 0;
  min-width: 70px;
  background: linear-gradient(155deg, rgba(122,162,255,.44), rgba(80,118,220,.26));
  border-color: rgba(122,162,255,.62);
  box-shadow: 0 6px 18px rgba(80,118,220,.22);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .05em;
}
#btnPlay:hover{
  background: linear-gradient(155deg, rgba(122,162,255,.58), rgba(80,118,220,.38));
  border-color: rgba(122,162,255,.80);
  box-shadow: 0 8px 24px rgba(80,118,220,.34);
  filter: none;
}

/* +1 / +5 — steps secondaires, atténués pour ne pas concurrencer Play */
#btnFwd1, #btnFwd5{
  flex-shrink: 0;
  min-width: 40px;
  font-weight: 700;
  font-size: 12.5px;
  color: rgba(232,238,246,.68);
  border-color: rgba(255,255,255,.08);
}
#btnFwd1:hover, #btnFwd5:hover{ color: var(--text); border-color: rgba(255,255,255,.14); }

/* Recentrer — utilitaire, peut shrink */
#btnRecenter{
  flex-shrink: 1;
  font-size: 12.5px;
  color: rgba(232,238,246,.75);
}
#btnRecenter:hover{ color: var(--text); }

/* Fin session — action destructive : tint danger subtil */
#btnEndSession{
  flex-shrink: 0;
  color: rgba(255, 140, 140, .88);
  border-color: rgba(255, 92, 92, .26);
  background: rgba(255, 60, 60, .07);
  font-size: 12.5px;
}
#btnEndSession:hover{
  background: rgba(255, 60, 60, .15);
  border-color: rgba(255, 92, 92, .46);
  color: rgba(255, 165, 165, 1);
  filter: none;
}

/* Outils — distinct sans être prioritaire */
#btnToolMenu{
  flex-shrink: 0;
  font-weight: 700;
  font-size: 12.5px;
}

.chart-quickbar{
  display: none;
}

.tool-menu-wrap{
  position: relative;
}

.tool-menu{
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 156px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(8,13,22,.98);
  box-shadow: 0 18px 42px rgba(0,0,0,.56), 0 6px 14px rgba(0,0,0,.32);
  backdrop-filter: blur(12px);
  z-index: 70;
}
.tool-menu.show{ display: flex; }

.tool-menu-item{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  cursor: pointer;
}
.tool-menu-item:hover{
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
}
.tool-menu-item.active{
  border-color: color-mix(in srgb, var(--acc) 50%, white 10%);
  background: color-mix(in srgb, var(--acc) 22%, transparent);
}

.tool-context-bar{
  position: absolute;
  top: 12px;
  right: 86px;
  z-index: 26;
  max-width: min(82vw, 760px);
  min-width: 320px;
  padding: 10px;
  border-radius: var(--radius-2);
  border: 1px solid rgba(103,183,255,.24);
  background: rgba(7,11,20,.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 34px rgba(0,0,0,.52);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.tool-context-bar[hidden]{ display: none !important; }

.tool-context-actions{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.tool-context-actions button[disabled]{
  opacity: .62;
  cursor: not-allowed;
}

.ctx-control{
  position: relative;
}

.tool-context-drag{
  min-width: 34px;
  min-height: 34px;
  padding: 4px 8px;
  cursor: move;
}

.tool-context-delete{
  min-width: 40px;
  min-height: 34px;
  padding: 4px 10px;
}

.ctx-menu-btn{
  min-width: 112px;
}

.ctx-menu-panel{
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(9,14,24,.97);
  box-shadow: 0 16px 38px rgba(0,0,0,.54), 0 4px 12px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
  z-index: 40;
  color-scheme: dark;
}

.ctx-control.open .ctx-menu-panel{
  display: grid;
  gap: 6px;
}

.ctx-menu-panel label{
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(148,186,222,.66);
}

.ctx-menu-panel input[type="color"],
.ctx-menu-panel input[type="number"],
.ctx-menu-panel input[type="range"],
.ctx-menu-panel textarea,
.ctx-menu-panel select{
  width: 100%;
}

.ctx-menu-panel input[type="color"]{
  height: 36px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.26);
  cursor: pointer;
}
.ctx-menu-panel input[type="color"]::-webkit-color-swatch-wrapper{
  padding: 0;
}
.ctx-menu-panel input[type="color"]::-webkit-color-swatch{
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
}

.ctx-menu-panel input[type="range"]{
  accent-color: var(--accent);
}
.ctx-menu-panel input[type="number"],
.ctx-menu-panel select,
.ctx-menu-panel textarea{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.26);
  color: var(--text);
  border-radius: 10px;
}

.ctx-menu-panel textarea{
  min-height: 64px;
  resize: vertical;
}

.ctx-check{
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctx-check input[type="checkbox"]{
  width: auto;
}

.fib-levels-panel{
  min-width: 300px;
}

.fib-level-row{
  display: grid;
  grid-template-columns: auto 64px 44px 1fr;
  gap: 8px;
  align-items: center;
}

.fib-level-label{
  font-size: 12px;
  color: rgba(232,238,246,.95);
}

/* ─── CTX PANEL — inputs, sliders, focus, overflow ─── */

/* number + select: padding, font, focus */
.ctx-menu-panel input[type="number"],
.ctx-menu-panel select{
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  min-height: 34px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ctx-menu-panel input[type="number"]:focus,
.ctx-menu-panel select:focus{
  border-color: rgba(103,183,255,.42);
  box-shadow: 0 0 0 2px rgba(103,183,255,.12);
}

/* textarea: padding, no layout-shift resize, focus */
.ctx-menu-panel textarea{
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.45;
  resize: none;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ctx-menu-panel textarea:focus{
  border-color: rgba(103,183,255,.42);
  box-shadow: 0 0 0 2px rgba(103,183,255,.12);
}

/* color input focus ring */
.ctx-menu-panel input[type="color"]:focus-visible{
  outline: 2px solid rgba(103,183,255,.52);
  outline-offset: 2px;
}

/* range slider — track + thumb (WebKit / Blink) */
.ctx-menu-panel input[type="range"]{
  height: 20px;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.ctx-menu-panel input[type="range"]::-webkit-slider-runnable-track{
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.14);
}
.ctx-menu-panel input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(103,183,255,.22);
  transition: box-shadow .12s ease;
}
.ctx-menu-panel input[type="range"]::-webkit-slider-thumb:hover{
  box-shadow: 0 0 0 4px rgba(103,183,255,.26);
}
/* range slider — Firefox */
.ctx-menu-panel input[type="range"]::-moz-range-track{
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.14);
}
.ctx-menu-panel input[type="range"]::-moz-range-thumb{
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 2px rgba(103,183,255,.22);
  transition: box-shadow .12s ease;
}

/* fib panel: overflow guard for many rows */
.fib-levels-panel{
  max-height: min(60vh, 420px);
  overflow-y: auto;
}

/* tool-menu-item keyboard focus ring */
.tool-menu-item:focus-visible{
  outline: 2px solid rgba(103,183,255,.60);
  outline-offset: -1px;
}

@media(max-width:900px){
  html.page-chart-active,
  body.page-chart-active{
    overflow: hidden;
    overscroll-behavior: none;
    height: 100dvh;
  }
  body.page-chart-active .content{
    padding-bottom: var(--sp-2);
    overflow: hidden;
  }
  body.page-chart-active #page-chart{
    height: calc(100dvh - 8px);
    overflow: hidden;
  }
  body.page-chart-active #page-chart .chart-shell{
    height: 100%;
    gap: 8px;
    padding-bottom: 0;
  }
  body.page-chart-active #page-chart .plot-area{
    flex: 1 1 auto;
    min-height: 0;
  }
  body.page-chart-active #page-chart .canvas-wrap{
    min-height: 0;
    height: 100%;
  }

  .trade-bar{
    grid-template-columns: 1fr 60px 1fr;
    padding: 7px;
    gap: 7px;
  }
  .trade-btn{
    min-height: 64px;
    padding: 10px 10px;
    border-radius: 13px;
  }
  .trade-btn .lbl{
    font-size: 12px;
    letter-spacing: .12em;
  }
  .trade-btn .px{
    font-size: 13px;
  }
  .trade-mid.trade-mid-btn{
    width: 60px;
  }
  .canvas-wrap{
    min-height: 66vh;
  }

  .content{
    overflow-x: clip;
  }
  .row{
    flex-wrap: wrap;
  }
  .card,
  .stat,
  .pill,
  .j-card,
  .j-reviewItem,
  .hub-card{
    min-width: 0;
    max-width: 100%;
  }
  .j-cardTop{
    flex-direction: column;
    align-items: flex-start;
  }
  .j-rightMeta{
    align-items: flex-start;
  }
  .j-title,
  .j-sub{
    overflow-wrap: anywhere;
  }

  .bottom-bar{
    gap: 8px;
    padding: 8px;
    flex-wrap: wrap;
  }
  .bottom-bar .divider-v{
    display: none;
  }
  .bottom-bar .field.tf-field{
    min-width: 90px !important;
    flex-shrink: 1;
  }
  .bottom-bar > button,
  .bottom-bar .field select{
    min-height: 42px;
  }
  /* Hiérarchie préservée sur mobile */
  #btnPlay{
    min-width: 64px;
  }
  #btnFwd1, #btnFwd5{
    min-width: 38px;
  }
  #btnEndSession{
    font-size: 12px;
  }

  .chart-quickbar{
    display: none !important;
  }
  .quick-btn{
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    color: var(--text);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .01em;
    padding: 0 6px;
  }
  .quick-btn.is-active{
    border-color: rgba(122,162,255,.56);
    background: rgba(122,162,255,.22);
  }
  .quick-btn.quick-delete{
    border-color: rgba(255,92,92,.38);
    background: rgba(255,92,92,.16);
  }
  .quick-btn.quick-more{
    border-color: rgba(247,200,67,.38);
    background: rgba(247,200,67,.16);
  }

  .tool-menu{
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(58px + var(--tabbar-safe));
    min-width: 0;
    border-radius: 16px;
    padding: 10px;
    max-height: 56vh;
    overflow: auto;
    z-index: 95;
  }
  .tool-menu.show{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .tool-menu-item{
    justify-content: center;
    min-height: 46px;
    font-weight: 700;
  }

  .tool-context-bar{
    position: fixed;
    top: auto;
    right: 8px;
    left: 8px;
    bottom: calc(60px + var(--tabbar-safe));
    min-width: 0;
    max-width: none;
    max-height: 46vh;
    overflow: auto;
    z-index: 96;
    border-radius: 14px;
    padding: 8px;
    gap: 6px;
  }
  .tool-context-drag{
    display: none;
  }
  .tool-context-actions{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .ctx-menu-btn{
    min-width: 0;
    width: 100%;
    justify-content: center;
  }
  .ctx-menu-panel{
    position: fixed;
    left: 12px;
    right: 12px;
    top: 18vh;
    max-height: 64vh;
    overflow: auto;
    min-width: 0;
    z-index: 110;
  }
  .fib-levels-panel{
    min-width: 0;
  }
  .fib-level-row{
    grid-template-columns: auto 58px 40px 1fr;
  }
}

@media (max-width:700px){
  .hub-session-card{
    padding: 12px;
  }
  .hub-session-layout{
    grid-template-columns: 84px minmax(0,1fr);
    gap: 8px;
    align-items: stretch;
  }
  .hub-session-visual{
    display: flex;
    grid-column: 1;
    grid-row: 2 / span 2;
    padding: 4px;
    min-height: 112px;
  }
  .hub-mini-chart{
    min-height: 100px;
    height: 100%;
  }
  .hub-session-main{
    display: contents;
  }
  .hub-session-head{
    grid-column: 1 / -1;
    grid-row: 1;
    align-items: center;
  }
  .hub-session-title{
    font-size: 18px !important;
    line-height: 1.12;
    letter-spacing: .01em;
    text-transform: none !important;
  }
  .hub-session-lead{
    display: none;
  }
  .hub-session-grid{
    grid-column: 2;
    grid-row: 2;
    margin-top: 0;
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .hub-session-grid .hub-session-stat{
    display: none;
  }
  .hub-session-grid .hub-session-field{
    margin: 0;
  }
  .hub-session-grid .hub-session-field select{
    height: 42px;
  }
  .hub-session-stat{
    border: none;
    background: transparent;
    padding: 0;
    min-height: 0;
  }
  .hub-session-stat .k{
    display: none;
  }
  .hub-session-stat .v{
    font-size: 12px;
    color: rgba(232,238,246,.82);
  }
  .hub-progress{
    grid-column: 2;
    grid-row: 3;
    margin-top: 6px;
    height: 10px;
  }
  .hub-session-hint{
    display: none;
  }
  .hub-mini-chart .hub-mini-candle{
    width: 6px;
  }
  .hub-mini-chart .hub-mini-candle:nth-of-type(1){ left: 16%; }
  .hub-mini-chart .hub-mini-candle:nth-of-type(2){ left: 30%; }
  .hub-mini-chart .hub-mini-candle:nth-of-type(3){ left: 44%; }
  .hub-mini-chart .hub-mini-candle:nth-of-type(4){ left: 58%; }
  .hub-mini-chart .hub-mini-candle:nth-of-type(5){ left: 72%; }
  .hub-mini-chart .hub-mini-candle:nth-of-type(n+6){
    display: none;
  }
  .hub-mini-chart .hub-mini-scanline{
    opacity: .55;
  }
}

/* Backdrops */
.drawer-backdrop{
  display:none;
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 60;
}
.drawer-backdrop.show{ display:block; }
#toolMenuBackdrop{
  z-index: 44;
  background: rgba(0,0,0,.36);
  backdrop-filter: blur(2px);
}

/* Responsive (sidebar + drawer) */
@media(max-width:979px){
  .app{ grid-template-columns: 1fr; }

  .sidebar{
    position:fixed;
    left:0; top:0; bottom:0;
    width: 84vw;
    max-width: 330px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 80;
  }
  .sidebar.open{ transform: translateX(0); }

  .content{
    padding: var(--sp-3);
    padding-bottom: calc(var(--sp-3) + var(--tabbar-h) + var(--tabbar-safe));
  }

  .tabbar{ padding-left: 10px; padding-right: 10px; gap: 8px; }
  :root{ --tab-btn-h: 48px; } /* cibles tactiles ≥48px (a11y) */
}

/* Segmented control interne des Stats (affiché en desktop, cf. media ≥980px ;
   masqué en mobile où #statsTabbar prend le relais). */
.stats-segments{
  display: none;
  gap: 6px;
  margin-bottom: var(--sp-4);
  padding: 4px;
  border-radius: var(--radius-2);
  background: rgba(0,0,0,.22);
  border: 1px solid var(--stroke-1);
}
.stats-seg{
  flex: 1 1 auto;
  padding: 9px 12px;
  border-radius: var(--radius-1);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: var(--fs-3);
  font-weight: var(--fw-semibold, 700);
  cursor: pointer;
  transition: background var(--dur-2,180ms) var(--ease-out,ease), color var(--dur-2,180ms) var(--ease-out,ease);
}
.stats-seg:hover{ color: var(--text); background: rgba(255,255,255,.04); }
.stats-seg.is-active{
  color: #eaf4ff;
  background: linear-gradient(180deg, rgba(103,183,255,.26), rgba(80,148,220,.16));
  border-color: rgba(103,183,255,.5);
}
.stats-seg:focus-visible{ outline: 2px solid rgba(103,183,255,.9); outline-offset: 2px; }

/* Desktop (≥980px) : la sidebar fait office de navigation → on masque la
   tabbar mobile (sinon double navigation) et on supprime le padding-bas
   fantôme réservé à la tabbar (la grande bande noire vide en bas de page).
   !important temporaire : neutralise l'attribut [hidden]/classes par page
   en attendant le pilotage par classe sur <body> (cf. roadmap nav). */
@media(min-width:980px){
  #tabbar, #statsTabbar{ display:none !important; }
  .content{ padding-bottom: var(--sp-4); }

  /* Stats desktop : #statsTabbar est masqué (ci-dessus) → on affiche le
     segmented control interne, qui pilote UN pane à la fois (les panes
     gardent leur comportement .is-active normal). En mobile, #statsTabbar
     assure la navigation et .stats-segments reste masqué. */
  .stats-segments{ display: flex; }

  /* Chart : top-bar SELL/BUY recentrée et bornée (au lieu de 2 boutons
     étirés bord à bord). align-self:center évite le shrink-to-content que
     provoque margin:auto dans le flex colonne. Mobile = pleine largeur. */
  .trade-bar{ width: 100%; max-width: 560px; align-self: center; }

  /* Bottom-bar en 2 clusters : lecture/TF à gauche, session/outils à droite. */
  .bottom-bar #btnFwd5 + .divider-v{ display: none; }
  .bottom-bar #btnRecenter{ margin-left: auto; }
}

/* Toasts */
.toast-wrap{
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + 12px);
  z-index: 11000;
  display:flex;
  flex-direction:column;
  gap: 10px;
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(15,22,32,.88);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  transform: translateY(10px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
  font-size: 13px;
}
.toast.show{ transform: translateY(0); opacity: 1; }

/* Couleur par type (F: ux-a11y A3) — accent gauche + teinte de fond */
.toast-success{ border-left: 4px solid #2ecc71; background: linear-gradient(90deg, rgba(46,204,113,.16), rgba(15,22,32,.88) 60%); }
.toast-error{   border-left: 4px solid #e74c3c; background: linear-gradient(90deg, rgba(231,76,60,.18), rgba(15,22,32,.88) 60%); }
.toast-warn{    border-left: 4px solid #f1c40f; background: linear-gradient(90deg, rgba(241,196,15,.16), rgba(15,22,32,.88) 60%); }
.toast-info{    border-left: 4px solid #3498db; background: linear-gradient(90deg, rgba(52,152,219,.16), rgba(15,22,32,.88) 60%); }

/* Scrollbar */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.10);
  border: 2px solid rgba(0,0,0,.35);
  border-radius: 999px;
}
*::-webkit-scrollbar-track{ background: rgba(0,0,0,.18); }

/* -----------------------------------------------------------------------
   LOGIN OVERLAY
   ----------------------------------------------------------------------- */
.login-overlay{
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,10,16,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.login-overlay[hidden]{ display:none; }

.login-card{
  width: 340px;
  max-width: 92vw;
  padding: 36px 28px 28px;
  background: linear-gradient(168deg, rgba(30,34,46,.95), rgba(18,20,28,.98));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.login-pitch{
  margin: -4px 0 4px;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.login-or{
  width: 100%;
  text-align: center;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--muted2);
  margin: 4px 0 -2px;
}
/* Boutons login pleine largeur (mode local = action primaire) */
.login-card .primary,
.login-card .ghost{ width: 100%; }

.login-logo{
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 0 18px rgba(247,200,67,.25));
}

.login-title{
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #e8eef6;
  letter-spacing: -.01em;
}

.login-card input{
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(0,0,0,.28);
  color: #e8eef6;
  font-size: .92rem;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: border-color .15s ease;
}
.login-card input::placeholder{
  color: rgba(255,255,255,.35);
}
.login-card input:focus{
  border-color: rgba(247,200,67,.55);
  box-shadow: 0 0 0 3px rgba(247,200,67,.10);
}

.login-card button{
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #f7c843 0%, #e0a82e 100%);
  color: #1a1c24;
  font-family: 'Space Grotesk', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease, transform .1s ease;
}
.login-card button:hover{ opacity:.9; }
.login-card button:active{ transform:scale(.98); }
.login-card button:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.login-error{
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,80,80,.12);
  color: #ff6b6b;
  font-size: .82rem;
  text-align: center;
  width: 100%;
}
.login-error[hidden]{ display:none; }

/* Profile logout menu */
.profile-menu{
  position: absolute;
  top: 52px;
  left: 12px;
  z-index: 1000;
  min-width: 160px;
  padding: 6px;
  background: rgba(24,26,34,.96);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.profile-menu[hidden]{ display:none; }

.profile-menu button{
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #e8eef6;
  font-size: .88rem;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background .12s ease;
}
.profile-menu button:hover{
  background: rgba(255,255,255,.08);
}

/* -----------------------------------------------------------------------
   LOGIN TOGGLE LINK
   ----------------------------------------------------------------------- */
.login-toggle-link{
  color: rgba(255,255,255,.45);
  font-size: .8rem;
  font-family: 'Space Grotesk', sans-serif;
  text-decoration: none;
  transition: color .15s ease;
}
.login-toggle-link:hover{
  color: rgba(247,200,67,.8);
}

#loginInviteGroup{
  width: 100%;
}
#loginInviteGroup[hidden]{ display:none; }

/* -----------------------------------------------------------------------
   FRIEND POPUP
   ----------------------------------------------------------------------- */
.friend-popup{
  position: absolute;
  z-index: 10000;
  width: 260px;
  padding: 16px;
  background: rgba(24,26,34,.97);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04) inset;
  transform: translateX(-50%);
  animation: friendPopupIn .15s ease;
}

@keyframes friendPopupIn{
  from{ opacity:0; transform:translateX(-50%) translateY(-6px); }
  to{ opacity:1; transform:translateX(-50%) translateY(0); }
}

.friend-popup-header{
  margin-bottom: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: .88rem;
  font-weight: 600;
  color: #e8eef6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-popup-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.friend-popup-stat{
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}

.friend-popup-label{
  font-size: .68rem;
  color: rgba(255,255,255,.45);
  font-family: 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.friend-popup-value{
  font-size: .92rem;
  font-weight: 600;
  color: #e8eef6;
  font-family: 'JetBrains Mono', monospace;
}

/* =========================================================================
   FORMULAIRES GROUPÉS — primitives réutilisables
   Sections à kicker + grille responsive + barre d'actions sticky.
   Utilisé d'abord par la page Trade ; réutilisable Setup / Simulator.
========================================================================= */
.form-section{ margin-top: var(--sp-5); }
.form-section:first-of-type{ margin-top: var(--sp-4); }
/* Séparateur fin entre sections successives */
.form-section + .form-section,
.trade-real-card details.u-mt12,
.form-section + details{
  padding-top: var(--sp-5);
  border-top: 1px solid var(--stroke-1);
}
.form-section-kicker{
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-1);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(103,183,255,.8);
}
/* Grille de champs : 3 → 2 → 1 (au lieu du brutal 3 → 1) */
.form-grid{
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 760px){ .form-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 360px){ .form-grid{ grid-template-columns: 1fr; } }

/* Sections repliables (Trade management / Journaling) : summary = en-tête */
.trade-real-card details > summary{
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-3);
  font-weight: var(--fw-semibold);
  letter-spacing: .02em;
  color: var(--text);
  padding: 2px 0;
}
.trade-real-card details > summary::-webkit-details-marker{ display: none; }
.trade-real-card details > summary::before{
  content: "▸";
  color: rgba(103,183,255,.8);
  transition: transform var(--dur-2) var(--ease-out);
}
.trade-real-card details[open] > summary::before{ transform: rotate(90deg); }

/* Barre d'actions sticky : action primaire dominante à droite */
.form-actionbar{
  position: sticky;
  bottom: var(--sp-3);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-5);
  padding: var(--sp-3);
  border-radius: var(--radius-2);
  background: var(--glass2);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
}
.form-actionbar-spacer{ flex: 1 1 auto; }
.form-actionbar-cta{ min-width: 180px; font-weight: var(--fw-semibold); }
/* En mobile, la tabbar fixe occupe le bas → on remonte la barre au-dessus */
@media (max-width: 979px){
  .form-actionbar{ bottom: calc(var(--tabbar-h) + var(--sp-2)); }
}

/* =========================================================================
   SETUP — 2 colonnes : résumé dataset (sticky) à gauche / config à droite.
========================================================================= */
/* KPIs dataset : strip compacte 3 colonnes, même sur mobile
   (au lieu de 3 cartes pleine largeur = 3 écrans pour 3 nombres). */
.setup-kpis{ grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }

.setup-col-main + .setup-col-config{ margin-top: var(--sp-4); }
@media (min-width: 1000px){
  .setup-shell{
    display: grid;
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
    gap: var(--sp-4);
    align-items: start;
  }
  .setup-col-main{ position: sticky; top: var(--sp-4); }
  .setup-col-main + .setup-col-config{ margin-top: 0; }
}

/* =========================================================================
   RÉCAP DE FIN DE SESSION — referme la boucle (rejouer → bilan → Journal/Stats)
========================================================================= */
.wp-recap-overlay{
  position: fixed; inset: 0;
  z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  animation: wpRecapFade var(--dur-2, 180ms) var(--ease-out, ease);
}
@keyframes wpRecapFade{ from{ opacity:0; } to{ opacity:1; } }
.wp-recap-card{
  width: min(420px, 94vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: center;
}
.wp-recap-kicker{
  font-size: var(--fs-1, 11px);
  letter-spacing: .12em;
  color: rgba(103,183,255,.8);
}
.wp-recap-title{ margin: 2px 0 0; font-size: var(--fs-6, 20px); }
.wp-recap-sub{ margin: 0; color: var(--muted); font-size: var(--fs-3, 13px); }
.wp-recap-actions{
  margin-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  width: 100%;
}
.wp-recap-actions button{ flex: 1 1 auto; min-width: 120px; }
@media (prefers-reduced-motion: reduce){ .wp-recap-overlay{ animation: none; } }

/* C3 — modale comparative réel vs backtest */
.wp-compare-card{ width: min(480px, 94vw); }
.wp-compare-score{
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill, 999px);
  font-weight: var(--fw-semibold, 700);
  font-size: var(--fs-3, 13px);
}
.wp-compare-good{ background: rgba(126,224,129,.16); border: 1px solid rgba(126,224,129,.45); color: #b6f0c4; }
.wp-compare-mid{ background: rgba(255,206,110,.14); border: 1px solid rgba(255,206,110,.4); color: #ffdf9f; }
.wp-compare-bad{ background: rgba(255,116,116,.14); border: 1px solid rgba(255,116,116,.4); color: #ffb2b2; }
.wp-compare-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  width: 100%;
  margin-top: var(--sp-2);
  text-align: left;
}
.wp-compare-col{
  border: 1px solid var(--stroke-1);
  border-radius: var(--radius-1);
  padding: var(--sp-3);
  font-size: var(--fs-3, 13px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}
.wp-compare-col b{ color: var(--text); }
.wp-compare-h{ font-size: var(--fs-1, 11px); text-transform: uppercase; letter-spacing: .08em; color: rgba(103,183,255,.8); margin-bottom: 2px; }
.wp-compare-delta{ margin-top: var(--sp-2); font-size: var(--fs-3, 13px); color: var(--muted); }
.wp-compare-delta b{ color: var(--text); }
