/* Affiliate-specific overrides & extras (paired with /style.css) */

/* Auth-aware visibility:
   - .aff-only-guest: hiển thị mặc định, ẩn khi user đã đăng nhập.
   - .aff-only-user : ẩn mặc định, chỉ hiện khi đã đăng nhập. */
.aff-only-user { display: none !important; }
body.aff-logged-in .aff-only-user { display: revert !important; }
body.aff-logged-in .aff-only-guest { display: none !important; }

.aff-page {
    min-height: 100vh;
    padding: 120px 0 80px;
}

.aff-hero {
    text-align: center;
    padding: 100px 0 60px;
}

.aff-hero h1 {
    font-size: 3.4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.aff-hero p.lead {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 720px;
    margin: 0 auto 32px;
}

.aff-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    background: rgba(0, 242, 255, 0.06);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.aff-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.aff-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin: 60px 0;
}

.aff-card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 28px;
    transition: all 0.3s;
}

.aff-card:hover {
    border-color: rgba(0, 242, 255, 0.3);
    transform: translateY(-4px);
}

.aff-card .num {
    font-size: 2.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.aff-card h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.aff-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.aff-section {
    padding: 60px 0;
}

.aff-section h2 {
    font-size: 2rem;
    margin-bottom: 14px;
    text-align: center;
}

.aff-section .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.aff-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.aff-step {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.aff-step .step-num {
    font-size: 3rem;
    font-weight: 800;
    color: rgba(0, 242, 255, 0.15);
    position: absolute;
    right: 16px;
    top: -10px;
}

.aff-step h4 {
    margin-bottom: 8px;
    color: var(--primary);
    position: relative;
    z-index: 1;
}

.aff-step p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.faq-item {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 12px;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    color: #fff;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    float: right;
    color: var(--primary);
    font-size: 1.4rem;
    line-height: 1;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    color: var(--text-secondary);
    margin-top: 12px;
    font-size: 0.95rem;
}

.aff-cta-band {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.06), rgba(139, 92, 246, 0.06));
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    padding: 50px 30px;
    text-align: center;
    margin-top: 40px;
}

.aff-cta-band h3 {
    font-size: 1.7rem;
    margin-bottom: 12px;
}

.aff-cta-band p {
    color: var(--text-secondary);
    margin-bottom: 26px;
}

.aff-cta-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.aff-inviter-banner {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 12px 20px;
    text-align: center;
    margin: 20px auto 0;
    max-width: 600px;
    color: #c4b5fd;
}

/* Auth forms */
.aff-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 20px 60px;
}

.aff-auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 44px 36px;
}

.aff-auth-card h2 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1.7rem;
}

.aff-auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.92rem;
}

.aff-form-group {
    margin-bottom: 16px;
}

.aff-form-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.aff-form-group input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.aff-form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
}

.aff-msg {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-top: 14px;
}

.aff-msg.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.aff-msg.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.aff-auth-foot {
    text-align: center;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.aff-auth-foot a {
    color: var(--primary);
    text-decoration: none;
}

/* Shared auth nav (public pages + dashboard) */
.aff-nav-auth {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.aff-nav-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: #67e8f9;
    border: 1px solid rgba(34, 211, 238, 0.4);
    background: rgba(15, 23, 42, 0.55);
    font-weight: 700;
    max-width: 230px;
    transition: all 0.2s ease;
}

.nav-links .aff-nav-user {
    color: #67e8f9;
}

.aff-nav-user:hover {
    border-color: rgba(34, 211, 238, 0.75);
    background: rgba(34, 211, 238, 0.12);
}

.aff-nav-user-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.aff-nav-user-name {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aff-nav-logout {
    white-space: nowrap;
}

.nav-links .aff-nav-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard */
.aff-dash {
    padding: 110px 0 60px;
}

.aff-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 16px;
}

.aff-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.aff-status-active {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.aff-status-pending {
    background: rgba(234, 179, 8, 0.12);
    color: #fcd34d;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.aff-status-banned {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.aff-tabs {
    display: flex;
    gap: 8px;
    background: var(--panel-bg);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.aff-tab {
    flex: 1 0 auto;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.aff-tab:hover {
    color: #fff;
}

.aff-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #000;
}

.aff-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.aff-kpi {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 18px 20px;
}

.aff-kpi .label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.aff-kpi .value {
    font-size: 1.55rem;
    font-weight: 800;
    color: #fff;
}

.aff-kpi .sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.aff-card-block {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 18px;
}

.aff-card-block h3 {
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.aff-link-box {
    background: rgba(0, 242, 255, 0.05);
    border: 1px dashed rgba(0, 242, 255, 0.4);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.aff-link-box code {
    flex: 1;
    color: var(--primary);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    overflow-wrap: anywhere;
}

.aff-btn-mini {
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--primary);
    color: #000;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.82rem;
}

.aff-btn-mini.outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.aff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.aff-table th, .aff-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--glass-border);
}

.aff-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.aff-bar-chart {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 8px;
    align-items: center;
    margin: 4px 0;
}

.aff-bar-chart .label {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.aff-bar-chart .bar-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aff-bar-chart .bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
}

.aff-bar-chart .bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 999px;
}

.aff-bar-chart .bar.purple > span {
    background: var(--secondary);
}

.aff-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.aff-status-badge.pending { background: rgba(234, 179, 8, 0.12); color: #fcd34d; }
.aff-status-badge.available { background: rgba(0, 242, 255, 0.12); color: var(--primary); }
.aff-status-badge.paid { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; }
.aff-status-badge.void { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.aff-status-badge.rejected { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }

.aff-qr {
    max-width: 180px;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
}

.aff-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.aff-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-secondary);
    border: 1px dashed var(--glass-border);
    border-radius: 14px;
}

/* === Dashboard hero upgrade: greeting tagline + 3 mini KPI === */
.aff-dash-greeting .aff-hero-tagline {
    color: var(--text-secondary);
    font-size: 0.98rem;
    margin: 4px 0 10px;
    max-width: 620px;
}

.aff-mini-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.aff-mini-kpi {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.06), rgba(139, 92, 246, 0.06));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 18px;
    position: relative;
    overflow: hidden;
}

.aff-mini-kpi::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(0, 242, 255, 0.18), transparent 60%);
    opacity: 0.6;
    pointer-events: none;
}

.aff-mini-kpi[data-window="week"]::before {
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.18), transparent 60%);
}

.aff-mini-kpi[data-window="month"]::before {
    background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.18), transparent 60%);
}

.aff-mini-kpi .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 4px;
    position: relative;
}

.aff-mini-kpi .value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    position: relative;
}

.aff-mini-kpi .sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
    position: relative;
}

.aff-mini-kpi .sub strong {
    color: #fff;
}

/* === Goal banner + Daily tip row === */
.aff-hero-extras {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    margin-bottom: 22px;
}

.aff-goal-banner {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 20px 22px;
}

.aff-goal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.aff-goal-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 6px;
}

.aff-goal-amount {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
}

.aff-goal-amount #goal-current {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.aff-goal-sep {
    color: var(--text-secondary);
    margin: 0 6px;
    font-weight: 400;
}

.aff-goal-progress {
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
}

.aff-goal-progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.5);
}

.aff-goal-progress > span.reached {
    background: linear-gradient(90deg, #34d399, #10b981);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.55);
}

.aff-goal-foot {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.aff-goal-foot strong {
    color: #fff;
}

.aff-tip-card {
    background: var(--panel-bg);
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 18px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.aff-tip-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.18), transparent 60%);
    pointer-events: none;
}

.aff-tip-label {
    font-size: 0.72rem;
    color: #c4b5fd;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    margin-bottom: 8px;
    position: relative;
}

.aff-tip-body {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.aff-tip-refresh {
    margin-top: 12px;
    background: transparent;
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: #c4b5fd;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 600;
    position: relative;
    transition: all 0.2s;
}

.aff-tip-refresh:hover {
    background: rgba(139, 92, 246, 0.18);
    color: #fff;
}

/* === Activity feed === */
.aff-activity-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.aff-activity-list {
    display: flex;
    flex-direction: column;
}

.aff-activity-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 4px;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

.aff-activity-item:last-child {
    border-bottom: none;
}

.aff-activity-dot {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 6px;
    background: var(--primary);
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.6);
}

.aff-activity-item.type-conversion .aff-activity-dot {
    background: #34d399;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.aff-activity-item.type-downline_join .aff-activity-dot {
    background: #c084fc;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
}

.aff-activity-item.type-commission_mature .aff-activity-dot {
    background: #fcd34d;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.7);
}

.aff-activity-item.type-payout_created .aff-activity-dot {
    background: #f0abfc;
    box-shadow: 0 0 8px rgba(232, 121, 249, 0.6);
}

.aff-activity-item.type-payout_paid .aff-activity-dot {
    background: #6ee7b7;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.aff-activity-body {
    flex: 1;
    min-width: 0;
}

.aff-activity-title {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.aff-activity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: rgba(0, 242, 255, 0.12);
    color: var(--primary);
    border: 1px solid rgba(0, 242, 255, 0.3);
}

.aff-activity-item.type-conversion .aff-activity-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.aff-activity-item.type-downline_join .aff-activity-badge {
    background: rgba(168, 85, 247, 0.14);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.32);
}

.aff-activity-item.type-commission_mature .aff-activity-badge {
    background: rgba(234, 179, 8, 0.12);
    color: #fcd34d;
    border-color: rgba(234, 179, 8, 0.3);
}

.aff-activity-item.type-payout_created .aff-activity-badge,
.aff-activity-item.type-payout_paid .aff-activity-badge {
    background: rgba(232, 121, 249, 0.14);
    color: #f0abfc;
    border-color: rgba(232, 121, 249, 0.32);
}

.aff-activity-amount {
    font-weight: 800;
    color: #6ee7b7;
    margin-left: auto;
}

.aff-activity-meta {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

/* === Marketing kit === */
.aff-marketing-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.aff-marketing-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.25s;
}

.aff-marketing-item:hover {
    border-color: rgba(0, 242, 255, 0.4);
}

.aff-marketing-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.aff-marketing-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.96rem;
}

.aff-marketing-platform {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

.aff-marketing-body {
    color: #e5e7eb;
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 220px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .aff-hero h1 { font-size: 2.2rem; }
    .aff-nav-auth {
        width: 100%;
        justify-content: flex-end;
    }
    .aff-nav-user {
        max-width: 170px;
        font-size: 0.84rem;
        padding: 8px 12px;
    }
    .aff-dash-header { flex-direction: column; align-items: flex-start; }
    .aff-mini-kpi-row {
        grid-template-columns: 1fr;
    }
    .aff-hero-extras {
        grid-template-columns: 1fr;
    }
    .aff-mini-kpi .value { font-size: 1.25rem; }
    .aff-goal-amount { font-size: 1.15rem; }
    .aff-activity-title { font-size: 0.9rem; }
    .aff-activity-amount { margin-left: 0; }
}

/* ===== Tier badges (3 hạng đối tác) ===== */
.aff-tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    backdrop-filter: blur(10px);
}

.aff-tier-pill .tier-icon {
    font-size: 1rem;
    line-height: 1;
}

.aff-tier-strategic {
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
    border-color: rgba(34, 211, 238, 0.32);
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.12);
}

.aff-tier-comprehensive {
    background: rgba(168, 85, 247, 0.12);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.32);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.14);
}

.aff-tier-special {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(245, 158, 11, 0.10));
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.4);
    box-shadow: 0 0 22px rgba(251, 191, 36, 0.18);
}

.aff-tier-rate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 600;
    color: #cbd5e1;
}

.aff-tier-rate strong {
    color: #ffffff;
    font-weight: 800;
}

/* Banner ăn mừng nâng hạng (tagline phụ) */
.aff-tier-celebrate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    color: #fcd34d;
    font-weight: 700;
}

@media (max-width: 768px) {
    .aff-tier-rate { margin-left: 0; margin-top: 6px; }
}

/* ======================================================== */
/* ===== 2-LINK SYSTEM (Sale link / Partner link) ========= */
/* ======================================================== */
.aff-link-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.aff-link-card {
    position: relative;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    padding: 26px 24px;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.aff-link-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.7;
}

.aff-link-card.link-sale {
    border-color: rgba(34, 211, 238, 0.32);
    box-shadow: 0 12px 30px -22px rgba(34, 211, 238, 0.6);
}

.aff-link-card.link-sale::before {
    background:
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.18), transparent 55%),
        linear-gradient(135deg, rgba(34, 211, 238, 0.06), rgba(8, 145, 178, 0.04));
}

.aff-link-card.link-partner {
    border-color: rgba(168, 85, 247, 0.32);
    box-shadow: 0 12px 30px -22px rgba(168, 85, 247, 0.55);
}

.aff-link-card.link-partner::before {
    background:
        radial-gradient(circle at top right, rgba(168, 85, 247, 0.20), transparent 55%),
        linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(124, 58, 237, 0.04));
}

.aff-link-card:hover {
    transform: translateY(-3px);
}

.aff-link-card.link-sale:hover {
    border-color: rgba(34, 211, 238, 0.55);
    box-shadow: 0 18px 38px -20px rgba(34, 211, 238, 0.55);
}

.aff-link-card.link-partner:hover {
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 18px 38px -20px rgba(168, 85, 247, 0.55);
}

.aff-link-card-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
    margin-bottom: 18px;
}

.aff-link-card-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
}

.aff-link-card.link-sale .aff-link-card-icon {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.20), rgba(8, 145, 178, 0.10));
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.25);
}

.aff-link-card.link-partner .aff-link-card-icon {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(124, 58, 237, 0.10));
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}

.aff-link-card-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #67e8f9;
}

.aff-link-card.link-partner .aff-link-card-eyebrow {
    color: #d8b4fe;
}

.aff-link-card-title {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 6px;
    color: #fff;
}

.aff-link-card-sub {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0;
}

.aff-link-card-sub strong {
    color: #fff;
}

.aff-link-card .aff-link-box {
    margin-bottom: 14px;
    position: relative;
}

.aff-link-box.partner {
    background: rgba(168, 85, 247, 0.07);
    border-color: rgba(168, 85, 247, 0.45);
}

.aff-link-box.partner code {
    color: #d8b4fe;
}

.aff-btn-mini.purple {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #fff;
}

.aff-btn-mini.outline-purple {
    background: transparent;
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.6);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.82rem;
    text-decoration: none;
}

.aff-link-card-perk {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aff-link-card-perk-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: #e5e7eb;
    font-size: 0.88rem;
    line-height: 1.5;
}

.aff-link-card-perk-line strong {
    color: #fff;
}

.aff-perk-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 7px;
}

.aff-perk-dot.cyan {
    background: #22d3ee;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
}

.aff-perk-dot.purple {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
}

.aff-link-card-qr {
    display: flex;
    gap: 14px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--glass-border);
    border-radius: 14px;
    padding: 12px 14px;
    position: relative;
}

.aff-link-card-qr img {
    max-width: 110px;
    background: #fff;
    padding: 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.aff-link-card-qr p {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0;
}

.aff-link-tip {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.06), rgba(168, 85, 247, 0.06));
    border-color: rgba(255, 255, 255, 0.12);
}

.aff-link-tip em {
    color: #fcd34d;
    font-style: normal;
    font-weight: 700;
}

@media (max-width: 860px) {
    .aff-link-cards { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    .aff-link-card { padding: 22px 18px; }
    .aff-link-card-icon { width: 46px; height: 46px; font-size: 1.5rem; }
    .aff-link-card-title { font-size: 1.18rem; }
    .aff-link-card-qr { flex-direction: column; align-items: flex-start; }
    .aff-link-card-qr img { max-width: 140px; align-self: center; }
}

/* ======================================================== */
/* ===== Marketing groups (Sale / Partner separated) ====== */
/* ======================================================== */
.aff-marketing-group {
    margin-top: 18px;
}

.aff-marketing-group-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.aff-marketing-group-head.sale {
    background: rgba(34, 211, 238, 0.07);
    border-color: rgba(34, 211, 238, 0.3);
}

.aff-marketing-group-head.partner {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.32);
}

.aff-marketing-group-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.06);
}

.aff-marketing-group-head.sale .aff-marketing-group-icon {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(8, 145, 178, 0.10));
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.22);
}

.aff-marketing-group-head.partner .aff-marketing-group-icon {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(124, 58, 237, 0.10));
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.22);
}

.aff-marketing-group-title {
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.aff-marketing-group-sub {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.aff-marketing-group-sub code {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #fcd34d;
}

/* ======================================================== */
/* ===== Badges system (achievement grid) ================= */
/* ======================================================== */
.aff-badges-block {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.04), rgba(168, 85, 247, 0.04));
}

.aff-badges-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.aff-badges-counter {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 800;
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.18);
}

.aff-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.aff-badge {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 22px 18px 16px;
    text-align: center;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.aff-badge.locked {
    opacity: 0.55;
    filter: grayscale(0.8);
}

.aff-badge.earned {
    background:
        radial-gradient(circle at top, rgba(34, 211, 238, 0.18), transparent 60%),
        linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(168, 85, 247, 0.06));
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow: 0 0 22px rgba(34, 211, 238, 0.18);
}

.aff-badge.earned::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 20px;
    pointer-events: none;
    background: conic-gradient(from 0deg, rgba(34, 211, 238, 0), rgba(34, 211, 238, 0.4), rgba(168, 85, 247, 0.4), rgba(34, 211, 238, 0));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    padding: 1px;
}

.aff-badge.earned:hover::after { opacity: 0.9; }

.aff-badge:hover {
    transform: translateY(-3px);
}

.aff-badge.earned:hover {
    border-color: rgba(34, 211, 238, 0.7);
    box-shadow: 0 0 28px rgba(34, 211, 238, 0.32);
}

.aff-badge.locked:hover {
    opacity: 0.75;
    filter: grayscale(0.5);
}

.aff-badge-icon {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.aff-badge.earned .aff-badge-icon {
    animation: aff-badge-pulse 2.4s ease-in-out infinite;
}

@keyframes aff-badge-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)); }
    50%      { transform: scale(1.06); filter: drop-shadow(0 6px 14px rgba(34, 211, 238, 0.45)); }
}

.aff-badge-label {
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 2px;
    position: relative;
    z-index: 1;
}

.aff-badge-desc {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.aff-badge-progress {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #cbd5e1;
    position: relative;
    z-index: 1;
}

.aff-badge.earned .aff-badge-progress {
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.35);
    color: #67e8f9;
}

.aff-badge-earned-at {
    color: var(--text-secondary);
    font-size: 0.74rem;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.aff-badge-status {
    margin-top: auto;
    padding-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.aff-badge.earned .aff-badge-status {
    color: #6ee7b7;
}

@media (max-width: 540px) {
    .aff-badges-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .aff-badge { padding: 18px 12px 14px; }
    .aff-badge-icon { font-size: 2.1rem; }
    .aff-badge-label { font-size: 0.92rem; }
    .aff-badge-desc { font-size: 0.76rem; }
}
