:root{
    --fd-bg:#f3f7ff;
    --fd-bg-soft:#eef4ff;
    --fd-card:#ffffff;
    --fd-card-2:#f8fbff;
    --fd-line:#dbe7ff;
    --fd-line-soft:#e9f0ff;
    --fd-text:#081226;
    --fd-text-2:#12213f;
    --fd-muted:#667694;
    --fd-blue:#155dfc;
    --fd-blue-2:#2563eb;
    --fd-blue-3:#0b1020;
    --fd-blue-soft:#e9f1ff;
    --fd-green:#16a34a;
    --fd-green-2:#22c55e;
    --fd-green-soft:#ecfdf3;
    --fd-red:#dc2626;
    --fd-gold:#eab308;
    --fd-shadow:0 16px 42px rgba(17,39,84,.10);
    --fd-shadow-soft:0 10px 28px rgba(17,39,84,.08);
    --fd-radius-xl:28px;
    --fd-radius-lg:22px;
    --fd-radius-md:18px;
}

*{box-sizing:border-box;}

html,body{
    margin:0;
    padding:0;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.08), transparent 28%),
        radial-gradient(circle at top right, rgba(34,197,94,.06), transparent 22%),
        linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
    color:var(--fd-text);
    font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
}

body,button,input,select,textarea{font-weight:600;}
h1,h2,h3,h4,h5,strong,b{font-weight:800 !important;letter-spacing:-.02em;color:var(--fd-text);}
p,span,small,div,a{color:inherit;}
.hidden{display:none !important;}

.page.page-light{
    max-width:520px;
    margin:0 auto;
    min-height:100vh;
    padding:18px 16px 118px;
    background:transparent;
}

.ft-topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:18px;
}

.icon-btn{
    width:46px;
    height:46px;
    border:none;
    border-radius:16px;
    background:rgba(255,255,255,.92);
    color:var(--fd-blue-2);
    box-shadow:var(--fd-shadow-soft);
    display:flex;
    align-items:center;
    justify-content:center;
    backdrop-filter:blur(14px);
}

.icon-btn svg{width:20px;height:20px;}

.ft-topbar-center h1{
    margin:0;
    font-size:1.22rem;
    text-align:center;
    color:var(--fd-text);
}

.panel-light,
.promo-banner,
.class-panel,
.referral-highlight-card,
.affiliate-tier-hero,
.affiliate-range-card,
.affiliate-progress-box,
.affiliate-note-box{
    border:1px solid var(--fd-line);
    background:rgba(255,255,255,.94);
    box-shadow:var(--fd-shadow);
    backdrop-filter:blur(16px);
}

.class-panel{
    padding:18px;
    border-radius:26px;
    margin-bottom:16px;
    background:
        radial-gradient(circle at top right, rgba(21,93,252,.10), transparent 26%),
        linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
}

.class-panel-top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    margin-bottom:16px;
}

.class-panel-top small{
    display:block;
    color:var(--fd-blue-2);
    text-transform:uppercase;
    letter-spacing:.08em;
    font-size:.72rem;
    font-weight:900;
    margin-bottom:8px;
}

.class-panel-top h3{
    margin:0;
    font-size:1.18rem;
    line-height:1.06;
}

.class-badge{
    width:48px;
    height:48px;
    border-radius:16px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,var(--fd-blue),var(--fd-blue-3));
    color:#fff;
    font-size:1rem;
    font-weight:900;
    box-shadow:0 14px 26px rgba(21,93,252,.20);
    flex:0 0 48px;
}

.class-progress-wrap{
    display:grid;
    grid-template-columns:56px 1fr 56px;
    gap:12px;
    align-items:center;
}

.class-medal-left,
.class-medal-right{
    width:56px;
    height:56px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:900;
    font-size:1rem;
    box-shadow:var(--fd-shadow-soft);
}

.class-medal-left{
    background:linear-gradient(135deg,#dbeafe,#eff6ff);
    color:var(--fd-blue-3);
}

.class-medal-right{
    background:linear-gradient(135deg,#ecfdf3,#f0fdf4);
    color:#166534;
}

.class-progress-center{min-width:0;}

.class-progress-bar{
    height:12px;
    border-radius:999px;
    background:#e6eefc;
    overflow:hidden;
    box-shadow:inset 0 1px 2px rgba(17,39,84,.08);
}

.class-progress-bar span{
    display:block;
    height:100%;
    width:6%;
    border-radius:999px;
    background:linear-gradient(90deg,var(--fd-blue),var(--fd-green-2));
}

.class-progress-center strong{
    display:block;
    margin-top:10px;
    font-size:.9rem;
    color:var(--fd-text);
}

.promo-banner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    border-radius:26px;
    padding:18px;
    margin-bottom:16px;
    background:
        radial-gradient(circle at top right, rgba(234,179,8,.12), transparent 24%),
        radial-gradient(circle at bottom left, rgba(21,93,252,.10), transparent 28%),
        linear-gradient(180deg,#ffffff 0%,#f9fbff 100%);
}

.promo-copy{min-width:0;}

.promo-mini{
    display:block;
    color:var(--fd-blue-2);
    text-transform:uppercase;
    letter-spacing:.08em;
    font-size:.72rem;
    font-weight:900;
    margin-bottom:8px;
}

.promo-copy strong{
    display:block;
    font-size:1.6rem;
    line-height:1;
    margin-bottom:6px;
}

.promo-copy small{
    color:var(--fd-muted);
    font-size:.88rem;
    font-weight:700;
}

.promo-arrow{
    width:48px;
    height:48px;
    border:none;
    border-radius:16px;
    background:linear-gradient(135deg,var(--fd-blue),var(--fd-blue-3));
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 14px 28px rgba(21,93,252,.22);
    flex:0 0 48px;
}

.promo-arrow svg{width:20px;height:20px;}

.panel-light{
    padding:18px;
    border-radius:28px;
    margin-bottom:16px;
    background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
}

.panel-light-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:14px;
}

.panel-light-head h3{
    margin:0;
    font-size:1.08rem;
}

.panel-mini-badge,
.mini-status-badge,
.badge,
.badge-success,
.badge-danger,
.badge-warning,
.badge-gray,
.badge-primary{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    padding:8px 12px;
    font-size:.74rem;
    font-weight:900;
    white-space:nowrap;
}

.panel-mini-badge,
.badge-gray{
    color:var(--fd-blue-3);
    background:var(--fd-blue-soft);
    border:1px solid #cfe0ff;
}

.mini-status-badge,
.badge-success{
    color:#166534;
    background:var(--fd-green-soft);
    border:1px solid #bbf7d0;
}

.badge-primary{
    color:var(--fd-blue-3);
    background:#eef5ff;
    border:1px solid #cfe0ff;
}

.badge-danger{
    color:#b91c1c;
    background:#fef2f2;
    border:1px solid #fecaca;
}

.badge-warning{
    color:#92400e;
    background:#fff7ed;
    border:1px solid #fed7aa;
}

.mini-link{
    color:var(--fd-blue-2);
    text-decoration:none;
    font-size:.84rem;
    font-weight:900;
}

.referral-highlight-card{
    display:grid;
    gap:14px;
    border-radius:24px;
    padding:18px;
    background:
        radial-gradient(circle at top right, rgba(234,179,8,.12), transparent 24%),
        radial-gradient(circle at bottom left, rgba(21,93,252,.10), transparent 28%),
        linear-gradient(180deg,#ffffff 0%,#f9fbff 100%);
}

.referral-highlight-copy small{
    display:block;
    color:var(--fd-blue-2);
    text-transform:uppercase;
    letter-spacing:.08em;
    font-size:.72rem;
    font-weight:900;
    margin-bottom:8px;
}

.referral-highlight-copy strong{
    display:block;
    font-size:1.08rem;
    margin-bottom:8px;
}

.referral-highlight-copy p{
    margin:0;
    color:var(--fd-muted);
    font-size:.9rem;
    line-height:1.45;
    font-weight:700;
    word-break:break-word;
}

.referral-highlight-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
}

.small-action-btn{
    border:none;
    border-radius:16px;
    padding:14px 14px;
    background:linear-gradient(180deg,#eef5ff 0%,#e4efff 100%);
    color:var(--fd-blue-3);
    font-weight:900;
    font-size:.93rem;
    box-shadow:0 10px 18px rgba(37,99,235,.08);
}

.small-action-btn.dark{
    background:linear-gradient(135deg,var(--fd-blue),var(--fd-blue-3));
    color:#fff;
    box-shadow:0 14px 28px rgba(21,93,252,.22);
}

.summary-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
}

.summary-card{
    border-radius:20px;
    background:linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);
    border:1px solid var(--fd-line-soft);
    box-shadow:0 8px 18px rgba(17,39,84,.05);
    padding:15px 14px;
}

.summary-card span{
    display:block;
    color:var(--fd-muted);
    font-size:.74rem;
    margin-bottom:8px;
    font-weight:800;
}

.summary-card strong{
    display:block;
    font-size:1.15rem;
    line-height:1.1;
}

.affiliate-program-panel{
    background:
        radial-gradient(circle at top right, rgba(21,93,252,.06), transparent 20%),
        radial-gradient(circle at bottom left, rgba(234,179,8,.10), transparent 24%),
        linear-gradient(180deg,#ffffff 0%,#f9fbff 100%);
}

.affiliate-tier-hero{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    border-radius:24px;
    padding:18px;
    margin-bottom:14px;
    background:
        radial-gradient(circle at top right, rgba(34,197,94,.12), transparent 24%),
        radial-gradient(circle at bottom left, rgba(21,93,252,.10), transparent 24%),
        linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);
}

.affiliate-tier-copy small{
    display:block;
    color:var(--fd-blue-2);
    text-transform:uppercase;
    letter-spacing:.08em;
    font-size:.72rem;
    font-weight:900;
    margin-bottom:8px;
}

.affiliate-tier-copy strong{
    display:block;
    font-size:1.1rem;
    margin-bottom:8px;
}

.affiliate-tier-copy p{
    margin:0;
    color:var(--fd-muted);
    font-size:.9rem;
    line-height:1.5;
    font-weight:700;
}

.affiliate-tier-amount{
    min-width:118px;
    text-align:right;
}

.affiliate-tier-amount span{
    display:block;
    color:var(--fd-muted);
    font-size:.74rem;
    margin-bottom:8px;
    font-weight:800;
}

.affiliate-tier-amount strong{
    display:block;
    font-size:1.35rem;
    line-height:1;
    color:var(--fd-blue-3);
}

.affiliate-progress-box{
    border-radius:22px;
    padding:16px;
    margin-bottom:14px;
    background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
}

.affiliate-progress-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:12px;
}

.affiliate-progress-top strong{
    font-size:.95rem;
}

.affiliate-progress-top span{
    color:var(--fd-blue-2);
    font-size:.8rem;
    font-weight:900;
    text-align:right;
}

.affiliate-progress-bar{
    height:12px;
    border-radius:999px;
    background:#e6eefc;
    overflow:hidden;
    box-shadow:inset 0 1px 2px rgba(17,39,84,.08);
}

.affiliate-progress-bar span{
    display:block;
    height:100%;
    width:6%;
    border-radius:999px;
    background:linear-gradient(90deg,var(--fd-blue),var(--fd-green-2));
}

.affiliate-progress-box p{
    margin:10px 0 0;
    color:var(--fd-muted);
    font-size:.86rem;
    line-height:1.45;
    font-weight:700;
}

.affiliate-kpi-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
    margin-bottom:14px;
}

.affiliate-range-list{
    display:grid;
    gap:12px;
    margin-bottom:14px;
}

.affiliate-range-card{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    border-radius:20px;
    padding:15px;
    background:linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);
    border:1px solid var(--fd-line-soft);
    box-shadow:0 10px 22px rgba(17,39,84,.05);
}

.affiliate-range-card.active{
    border-color:#cfe0ff;
    background:
        radial-gradient(circle at top right, rgba(21,93,252,.08), transparent 24%),
        linear-gradient(180deg,#eef5ff 0%,#f7fbff 100%);
}

.affiliate-range-card strong{
    display:block;
    font-size:.98rem;
    margin-bottom:5px;
}

.affiliate-range-card p{
    margin:0;
    color:var(--fd-muted);
    font-size:.84rem;
    line-height:1.45;
    font-weight:700;
}

.affiliate-range-card span{
    color:var(--fd-blue-3);
    font-size:.96rem;
    font-weight:900;
    white-space:nowrap;
}

.affiliate-note-box{
    border-radius:20px;
    padding:16px;
    background:
        radial-gradient(circle at top right, rgba(234,179,8,.12), transparent 24%),
        linear-gradient(180deg,#fffdf6 0%,#fffaf0 100%);
    border:1px solid #fde7b0;
}

.affiliate-note-box strong{
    display:block;
    margin-bottom:8px;
    color:#92400e;
    font-size:.95rem;
}

.affiliate-note-box p{
    margin:0;
    color:#9a6b18;
    font-size:.86rem;
    line-height:1.5;
    font-weight:700;
}

.referrals-list,
.stats-list{
    display:grid;
    gap:12px;
}

.referral-user-item,
.stats-row-card{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:14px;
    border-radius:20px;
    background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
    border:1px solid var(--fd-line-soft);
    box-shadow:0 10px 22px rgba(17,39,84,.05);
}

.referral-user-avatar{
    width:48px;
    height:48px;
    border-radius:16px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,var(--fd-blue),#4f8cff);
    color:#fff;
    font-size:1rem;
    font-weight:900;
    flex:0 0 48px;
    box-shadow:0 12px 24px rgba(21,93,252,.18);
}

.referral-user-copy{
    min-width:0;
    flex:1;
}

.referral-user-copy strong{
    display:block;
    font-size:.98rem;
    line-height:1.1;
}

.referral-user-copy p{
    margin:5px 0 0;
    color:var(--fd-muted);
    font-size:.84rem;
    line-height:1.45;
    font-weight:700;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.referral-user-meta{
    text-align:right;
    display:grid;
    gap:6px;
    justify-items:end;
}

.referral-user-meta strong{
    font-size:.9rem;
}

.stats-row-left{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
}

.stats-icon-box{
    width:42px;
    height:42px;
    border-radius:14px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(180deg,#eef5ff 0%,#e4efff 100%);
    color:var(--fd-blue-3);
    font-size:1rem;
    font-weight:900;
    box-shadow:0 10px 18px rgba(37,99,235,.08);
    flex:0 0 42px;
}

.stats-row-left small{
    color:var(--fd-muted);
    font-size:.86rem;
    font-weight:800;
    line-height:1.4;
}

.stats-row-card strong{
    font-size:1rem;
    white-space:nowrap;
}

.empty-box{
    padding:20px 14px;
    text-align:center;
    color:var(--fd-muted);
    border:1px dashed var(--fd-line);
    border-radius:18px;
    background:#fbfdff;
    font-weight:700;
}

.toast-wrap{
    position:fixed;
    left:50%;
    bottom:92px;
    transform:translateX(-50%);
    width:min(92vw,420px);
    display:grid;
    gap:10px;
    z-index:80;
    pointer-events:none;
}

.toast{
    padding:14px 16px;
    border-radius:16px;
    color:#fff;
    font-size:.88rem;
    font-weight:800;
    box-shadow:0 16px 32px rgba(15,23,42,.24);
    transform:translateY(0);
    opacity:1;
    transition:all .24s ease;
    text-align:center;
}

.toast.info{background:#0f172a;}
.toast.success{background:linear-gradient(135deg,#16a34a,#15803d);}
.toast.error{background:linear-gradient(135deg,#dc2626,#b91c1c);}

@media (max-width:420px){
    .page.page-light{
        padding-left:14px;
        padding-right:14px;
    }

    .affiliate-kpi-grid{
        grid-template-columns:1fr;
    }

    .summary-grid,
    .referral-highlight-actions{
        grid-template-columns:1fr 1fr;
    }

    .class-progress-wrap{
        grid-template-columns:48px 1fr 48px;
    }

    .class-medal-left,
    .class-medal-right{
        width:48px;
        height:48px;
        border-radius:16px;
    }

    .affiliate-tier-hero{
        flex-direction:column;
        align-items:flex-start;
    }

    .affiliate-tier-amount{
        min-width:0;
        text-align:left;
    }
}

@media (max-width:360px){
    .summary-grid,
    .referral-highlight-actions{
        grid-template-columns:1fr;
    }

    .promo-banner,
    .referral-user-item,
    .stats-row-card{
        align-items:flex-start;
    }
}

.screen-loader{
    position:fixed;
    inset:0;
    display:flex;
    justify-content:center;
    align-items:center;
}

.screen-loader-inner{
    display:flex;
    flex-direction:column;   /* pone texto arriba y gif abajo */
    align-items:center;
    justify-content:center;
}

.screen-loader-text{
    display:block;
    width:100%;
    text-align:center;
    margin-bottom:14px;     /* separación del gif */
    color:#155dfc;
    font-size:16px;
    font-weight:800;
}

.screen-loader-logo{
    width:120px;
    height:auto;
}