        :root {
            --cream:      #F3EDE3;
            --cream-dark: #EAE2D5;
            --orange:     #B84B0C;
            --orange-lt:  #C95A18;
            --text:       #1A1208;
            --text-muted: #7A6E62;
            --text-light: #A89D92;
            --border:     rgba(26,18,8,0.1);
            --border-md:  rgba(26,18,8,0.16);
            --white:      #FFFFFF;
            --card-bg:    #FAF6F0;
            --green:      #1B7F4F;
            --green-bg:   rgba(27,127,79,0.07);
            --green-bd:   rgba(27,127,79,0.18);
        }

        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        html { font-size: 16px; }

        body {
            font-family: 'Jost', sans-serif;
            background: var(--cream);
            color: var(--text);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            background-image: radial-gradient(circle, rgba(26,18,8,0.06) 1px, transparent 1px);
            background-size: 28px 28px;
            padding-bottom: 60px;
        }

        a { text-decoration: none; color: inherit; }

        /* ── APP NAVBAR ── */
        .app-nav {
            position: sticky; top: 0; z-index: 100;
            background: var(--white);
            border-bottom: 1px solid var(--border);
            display: flex; align-items: center;
            padding: 0 28px; height: 54px;
        }
        .app-logo {
            font-family: 'Jost', sans-serif;
            font-weight: 600; font-size: 0.95rem;
            color: var(--text);
            text-decoration: none;
            display: flex; align-items: center; gap: 5px;
            flex-shrink: 0;
        }
        .logo-star { color: var(--orange); }

        .app-nav__tabs {
            display: flex; align-items: center;
            flex: 1; justify-content: center;
        }
        .nav-tab {
            display: inline-flex; align-items: center;
            height: 54px; padding: 0 18px;
            font-size: 0.84rem; font-weight: 500;
            color: var(--text-muted);
            text-decoration: none;
            border-bottom: 2px solid transparent;
            transition: color 0.2s, border-color 0.2s;
        }
        .nav-tab:hover { color: var(--text); }
        .nav-tab.active {
            color: var(--orange);
            border-bottom-color: var(--orange);
            font-weight: 600;
        }

        .app-nav__right {
            display: flex; align-items: center; gap: 10px; flex-shrink: 0;
        }
        .nav-clock {
            width: 30px; height: 30px;
            display: flex; align-items: center; justify-content: center;
            color: var(--text-muted); font-size: 1rem; cursor: pointer;
            background: none; border: none;
        }
        .nav-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
        .user-avatar {
            width: 30px; height: 30px; border-radius: 50%;
            background: var(--orange); color: white;
            display: flex; align-items: center; justify-content: center;
            font-size: 0.65rem; font-weight: 700; letter-spacing: 0.03em;
        }
        .user-plan {
            font-size: 0.63rem; font-weight: 700;
            letter-spacing: 0.07em; text-transform: uppercase;
            color: var(--text-muted);
            background: var(--cream-dark);
            border: 1px solid var(--border-md);
            border-radius: 4px; padding: 3px 7px;
        }
        .user-arrow { font-size: 0.65rem; color: var(--text-light); }

        /* Dropdown */
        .nav-user-wrapper { position: relative; }
        .user-dropdown {
            display: none;
            position: absolute; top: calc(100% + 8px); right: 0;
            background: var(--white);
            border: 1px solid var(--border-md);
            border-radius: 10px;
            box-shadow: 0 6px 24px rgba(26,18,8,0.1);
            min-width: 170px;
            overflow: hidden;
            z-index: 200;
        }
        .nav-user-wrapper:hover .user-dropdown { display: block; }
        .dropdown-item {
            display: block;
            padding: 10px 14px;
            font-size: 0.84rem; font-weight: 500;
            color: var(--text-muted);
            transition: background 0.15s, color 0.15s;
        }
        .dropdown-item:hover { background: var(--cream); color: var(--text); }
        .dropdown-separator { height: 1px; background: var(--border); margin: 4px 0; }
        .dropdown-item.deconnexion { color: var(--text-light); }
        .dropdown-item.deconnexion:hover { color: var(--orange); }

        /* ── MAIN ── */
        .main {
            max-width: 720px;
            margin: 0 auto;
            padding: 32px 20px 0;
            flex: 1 0 auto;
            /* CORRECTION DÉBORDEMENT MOBILE — .main est un enfant flex de
               body (display:flex;flex-direction:column), et porte des
               marges horizontales "auto" pour se centrer. Sur un enfant
               flex, des marges "auto" sur l'axe transversal (ici
               horizontal) désactivent l'étirement automatique (stretch) :
               .main revient alors à un dimensionnement "fit-content",
               c'est-à-dire au moins aussi large que le contenu le plus
               large qui ne peut pas se réduire — ici le tableau, dont les
               en-têtes ont "white-space: nowrap" (règle déjà existante,
               inchangée). Depuis l'ajout de la colonne "Filleul", ce
               minimum est devenu plus grand que l'écran mobile, donc
               .main lui-même s'élargit au-delà du viewport au lieu de
               laisser .table-wrap (overflow-x:auto, déjà en place)
               contenir seul le débordement du tableau.
               width:100% force .main à prendre la largeur disponible du
               conteneur flex (comme le ferait le stretch), sans changer
               le rendu desktop : max-width:720px continue de plafonner
               la largeur, et margin:0 auto continue de centrer. */
            width: 100%;
        }

        /* ── PAGE HEADER ── */
        .page-header {
            margin-bottom: 24px;
        }
        .page-title {
            font-family: 'Playfair Display', Georgia, serif;
            font-size: 1.7rem;
            font-weight: 600;
            color: var(--text);
            margin-bottom: 4px;
        }
        .page-subtitle {
            font-size: 0.84rem;
            color: var(--text-muted);
        }

        /* ── SECTION CARD ── */
        .scard {
            background: var(--white);
            border: 1px solid var(--border-md);
            border-radius: 14px;
            padding: 20px 22px;
            margin-bottom: 14px;
        }
        .scard-title {
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--text-light);
            margin-bottom: 14px;
        }

        /* ── LIEN DE PARRAINAGE ── */
        .ref-link-row {
            display: flex; align-items: center; gap: 10px;
            flex-wrap: wrap;
        }
        .ref-link-box {
            flex: 1;
            min-width: 200px;
            background: var(--cream);
            border: 1px solid var(--border-md);
            border-radius: 8px;
            padding: 10px 14px;
            font-size: 0.84rem;
            color: var(--text-muted);
            font-family: 'Jost', monospace;
            letter-spacing: 0.01em;
            user-select: all;
        }
        .btn-copy {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--orange);
            color: white;
            border: none;
            border-radius: 8px;
            padding: 10px 18px;
            font-family: 'Jost', sans-serif;
            font-size: 0.84rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s;
            white-space: nowrap;
        }
        .btn-copy:hover { background: var(--orange-lt); }
        .btn-copy.copied { background: var(--green); }
        .ref-note {
            margin-top: 10px;
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 500;
        }

        /* ── STATS GRID ── */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin-bottom: 14px;
        }
        @media (max-width: 540px) {
            .stats-grid { grid-template-columns: 1fr 1fr; }
        }
        .stat-card {
            background: var(--white);
            border: 1px solid var(--border-md);
            border-radius: 12px;
            padding: 16px 18px;
        }
        .stat-label {
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.09em;
            text-transform: uppercase;
            color: var(--text-light);
            margin-bottom: 6px;
        }
        .stat-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text);
            line-height: 1.1;
        }
        .stat-value.green { color: var(--green); }
        .stat-sub {
            font-size: 0.72rem;
            color: var(--text-muted);
            font-weight: 500;
            margin-top: 2px;
        }

        /* ── COMMISSIONS PAR NIVEAU ── */
        .niveau-list { display: flex; flex-direction: column; gap: 8px; }
        .niveau-row {
            display: flex; align-items: center; justify-content: space-between;
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 12px 16px;
        }
        .niveau-left { display: flex; align-items: center; gap: 12px; }
        .niveau-badge {
            width: 32px; height: 32px;
            border-radius: 8px;
            display: flex; align-items: center; justify-content: center;
            font-size: 0.7rem; font-weight: 700;
            letter-spacing: 0.04em;
            flex-shrink: 0;
        }
        .niveau-badge.n1 { background: rgba(184,75,12,0.12); color: var(--orange); }
        .niveau-badge.n2 { background: rgba(26,18,8,0.08);  color: var(--text-muted); }
        .niveau-badge.n3 { background: rgba(26,18,8,0.05);  color: var(--text-light); }
        .niveau-info {}
        .niveau-name {
            font-size: 0.84rem;
            font-weight: 600;
            color: var(--text);
        }
        .niveau-desc {
            font-size: 0.72rem;
            color: var(--text-muted);
        }
        .niveau-pct {
            font-size: 1.15rem;
            font-weight: 700;
            color: var(--orange);
        }
        .niveau-pct.n2 { color: var(--text-muted); }
        .niveau-pct.n3 { color: var(--text-muted); }

        /* ── TABLEAU ── */
        .table-wrap {
            overflow-x: auto;
            border-radius: 10px;
            border: 1px solid var(--border-md);
        }
        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.82rem;
        }
        thead th {
            background: var(--card-bg);
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-light);
            padding: 10px 14px;
            text-align: left;
            border-bottom: 1px solid var(--border);
            white-space: nowrap;
        }
        tbody td {
            padding: 11px 14px;
            color: var(--text-muted);
            border-bottom: 1px solid var(--border);
        }
        tbody tr:last-child td { border-bottom: none; }
        tbody tr:hover td { background: var(--cream); }
        .td-bold { font-weight: 600; color: var(--text); }
        .td-green { color: var(--green); font-weight: 600; }
        /* Colonne "Filleul" — établissement (.td-bold, déjà existant) en
           ligne principale, prénom + nom en dessous, plus discret. Seule
           règle ajoutée : réutilise var(--text-muted), déjà la couleur
           par défaut de tbody td. */
        .filleul-person { font-size: 0.72rem; margin-top: 2px; }
        .badge-statut {
            display: inline-block;
            font-size: 0.62rem; font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            padding: 2px 8px; border-radius: 5px;
        }
        .badge-actif  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
        .badge-niveau { background: var(--cream-dark); color: var(--text-muted); border: 1px solid var(--border-md); }

        /* ── AFFICHER PLUS / RÉDUIRE (limitation d'affichage à 5 lignes) ──
           Contrôle discret : aucun fond, aucune bordure, taille de texte
           réduite — ne modifie ni la largeur du bloc, ni les colonnes du
           tableau, ni le responsive existant (le tableau reste dans
           .table-wrap, inchangé). */
        .table-toggle {
            text-align: center;
            padding-top: 10px;
        }
        .table-toggle-btn {
            background: none;
            border: none;
            padding: 4px 6px;
            font-family: 'Jost', sans-serif;
            font-size: 0.76rem;
            font-weight: 600;
            color: var(--orange);
            cursor: pointer;
        }
        .table-toggle-btn:hover { text-decoration: underline; }

        /* ── QR CODE ── */
        .qr-block {
            margin-top: 16px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
        }
        .qr-canvas-wrap {
            background: var(--white);
            border: 1px solid var(--border-md);
            border-radius: 12px;
            padding: 16px;
            display: inline-flex;
        }
        .qr-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            justify-content: center;
        }
        .btn-qr {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: none;
            border: 1px solid var(--border-md);
            border-radius: 8px;
            padding: 9px 16px;
            font-family: 'Jost', sans-serif;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-muted);
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s;
        }
        .btn-qr:hover { border-color: var(--orange); color: var(--orange); }

        /* ── DEMANDE DE RETRAIT — ÉTAPE "parcours complet de retrait
           parrainage" ── */
        .payout-form-row {
            margin-bottom: 14px;
        }
        .payout-form-row label {
            display: block;
            font-size: 0.72rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            color: var(--text-muted);
            margin-bottom: 6px;
        }
        .payout-form-row input {
            width: 100%;
            background: var(--cream);
            border: 1px solid var(--border-md);
            border-radius: 8px;
            padding: 10px 14px;
            font-family: 'Jost', sans-serif;
            font-size: 0.86rem;
            color: var(--text);
        }
        .payout-form-row input:focus {
            outline: none;
            border-color: var(--orange);
        }
        .payout-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 4px;
        }
        .payout-error {
            font-size: 0.78rem;
            color: #B3261E;
            margin-bottom: 12px;
        }
        .payout-confirm-summary {
            font-size: 0.86rem;
            color: var(--text);
            line-height: 1.6;
            margin-bottom: 6px;
        }
        .payout-status {
            margin-top: 12px;
            display: inline-flex;
            align-items: center;
            font-size: 0.8rem;
            font-weight: 600;
            padding: 8px 14px;
            border-radius: 8px;
            background: var(--green-bg);
            color: var(--green);
            border: 1px solid var(--green-bd);
        }
        .payout-status.is-refused {
            background: rgba(179,38,30,0.08);
            color: #B3261E;
            border-color: rgba(179,38,30,0.2);
        }

        /* ── FAQ ── */
        .faq-list { display: flex; flex-direction: column; gap: 0; }
        .faq-item {
            border-bottom: 1px solid var(--border);
        }
        .faq-item:last-child { border-bottom: none; }
        .faq-question {
            width: 100%;
            background: none;
            border: none;
            text-align: left;
            padding: 14px 0;
            font-family: 'Jost', sans-serif;
            font-size: 0.88rem;
            font-weight: 600;
            color: var(--text);
            cursor: pointer;
            display: flex; align-items: center; justify-content: space-between;
            gap: 12px;
        }
        .faq-chevron {
            font-size: 0.75rem;
            color: var(--text-light);
            transition: transform 0.2s;
            flex-shrink: 0;
        }
        .faq-item.open .faq-chevron { transform: rotate(180deg); }
        .faq-answer {
            display: none;
            font-size: 0.82rem;
            color: var(--text-muted);
            line-height: 1.65;
            padding-bottom: 14px;
        }
        .faq-item.open .faq-answer { display: block; }

        /* ══════════════════════════════════════════════
           RESPONSIVE — TABLETTE (≤ 768px)
           Réduction des espacements horizontaux de la nav et des
           onglets uniquement. Ils restent sur une seule ligne.
           Aucun autre élément de la page n'est modifié.
        ══════════════════════════════════════════════ */
        @media (max-width: 768px) {
            .app-nav {
                padding: 0 16px;
            }
            .nav-tab {
                padding: 0 10px;
                font-size: 0.76rem;
            }
        }

        /* ══════════════════════════════════════════════
           RESPONSIVE — SMARTPHONE (≤ 480px)
           La nav passe sur deux lignes : logo + menu utilisateur
           (horloge/thème + compte) en haut, les 4 onglets en
           dessous, avec repli naturel en 2×2 si nécessaire.
           Aucun défilement horizontal, aucun élément masqué,
           aucun menu hamburger — uniquement flex-wrap/order/
           flex-basis sur la structure HTML existante.
        ══════════════════════════════════════════════ */
        @media (max-width: 480px) {
            .app-nav {
                flex-wrap: wrap;
                height: auto;
                padding: 10px 16px;
                row-gap: 8px;
            }
            .app-logo {
                order: 1;
            }
            .app-nav__right {
                order: 2;
                margin-left: auto;
            }
            .app-nav__tabs {
                order: 3;
                flex-basis: 100%;
                flex-wrap: wrap;
                gap: 4px;
            }
            .nav-tab {
                height: auto;
                padding: 8px 12px;
                font-size: 0.74rem;
            }
        }
