/**
 * ══════════════════════════════════════════════════════════════
 *  BBTrade — Design System
 *  v2.0.0 — Bloomberg Terminal × Crypto Luxury
 * ══════════════════════════════════════════════════════════════
 *
 *  Fichier unique de référence pour tous les composants BBTrade.
 *  À importer dans chaque page après les polices Google Fonts.
 *
 *  Sections :
 *    1.  Design Tokens         — variables CSS (couleurs, espacements…)
 *    2.  Reset & Base          — normalisation, body, scrollbar
 *    3.  Typography            — fonts, headings, code, liens
 *    4.  Layout Primitives     — container, grid, stack, cluster
 *    5.  Buttons               — btn, btn-primary, btn-ghost, btn-icon
 *    6.  Forms                 — input, label, field, errors, checkbox
 *    7.  Cards                 — card, card-header, card-body, card-ticker
 *    8.  Badges & Pills        — up/down/neutral/info
 *    9.  Tables                — data tables, ticker tables
 *   10.  Toasts & Alerts       — notifications éphémères
 *   11.  Modals                — overlay, confirm, slide-up mobile
 *   12.  Topbar & Nav          — header global, mobile sidebar
 *   13.  Utilities             — .text-*, .bg-*, .flex, .gap, .hidden
 *   14.  Animations            — keyframes (pulse, slide, fade…)
 *   15.  Responsive            — breakpoints tablet / mobile
 *
 *  Design principles :
 *    - Dark-first (fond noir, accents rouge BBTrade)
 *    - Monospace pour données/chiffres (DM Mono)
 *    - Display serif-less pour titres (Syne)
 *    - Condensé pour gros chiffres tickers (Barlow Condensed)
 *    - Tout en CSS pur — zero framework
 * ══════════════════════════════════════════════════════════════
 */


/* ══════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ══════════════════════════════════════════════════════════════ */
:root {

  /* ── COULEURS ── identité BBTrade ────────────────────────── */

  /* Fonds — du plus sombre au plus clair */
  --bg-0:           #000000;                  /* pur noir, rare */
  --bg:             #080808;                  /* body principal */
  --bg-1:           #0f0f0f;                  /* cards, panels */
  --bg-2:           #141414;                  /* inputs, nested */
  --bg-3:           #1a1a1a;                  /* hover, ticker rows */
  --bg-4:           #222222;                  /* pressed, active */

  /* Texte */
  --text:           #e8e8e8;                  /* texte principal */
  --text-dim:       #999999;                  /* texte secondaire */
  --text-muted:     #666666;                  /* labels, hints */
  --text-faint:     #444444;                  /* placeholder, disabled */

  /* Rouge BBTrade — identité de marque */
  --red:            #D2282D;                  /* rouge principal */
  --red-hover:      #E5343A;                  /* hover states */
  --red-active:     #B01E23;                  /* pressed states */
  --red-10:         rgba(210, 40, 45, 0.10);  /* glow, ambient */
  --red-15:         rgba(210, 40, 45, 0.15);
  --red-25:         rgba(210, 40, 45, 0.25);
  --red-35:         rgba(210, 40, 45, 0.35);

  /* Sémantique financière */
  --up:             #00e676;                  /* gain, hausse, success */
  --up-10:          rgba(0, 230, 118, 0.10);
  --up-25:          rgba(0, 230, 118, 0.25);
  --down:           #ff4757;                  /* perte, baisse */
  --down-10:        rgba(255, 71, 87, 0.10);
  --down-25:        rgba(255, 71, 87, 0.25);
  --warn:           #F0B90B;                  /* warning, pending */
  --warn-10:        rgba(240, 185, 11, 0.10);
  --warn-25:        rgba(240, 185, 11, 0.25);
  --info:           #4dabf7;                  /* info, neutral action */
  --info-10:        rgba(77, 171, 247, 0.10);

  /* Bordures — du plus subtil au plus visible */
  --border:         rgba(255, 255, 255, 0.06);
  --border-mid:     rgba(255, 255, 255, 0.12);
  --border-strong:  rgba(255, 255, 255, 0.20);

  /* ── TYPOGRAPHIE ────────────────────────────────────────── */
  --font-display:   'Syne', 'SF Pro Display', -apple-system, sans-serif;
  --font-mono:      'DM Mono', 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  --font-condensed: 'Barlow Condensed', 'Impact', sans-serif;

  /* Tailles — échelle modulaire */
  --fs-xs:    0.68rem;   /* labels, hints, timestamps */
  --fs-sm:    0.75rem;   /* body small, captions */
  --fs-base:  0.85rem;   /* body default — dense, terminal style */
  --fs-md:    0.95rem;   /* body large, buttons */
  --fs-lg:    1.1rem;    /* card titles */
  --fs-xl:    1.4rem;    /* section titles */
  --fs-2xl:   1.8rem;    /* page titles */
  --fs-3xl:   2.4rem;    /* hero, big numbers */
  --fs-4xl:   3.2rem;    /* dashboard big stats */

  /* Graisses */
  --fw-normal:  400;
  --fw-medium:  500;
  --fw-bold:    700;
  --fw-black:   800;

  /* Line-heights */
  --lh-tight:   1.1;
  --lh-normal:  1.5;
  --lh-loose:   1.7;

  /* Letter-spacing — serré pour titres, lâche pour labels */
  --ls-tight:    -0.02em;
  --ls-normal:   0;
  --ls-wide:     0.04em;
  --ls-wider:    0.08em;    /* labels UPPERCASE */
  --ls-widest:   0.12em;    /* micro labels */

  /* ── ESPACEMENTS ─────────────────────────────────────────── */
  --sp-0:    0;
  --sp-1:    0.25rem;       /* 4px */
  --sp-2:    0.5rem;        /* 8px */
  --sp-3:    0.75rem;       /* 12px */
  --sp-4:    1rem;          /* 16px */
  --sp-5:    1.25rem;       /* 20px */
  --sp-6:    1.5rem;        /* 24px */
  --sp-8:    2rem;          /* 32px */
  --sp-10:   2.5rem;        /* 40px */
  --sp-12:   3rem;          /* 48px */
  --sp-16:   4rem;          /* 64px */

  /* ── RADIUS ──────────────────────────────────────────────── */
  --r-xs:    3px;
  --r-sm:    6px;
  --r-md:    10px;
  --r-lg:    14px;
  --r-xl:    20px;
  --r-pill:  999px;

  /* ── SHADOWS ─────────────────────────────────────────────── */
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:    0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-red:   0 0 0 3px var(--red-15);
  --shadow-up:    0 0 0 3px var(--up-25);
  --shadow-down:  0 0 0 3px var(--down-25);

  /* ── TRANSITIONS ─────────────────────────────────────────── */
  --t-fast:    0.12s ease;
  --t-base:    0.2s ease;
  --t-slow:    0.4s ease;
  --t-bounce:  0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── LAYOUT ──────────────────────────────────────────────── */
  --container-max:   1280px;
  --container-pad:   1.5rem;
  --topbar-h:        56px;
  --sidebar-w:       240px;
  --z-dropdown:      100;
  --z-topbar:        200;
  --z-modal:         300;
  --z-toast:         400;
  --z-tooltip:       500;
}


/* ── LIGHT THEME — variable overrides ──────────────────────── */
html[data-theme="light"] {
  /* Fonds — palette off-white chaude, zéro blanc pur */
  --bg-0:           #e8e7e4;
  --bg:             #f3f2ef;   /* corps : papier légèrement teinté */
  --bg-1:           #f9f8f6;   /* cards : blanc cassé chaud */
  --bg-2:           #eeecea;   /* inputs, nested : contraste doux */
  --bg-3:           #e5e3df;   /* hover, lignes tableau */
  --bg-4:           #dad8d4;   /* pressed, actif */

  /* Texte — noir chaud, jamais pur */
  --text:           #1c1b18;
  --text-dim:       #3c3b42;
  --text-muted:     #6b6a70;
  --text-faint:     #a8a7ac;

  /* Bordures */
  --border:         rgba(0, 0, 0, 0.07);
  --border-mid:     rgba(0, 0, 0, 0.11);
  --border-strong:  rgba(0, 0, 0, 0.18);

  /* Ombres — légères pour ajouter la profondeur */
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow:         0 3px 12px rgba(0, 0, 0, 0.09);
  --shadow-lg:      0 8px 28px rgba(0, 0, 0, 0.12);

  /* Couleurs sémantiques — assombries pour lisibilité sur fond clair  */
  /* Vert neon #00e676 (4.5:1 requis) → forêt #1a7a3d (8.6:1 sur #f9f8f6) */
  --up:      #1a7a3d;
  --up-10:   rgba(26, 122, 61, 0.10);
  --up-25:   rgba(26, 122, 61, 0.22);

  /* Rouge #ff4757 (4.0:1) → carmin #c92a2a (7.4:1) */
  --down:    #c92a2a;
  --down-10: rgba(201, 42, 42, 0.10);
  --down-25: rgba(201, 42, 42, 0.22);

  /* Ambre #F0B90B (1.5:1 — illisible) → brun doré #a85d00 (7.1:1) */
  --warn:    #a85d00;
  --warn-10: rgba(168, 93, 0, 0.10);
  --warn-25: rgba(168, 93, 0, 0.22);

  /* Bleu ciel #4dabf7 (2.4:1) → bleu foncé #1971c2 (5.8:1) */
  --info:    #1971c2;
  --info-10: rgba(25, 113, 194, 0.10);
}


/* ══════════════════════════════════════════════════════════════
   2. RESET & BASE
   ══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust:         100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family:     var(--font-mono);
  font-size:       var(--fs-base);
  font-weight:     var(--fw-normal);
  line-height:     var(--lh-normal);
  letter-spacing:  var(--ls-normal);
  color:           var(--text);
  background:      var(--bg);
  min-height:      100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Ambiance visuelle BBTrade — radial discrets */
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 0%,   rgba(210, 40, 45, 0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 100%, rgba(210, 40, 45, 0.04), transparent 60%);
  background-attachment: fixed;
}

/* Scanlines subtiles — touche "terminal" */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0, 0, 0, 0.025) 2px,
    rgba(0, 0, 0, 0.025) 4px
  );
  pointer-events: none;
}

/* Réservation pour topbar si présente */
body[data-topbar="true"] {
  padding-top: var(--topbar-h);
}

/* ── Scrollbar custom (Webkit) ──────────────────────────────── */
::-webkit-scrollbar {
  width:  10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Scrollbar Firefox */
* {
  scrollbar-width:  thin;
  scrollbar-color:  var(--border-mid) var(--bg);
}

/* ── Sélection ─────────────────────────────────────────────── */
::selection {
  background: var(--red-25);
  color: var(--text);
}

/* ── Focus visible accessible ──────────────────────────────── */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ── Réduction de mouvement ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ══════════════════════════════════════════════════════════════
   3. TYPOGRAPHY
   ══════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text);
}

h1 { font-size: var(--fs-2xl); font-weight: var(--fw-black); }
h2 { font-size: var(--fs-xl);  font-weight: var(--fw-bold); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5 { font-size: var(--fs-base); letter-spacing: var(--ls-wider); text-transform: uppercase; }
h6 { font-size: var(--fs-xs);  letter-spacing: var(--ls-widest); text-transform: uppercase; color: var(--text-muted); }

p  { line-height: var(--lh-loose); color: var(--text-dim); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size:   0.92em;
}

code {
  padding: 0.15em 0.4em;
  background: var(--bg-2);
  border-radius: var(--r-xs);
  color: var(--red);
  border: 1px solid var(--border);
}

/* Liens */
a {
  color: var(--red);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover {
  color: var(--red-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Numérique monospace — pour chiffres alignés */
.num,
.mono {
  font-family:        var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Gros nombres condensés — tickers, stats dashboard */
.big-num {
  font-family:       var(--font-condensed);
  font-weight:       var(--fw-bold);
  font-size:         var(--fs-3xl);
  letter-spacing:    var(--ls-tight);
  line-height:       1;
  font-variant-numeric: tabular-nums;
}

/* Micro label — UPPERCASE espacé */
.label,
.micro {
  font-size:      var(--fs-xs);
  font-weight:    var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color:          var(--text-muted);
}

/* Séparateur texte — · · · */
.dot-sep::before {
  content: '·';
  margin: 0 0.5em;
  color: var(--text-faint);
}


/* ══════════════════════════════════════════════════════════════
   4. LAYOUT PRIMITIVES
   ══════════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  position: relative;
  z-index: 1;
}

.container-sm { max-width: 720px; }
.container-md { max-width: 960px; }
.container-lg { max-width: 1440px; }

/* Stack — colonne avec gap */
.stack     { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm  { gap: var(--sp-2); }
.stack-lg  { gap: var(--sp-6); }
.stack-xl  { gap: var(--sp-8); }

/* Cluster — ligne avec gap et wrap */
.cluster {
  display:    flex;
  flex-wrap:  wrap;
  gap:        var(--sp-4);
  align-items: center;
}
.cluster-sm { gap: var(--sp-2); }
.cluster-lg { gap: var(--sp-6); }

/* Grid responsive auto-fit */
.grid {
  display: grid;
  gap: var(--sp-4);
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Split — ligne flex équitable */
.split {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  gap:             var(--sp-4);
}

/* Center */
.center {
  display:         flex;
  align-items:     center;
  justify-content: center;
}


/* ══════════════════════════════════════════════════════════════
   5. BUTTONS
   ══════════════════════════════════════════════════════════════ */

.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             var(--sp-2);
  padding:         0.65rem 1.25rem;
  font-family:     var(--font-display);
  font-size:       var(--fs-base);
  font-weight:     var(--fw-bold);
  letter-spacing:  var(--ls-wide);
  border:          1px solid transparent;
  border-radius:   var(--r-sm);
  cursor:          pointer;
  text-decoration: none;
  color:           var(--text);
  background:      transparent;
  transition:      background var(--t-fast),
                   border-color var(--t-fast),
                   color var(--t-fast),
                   transform var(--t-fast),
                   box-shadow var(--t-fast);
  user-select:     none;
  white-space:     nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled              { opacity: 0.45; cursor: not-allowed; }

/* Primary — rouge BBTrade */
.btn-primary {
  background:    var(--red);
  color:         #fff;
  border-color:  var(--red);
}
.btn-primary:hover:not(:disabled) {
  background:    var(--red-hover);
  border-color:  var(--red-hover);
  text-decoration: none;
  color:         #fff;
}

/* Ghost — bordure seule */
.btn-ghost {
  background:   transparent;
  border-color: var(--border-mid);
  color:        var(--text);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--red);
  color:        var(--red);
  text-decoration: none;
}

/* Subtle — fond léger */
.btn-subtle {
  background:   var(--bg-2);
  border-color: var(--border);
  color:        var(--text);
}
.btn-subtle:hover:not(:disabled) {
  background:   var(--bg-3);
  border-color: var(--border-mid);
  text-decoration: none;
  color:        var(--text);
}

/* Up / Down — sémantiques trading */
.btn-up {
  background:   var(--up);
  color:        #000;
  border-color: var(--up);
}
.btn-up:hover:not(:disabled) {
  background: #00ff7f;
  color:      #000;
  text-decoration: none;
}

.btn-down {
  background:   var(--down);
  color:        #fff;
  border-color: var(--down);
}
.btn-down:hover:not(:disabled) {
  background: #ff5b69;
  color:      #fff;
  text-decoration: none;
}

/* Tailles */
.btn-sm { padding: 0.4rem 0.8rem;  font-size: var(--fs-sm); }
.btn-lg { padding: 0.85rem 1.75rem; font-size: var(--fs-md); }

.btn-block { width: 100%; }

/* Button icon only — carré */
.btn-icon {
  width:   2.25rem;
  height:  2.25rem;
  padding: 0;
  border-radius: var(--r-sm);
}


/* ══════════════════════════════════════════════════════════════
   6. FORMS
   ══════════════════════════════════════════════════════════════ */

.form-field {
  display:         flex;
  flex-direction:  column;
  gap:             var(--sp-2);
}

.form-label {
  font-size:      var(--fs-xs);
  font-weight:    var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color:          var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  width:          100%;
  padding:        0.65rem 0.85rem;
  font-family:    var(--font-mono);
  font-size:      var(--fs-base);
  color:          var(--text);
  background:     var(--bg-2);
  border:         1px solid var(--border);
  border-radius:  var(--r-sm);
  transition:     border-color var(--t-fast), box-shadow var(--t-fast);
  outline:        none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--red);
  box-shadow:   var(--shadow-red);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}

.form-textarea {
  min-height: 5rem;
  resize:     vertical;
  line-height: var(--lh-normal);
}

/* Select — chevron custom */
.form-select {
  appearance:          none;
  -webkit-appearance:  none;
  background-image:    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5L6 8L9 5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 0.75rem center;
  padding-right:       2.25rem;
}

/* État erreur */
.form-field.has-error .form-input,
.form-field.has-error .form-select,
.form-field.has-error .form-textarea {
  border-color: var(--down);
  box-shadow:   var(--shadow-down);
}
.form-error {
  font-size: var(--fs-xs);
  color:     var(--down);
}
.form-hint {
  font-size: var(--fs-xs);
  color:     var(--text-muted);
}

/* Checkbox / Radio */
.form-check {
  display:      inline-flex;
  align-items:  center;
  gap:          var(--sp-2);
  cursor:       pointer;
  user-select:  none;
  font-size:    var(--fs-sm);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width:        16px;
  height:       16px;
  accent-color: var(--red);
  cursor:       pointer;
}

/* Champ input avec préfixe/suffixe (ex: USDT, $) */
.input-group {
  display:    flex;
  align-items: stretch;
  border:     1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input-group:focus-within {
  border-color: var(--red);
  box-shadow:   var(--shadow-red);
}
.input-group .form-input {
  background:    transparent;
  border:        0;
  box-shadow:    none;
  padding:       0.65rem 0.5rem;
}
.input-group .form-input:focus {
  box-shadow: none;
}
.input-group-prefix,
.input-group-suffix {
  display:        flex;
  align-items:    center;
  padding:        0 0.75rem;
  font-size:      var(--fs-sm);
  color:          var(--text-muted);
  font-weight:    var(--fw-medium);
}
.input-group-prefix { border-right: 1px solid var(--border); }
.input-group-suffix { border-left:  1px solid var(--border); }


/* ══════════════════════════════════════════════════════════════
   7. CARDS
   ══════════════════════════════════════════════════════════════ */

.card {
  background:    var(--bg-1);
  border:        1px solid var(--border);
  border-radius: var(--r-md);
  overflow:      hidden;
  position:      relative;
  transition:    border-color var(--t-fast);
}

.card:hover {
  border-color: var(--border-mid);
}

/* Accent rouge en haut (variante signature BBTrade) */
.card-accent {
  border-top: 2px solid var(--red);
}

.card-glow {
  box-shadow: 0 0 40px -10px var(--red-10);
}

.card-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--sp-4) var(--sp-5);
  border-bottom:   1px solid var(--border);
  gap:             var(--sp-3);
}

.card-title {
  font-family:     var(--font-display);
  font-size:       var(--fs-base);
  font-weight:     var(--fw-bold);
  letter-spacing:  var(--ls-wider);
  text-transform:  uppercase;
  color:           var(--text);
}

.card-body {
  padding: var(--sp-5);
}

.card-footer {
  padding:     var(--sp-4) var(--sp-5);
  border-top:  1px solid var(--border);
  background:  var(--bg-2);
  font-size:   var(--fs-sm);
  color:       var(--text-muted);
}

/* Ticker card — variant pour données financières */
.card-ticker {
  padding:     var(--sp-5);
  background:  var(--bg-1);
  border:      1px solid var(--border);
  border-radius: var(--r-md);
  display:     flex;
  flex-direction: column;
  gap:         var(--sp-2);
}

.card-ticker .label {
  margin-bottom: 0.25rem;
}


/* ══════════════════════════════════════════════════════════════
   8. BADGES & PILLS
   ══════════════════════════════════════════════════════════════ */

.badge {
  display:         inline-flex;
  align-items:     center;
  gap:             0.3rem;
  padding:         0.2rem 0.55rem;
  font-family:     var(--font-mono);
  font-size:       var(--fs-xs);
  font-weight:     var(--fw-medium);
  letter-spacing:  var(--ls-wide);
  border-radius:   var(--r-pill);
  border:          1px solid transparent;
  line-height:     1.4;
  white-space:     nowrap;
}

.badge-up      { background: var(--up-10);   color: var(--up);   border-color: var(--up-25); }
.badge-down    { background: var(--down-10); color: var(--down); border-color: var(--down-25); }
.badge-warn    { background: var(--warn-10); color: var(--warn); border-color: var(--warn-25); }
.badge-info    { background: var(--info-10); color: var(--info); border-color: rgba(77,171,247,.25); }
.badge-red     { background: var(--red-15);  color: var(--red);  border-color: var(--red-35); }
.badge-neutral { background: var(--bg-2);    color: var(--text-dim); border-color: var(--border); }

/* Pill — variante plus marquée */
.pill {
  display:      inline-flex;
  align-items:  center;
  padding:      0.3rem 0.8rem;
  font-size:    var(--fs-xs);
  font-weight:  var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  border-radius: var(--r-pill);
}

/* Dot status — point coloré avant le texte */
.status-dot {
  display:       inline-block;
  width:         6px;
  height:        6px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right:  0.4rem;
}
.status-dot.live    { background: var(--up);   box-shadow: 0 0 8px var(--up);   animation: pulse-dot 2s infinite; }
.status-dot.paused  { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.status-dot.offline { background: var(--text-faint); }


/* ══════════════════════════════════════════════════════════════
   9. TABLES
   ══════════════════════════════════════════════════════════════ */

.table {
  width:           100%;
  border-collapse: collapse;
  font-size:       var(--fs-sm);
}

.table th,
.table td {
  padding:       0.65rem 0.85rem;
  text-align:    left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.table th {
  font-family:     var(--font-display);
  font-size:       var(--fs-xs);
  font-weight:     var(--fw-bold);
  letter-spacing:  var(--ls-wider);
  text-transform:  uppercase;
  color:           var(--text-muted);
  background:      var(--bg-2);
  border-bottom:   1px solid var(--border-mid);
  white-space:     nowrap;
}

.table tbody tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover {
  background: var(--bg-2);
}

.table td.num,
.table th.num {
  text-align: right;
  font-family: var(--font-mono);
}

/* Dense variant — plus compact */
.table-dense th,
.table-dense td {
  padding: 0.45rem 0.65rem;
  font-size: var(--fs-xs);
}


/* ══════════════════════════════════════════════════════════════
   10. TOASTS & ALERTS
   ══════════════════════════════════════════════════════════════ */

.alert {
  display:       flex;
  align-items:   flex-start;
  gap:           var(--sp-3);
  padding:       var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  border:        1px solid;
  font-size:     var(--fs-sm);
  line-height:   var(--lh-normal);
}

.alert-success { background: var(--up-10);   border-color: var(--up-25);   color: var(--up); }
.alert-error   { background: var(--down-10); border-color: var(--down-25); color: var(--down); }
.alert-warn    { background: var(--warn-10); border-color: var(--warn-25); color: var(--warn); }
.alert-info    { background: var(--info-10); border-color: rgba(77,171,247,.25); color: var(--info); }

/* Toast container — position fixe */
.toast-container {
  position:        fixed;
  top:             calc(var(--topbar-h) + var(--sp-4));
  right:           var(--sp-4);
  z-index:         var(--z-toast);
  display:         flex;
  flex-direction:  column;
  gap:             var(--sp-2);
  pointer-events:  none;
  max-width:       380px;
}

.toast {
  padding:       var(--sp-3) var(--sp-4);
  background:    var(--bg-1);
  border:        1px solid var(--border-mid);
  border-left:   3px solid var(--red);
  border-radius: var(--r-sm);
  box-shadow:    var(--shadow-lg);
  pointer-events: auto;
  animation:     slide-in-right var(--t-base);
  font-size:     var(--fs-sm);
  color:         var(--text);
}

.toast-success { border-left-color: var(--up); }
.toast-error   { border-left-color: var(--down); }
.toast-warn    { border-left-color: var(--warn); }


/* ══════════════════════════════════════════════════════════════
   11. MODALS
   ══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position:    fixed;
  inset:       0;
  background:  rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index:     var(--z-modal);
  display:     flex;
  align-items: center;
  justify-content: center;
  padding:     var(--sp-4);
  animation:   fade-in var(--t-base);
}

.modal {
  background:    var(--bg-1);
  border:        1px solid var(--border-mid);
  border-top:    2px solid var(--red);
  border-radius: var(--r-lg);
  max-width:     500px;
  width:         100%;
  max-height:    90vh;
  overflow-y:    auto;
  box-shadow:    var(--shadow-lg);
  animation:     modal-pop var(--t-bounce);
}

.modal-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--sp-5);
  border-bottom:   1px solid var(--border);
}

.modal-title {
  font-family:     var(--font-display);
  font-size:       var(--fs-lg);
  font-weight:     var(--fw-bold);
  letter-spacing:  var(--ls-wide);
}

.modal-close {
  background:  transparent;
  border:      0;
  color:       var(--text-muted);
  cursor:      pointer;
  padding:     var(--sp-1);
  font-size:   1.2rem;
  line-height: 1;
  transition:  color var(--t-fast);
}
.modal-close:hover { color: var(--red); }

.modal-body {
  padding: var(--sp-5);
}

.modal-footer {
  display:         flex;
  justify-content: flex-end;
  gap:             var(--sp-2);
  padding:         var(--sp-4) var(--sp-5);
  border-top:      1px solid var(--border);
  background:      var(--bg-2);
}

/* Slide-up mobile — ex: formulaire de pari */
@media (max-width: 640px) {
  .modal-overlay.modal-sheet {
    align-items: flex-end;
    padding: 0;
  }
  .modal-overlay.modal-sheet .modal {
    max-width: 100%;
    width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    animation: slide-up var(--t-base);
  }
}


/* ══════════════════════════════════════════════════════════════
   12. TOPBAR & NAV
   ══════════════════════════════════════════════════════════════ */

.topbar {
  position:        fixed;
  top:             0;
  left:            0;
  right:           0;
  height:          var(--topbar-h);
  background:      rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom:   1px solid var(--border);
  z-index:         var(--z-topbar);
  display:         flex;
  align-items:     center;
}

.topbar-inner {
  width:           100%;
  max-width:       var(--container-max);
  margin:          0 auto;
  padding:         0 var(--container-pad);
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--sp-4);
}

/* ── Logo inline (pattern BB + TRADE) ──────────────────────── */
.logo {
  font-family:     var(--font-display);
  font-size:       1.6rem;
  font-weight:     var(--fw-black);
  letter-spacing:  0.06em;
  color:           var(--text);
  display:         inline-block;
  line-height:     1;
  margin-bottom:   0.25rem;
  white-space:     nowrap;
}
.logo span { color: var(--red); }

.logo-sm { font-size: 1.2rem; }
.logo-lg { font-size: 2rem; }
.logo-xl { font-size: 2.8rem; }

.brand {
  font-family:     var(--font-display);
  font-size:       var(--fs-md);
  font-weight:     var(--fw-black);
  letter-spacing:  0.06em;
  color:           var(--text);
  text-decoration: none;
  display:         inline-flex;
  align-items:     center;
  gap:             0;
  transition:      opacity var(--t-fast);
  white-space:     nowrap;
}
.brand:hover { opacity: 0.85; text-decoration: none; color: var(--text); }
.brand span  { color: var(--red); }

/* Indicateur utilisateur topbar */
.topbar-user-info {
  display:    flex;
  align-items:center;
  font-size:  var(--fs-xs);
}
.topbar-username {
  color:       var(--text-muted);
  max-width:   130px;
  overflow:    hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--fw-medium);
}

.nav {
  display:     flex;
  align-items: center;
  gap:         var(--sp-1);
}

.nav-link {
  padding:        0.5rem 0.85rem;
  font-size:      var(--fs-sm);
  font-weight:    var(--fw-medium);
  color:          var(--text-muted);
  text-decoration: none;
  border-radius:  var(--r-sm);
  transition:     color var(--t-fast), background var(--t-fast);
}
.nav-link:hover {
  color:           var(--text);
  background:      var(--bg-2);
  text-decoration: none;
}
.nav-link.active {
  color:      var(--red);
  background: var(--red-10);
}

/* Mobile sidebar */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: var(--sp-2);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.sidebar-toggle:hover { background: var(--bg-2); }

.sidebar {
  position:     fixed;
  top:          0;
  left:         0;
  bottom:       0;
  width:        var(--sidebar-w);
  max-width:    calc(100vw - 3rem); /* Ne jamais dépasser la largeur écran */
  background:   var(--bg-1);
  border-right: 1px solid var(--border);
  z-index:      var(--z-modal);
  transform:    translateX(-100%);
  transition:   transform var(--t-base);
  display:      flex;
  flex-direction: column;
  overflow-y:   auto;
  overflow-x:   hidden;
}

.sidebar.open { transform: translateX(0); }

/* En-tête sidebar : logo + bouton fermer */
.sidebar-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--sp-4);
  border-bottom:   1px solid var(--border);
  background:      var(--bg-1);
  flex-shrink:     0;
}

/* Bouton fermer injecté par JS */
.sidebar-close-btn {
  display:       flex;
  align-items:   center;
  justify-content: center;
  width:         36px;
  height:        36px;
  border:        1px solid var(--border);
  border-radius: var(--r-sm);
  background:    transparent;
  color:         var(--text-muted);
  cursor:        pointer;
  font-size:     1rem;
  line-height:   1;
  transition:    color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  flex-shrink:   0;
}
.sidebar-close-btn:hover {
  color:         var(--red);
  border-color:  var(--red-35);
  background:    var(--red-10);
}

/* Corps sidebar (scrollable) */
.sidebar-body {
  flex:           1;
  padding:        var(--sp-3);
  display:        flex;
  flex-direction: column;
  gap:            var(--sp-2);
  overflow-y:     auto;
  overflow-x:     hidden;
}

/* User info dans la sidebar */
.sidebar-user {
  padding:       var(--sp-3) var(--sp-4);
  background:    var(--bg-2);
  border-radius: var(--r-sm);
  border:        1px solid var(--border);
  flex-shrink:   0;
}
.sidebar-username {
  font-weight: var(--fw-bold);
  color:       var(--text);
  margin-top:  0.2rem;
  font-size:   var(--fs-sm);
}
.sidebar-email {
  color:       var(--text-muted);
  font-size:   var(--fs-xs);
  margin-top:  0.15rem;
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}

/* Icône dans les liens nav de la sidebar */
.sidebar-nav-icon {
  display:    inline-block;
  min-width:  1.5em;
  text-align: center;
  opacity:    0.6;
  flex-shrink:0;
}

/* Footer sidebar : toujours visible en bas */
.sidebar-footer {
  flex-shrink:    0;
  padding:        var(--sp-3);
  border-top:     1px solid var(--border);
  display:        flex;
  flex-direction: column;
  gap:            0;
}

/* Bouton thème dans la sidebar */
.sidebar-theme-btn {
  border:     0;
  width:      100%;
  text-align: left;
  cursor:     pointer;
  background: transparent;
  gap:        var(--sp-2);
}

/* Ombre à l'ouverture */
.sidebar.open {
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.25);
}

/* Liens nav dans la sidebar : zones de clic agrandies */
.sidebar .nav-link {
  padding:       0.75rem var(--sp-4);
  min-height:    44px;             /* accessibilité touch */
  border-radius: var(--r-sm);
  display:       flex;
  align-items:   center;
  gap:           var(--sp-3);
  font-size:     var(--fs-base);
  font-weight:   var(--fw-medium);
  width:         100%;
  box-sizing:    border-box;
}

.sidebar-backdrop {
  position:   fixed;
  inset:      0;
  background: rgba(0, 0, 0, 0.6);
  z-index:    calc(var(--z-modal) - 1);
  opacity:    0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.sidebar-backdrop.open {
  opacity:        1;
  pointer-events: auto;
}


/* ══════════════════════════════════════════════════════════════
   13. UTILITIES
   ══════════════════════════════════════════════════════════════ */

/* Couleurs texte */
.text-primary  { color: var(--text); }
.text-dim      { color: var(--text-dim); }
.text-muted    { color: var(--text-muted); }
.text-faint    { color: var(--text-faint); }
.text-red      { color: var(--red); }
.text-up       { color: var(--up); }
.text-down     { color: var(--down); }
.text-warn     { color: var(--warn); }
.text-info     { color: var(--info); }

/* Fonds */
.bg-surface    { background: var(--bg-1); }
.bg-elevated   { background: var(--bg-2); }

/* Flex utilities */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-1        { flex: 1; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }

/* Gap */
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }

/* Margin / Padding — échelle réduite */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

.p-0 { padding: 0; }
.p-2 { padding: var(--sp-2); }
.p-4 { padding: var(--sp-4); }
.p-6 { padding: var(--sp-6); }

/* Text alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Display */
.hidden        { display: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Full width */
.w-full  { width: 100%; }
.h-full  { height: 100%; }


/* ══════════════════════════════════════════════════════════════
   14. ANIMATIONS
   ══════════════════════════════════════════════════════════════ */

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Pulse — pour status dots, live indicators */
@keyframes pulse-dot {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.15); }
}

/* Pulse rouge — mise à jour live de prix */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 var(--red-25); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* Glow up / down — trade feedback */
@keyframes flash-up {
  0%   { background: var(--up-25); }
  100% { background: transparent; }
}
@keyframes flash-down {
  0%   { background: var(--down-25); }
  100% { background: transparent; }
}

/* Application directe */
.anim-fade-up   { animation: fade-up var(--t-base) both; }
.anim-slide-in  { animation: slide-in-right var(--t-base) both; }
.anim-pulse     { animation: pulse-dot 2s infinite; }
.anim-live      { animation: pulse-red 1.5s infinite; }
.anim-flash-up  { animation: flash-up 0.8s ease; }
.anim-flash-down{ animation: flash-down 0.8s ease; }

/* Stagger — pour listes apparaissant au chargement */
.stagger > * {
  animation: fade-up var(--t-base) both;
}
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }


/* ══════════════════════════════════════════════════════════════
   15. RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

/* Tablet large */
@media (max-width: 960px) {
  :root {
    --container-pad: 1.25rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 2rem;
    --fs-4xl: 2.6rem;
  }
}

/* Tablet compact (641–800px) — nav plus serrée pour éviter overflow */
@media (max-width: 800px) and (min-width: 641px) {
  .nav-link {
    padding: 0.4rem 0.55rem;
    font-size: 0.72rem;
    letter-spacing: 0;
  }
  .topbar-inner {
    gap: var(--sp-2);
  }
}

/* Mobile */
@media (max-width: 640px) {
  :root {
    --container-pad: 1rem;
    --topbar-h: 52px;
    --fs-base: 0.82rem;
    --fs-xl:   1.2rem;
    --fs-2xl:  1.35rem;
    --fs-3xl:  1.75rem;
    --fs-4xl:  2.2rem;
  }

  .nav .nav-link:not(.nav-always) { display: none; }
  .sidebar-toggle                  { display: inline-flex; }

  .card-body   { padding: var(--sp-4); }
  .card-header { padding: var(--sp-3) var(--sp-4); }

  /* Tables deviennent scrollables horizontalement */
  .table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Indicateur visuel de scroll disponible */
    background:
      linear-gradient(to right, var(--bg-1) 20%, transparent),
      linear-gradient(to left,  var(--bg-1) 20%, transparent) 100% 0,
      linear-gradient(to right, var(--border-mid), transparent) 0 0,
      linear-gradient(to left,  var(--border-mid), transparent) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 8px 100%, 8px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Hide on mobile */
  .hide-mobile { display: none !important; }
}

/* Desktop only */
@media (min-width: 961px) {
  .hide-desktop { display: none !important; }
}

/* Touch devices — augmente les zones cliquables */
@media (hover: none) {
  .btn           { padding: 0.75rem 1.25rem; }
  .btn-sm        { padding: 0.55rem 0.9rem; }
  .nav-link      { padding: 0.7rem 0.85rem; }
}


/* ══════════════════════════════════════════════════════════════
   16. LIGHT THEME — COMPONENT OVERRIDES
   ══════════════════════════════════════════════════════════════ */

/* Corps : gradient atténué, sans scanlines */
html[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 0%,   rgba(210, 40, 45, 0.035), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 100%, rgba(210, 40, 45, 0.018), transparent 60%);
}
html[data-theme="light"] body::before {
  display: none;
}

/* Topbar — fond off-white chaud avec ombre douce */
html[data-theme="light"] .topbar {
  background:    rgba(249, 248, 246, 0.94);
  box-shadow:    0 1px 0 rgba(0, 0, 0, 0.07);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Cards — légère ombre pour la profondeur */
html[data-theme="light"] .card,
html[data-theme="light"] .card-ticker {
  box-shadow: var(--shadow-sm);
}

/* Sidebar */
html[data-theme="light"] .sidebar {
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.10);
}

/* Modal */
html[data-theme="light"] .modal {
  box-shadow: var(--shadow-lg);
}

/* Inputs — légère ombre interne */
html[data-theme="light"] .form-input,
html[data-theme="light"] .form-select,
html[data-theme="light"] .form-textarea {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
html[data-theme="light"] .form-input:focus,
html[data-theme="light"] .form-select:focus,
html[data-theme="light"] .form-textarea:focus {
  box-shadow: var(--shadow-red), inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Bouton ghost — lisible sans fond */
html[data-theme="light"] .btn-ghost {
  background: rgba(0, 0, 0, 0.03);
}
html[data-theme="light"] .btn-ghost:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
}

/* Bouton subtle */
html[data-theme="light"] .btn-subtle {
  background:   var(--bg-2);
  border-color: var(--border-mid);
}
html[data-theme="light"] .btn-subtle:hover:not(:disabled) {
  background: var(--bg-3);
}

/* Tables — thead plus visible */
html[data-theme="light"] .table th {
  background: var(--bg-2);
  color:      var(--text-muted);
}
html[data-theme="light"] .table tbody tr:hover {
  background: var(--bg-2);
}

/* Badge info — border hardcodée → override */
html[data-theme="light"] .badge-info {
  border-color: rgba(25, 113, 194, 0.25);
}

/* Scrollbar */
html[data-theme="light"] ::-webkit-scrollbar-track {
  background: var(--bg-2);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-color: var(--bg-2);
}

/* Sélection */
html[data-theme="light"] ::selection {
  color: var(--text);
}

/* Code inline */
html[data-theme="light"] code {
  background: var(--bg-3);
}

/* Toast container — fond light */
html[data-theme="light"] .toast {
  background: var(--bg-1);
  border-color: var(--border-mid);
  box-shadow: var(--shadow-lg);
}

/* ── Icônes theme toggle ─────────────────────────────────── */
/* Dark (défaut) : montre soleil → cliquer = passer en light */
.theme-icon-moon { display: none;        }
.theme-icon-sun  { display: inline-flex; align-items: center; }
/* Light : montre lune → cliquer = repasser en dark */
html[data-theme="light"] .theme-icon-sun  { display: none;        }
html[data-theme="light"] .theme-icon-moon { display: inline-flex; align-items: center; }


/* ══════════════════════════════════════════════════════════════
   17. NOTIFICATION CENTER — cloche topbar + panel dropdown
   ══════════════════════════════════════════════════════════════ */

/* Wrapper relatif pour positionner le badge et le panel */
.notif-bell-wrap {
  position: relative;
}

/* Badge rouge non-lus */
.notif-badge {
  position:        absolute;
  top:             5px;
  right:           5px;
  min-width:       16px;
  height:          16px;
  padding:         0 4px;
  background:      var(--red);
  color:           #fff;
  font-size:       9px;
  font-weight:     900;
  border-radius:   999px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  line-height:     1;
  pointer-events:  none;
  border:          2px solid var(--bg-1);
  transition:      opacity var(--t-fast);
}
.notif-badge[hidden] { display: none; }

/* Panel dropdown */
.notif-panel {
  position:       absolute;
  top:            calc(100% + 10px);
  right:          0;
  width:          360px;
  max-width:      calc(100vw - 32px);
  background:     var(--bg-1);
  border:         1px solid var(--border-mid);
  border-top:     2px solid var(--red);
  border-radius:  var(--r);
  box-shadow:     0 24px 48px rgba(0,0,0,.50), 0 6px 18px rgba(0,0,0,.25);
  z-index:        var(--z-dropdown);
  overflow:       hidden;
  max-height:     70vh;
  display:        flex;
  flex-direction: column;
  animation:      fade-up 180ms both;
}
.notif-panel[hidden] { display: none; }

/* En-tête panel */
.notif-panel-header {
  display:       flex;
  align-items:   center;
  gap:           var(--sp-2);
  padding:       var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink:   0;
  background:    var(--bg-1);
}
.notif-panel-title {
  flex:           1;
  font-family:    var(--font-display);
  font-size:      var(--fs-sm);
  font-weight:    var(--fw-bold);
  letter-spacing: var(--ls-wider);
  color:          var(--text);
  text-transform: uppercase;
}

/* Corps panel (scrollable) */
.notif-panel-body {
  overflow-y:          auto;
  flex:                1;
  overscroll-behavior: contain;
}

/* État vide */
.notif-panel-empty {
  padding:    var(--sp-8) var(--sp-5);
  text-align: center;
  color:      var(--text-muted);
  font-size:  var(--fs-sm);
}
.notif-panel-empty-icon {
  font-size:     1.8rem;
  opacity:       0.3;
  margin-bottom: var(--sp-3);
}

/* Item individuel */
.notif-panel-item {
  display:     flex;
  align-items: flex-start;
  gap:         var(--sp-3);
  padding:     var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition:  background var(--t-fast);
}
.notif-panel-item:last-child { border-bottom: 0; }
.notif-panel-item.is-unread { background: rgba(210,40,45,.04); }
.notif-panel-item:hover     { background: var(--bg-2); }

/* Icône colorée */
.notif-panel-icon {
  width:           32px;
  height:          32px;
  border-radius:   50%;
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  font-size:       13px;
  margin-top:      1px;
}
.notif-panel-icon.icon-win  { background: var(--up-10);   color: var(--up);   border: 1px solid var(--up-25); }
.notif-panel-icon.icon-loss { background: var(--down-10); color: var(--down); border: 1px solid var(--down-25); }
.notif-panel-icon.icon-info { background: var(--info-10); color: var(--info); border: 1px solid rgba(77,171,247,.2); }
.notif-panel-icon.icon-warn { background: var(--warn-10); color: var(--warn); border: 1px solid var(--warn-25); }
.notif-panel-icon.icon-red  { background: var(--red-10);  color: var(--red);  border: 1px solid var(--red-25); }

/* Contenu texte */
.notif-panel-content {
  flex:      1;
  min-width: 0;
}
.notif-panel-msg {
  font-size:   var(--fs-sm);
  color:       var(--text);
  line-height: 1.4;
  word-break:  break-word;
}
.notif-panel-time {
  font-size:  var(--fs-xs);
  color:      var(--text-muted);
  margin-top: 3px;
}

/* Point non-lu (droite) */
.notif-unread-dot {
  width:        7px;
  height:       7px;
  border-radius: 50%;
  background:   var(--red);
  flex-shrink:  0;
  margin-top:   6px;
  align-self:   flex-start;
}

/* Pied de panel */
.notif-panel-footer {
  padding:     var(--sp-3) var(--sp-4);
  border-top:  1px solid var(--border);
  text-align:  center;
  flex-shrink: 0;
}
.notif-panel-footer a {
  font-size:       var(--fs-xs);
  color:           var(--text-muted);
  text-decoration: none;
  letter-spacing:  var(--ls-wide);
  text-transform:  uppercase;
  transition:      color var(--t-fast);
}
.notif-panel-footer a:hover { color: var(--red); }

/* ── Dashboard notification card improvements ── */
.db-notif-icon-win      { background: var(--up-10);   color: var(--up);   border: 1px solid var(--up-25); }
.db-notif-icon-loss     { background: var(--down-10); color: var(--down); border: 1px solid var(--down-25); }
.db-notif-icon-transfer { background: var(--info-10); color: var(--info); border: 1px solid rgba(77,171,247,.2); }
.db-notif-icon-warn     { background: var(--warn-10); color: var(--warn); border: 1px solid var(--warn-25); }
.db-notif-icon-default  { background: var(--red-10);  color: var(--red);  border: 1px solid var(--red-25); }

.db-notif-dot {
  width:         6px;
  height:        6px;
  border-radius: 50%;
  background:    var(--red);
  flex-shrink:   0;
  align-self:    center;
  margin-left:   auto;
}


/* ══════════════════════════════════════════════════════════════
   FIN DU FICHIER
   ══════════════════════════════════════════════════════════════ */