/* ==========================================================================
   XtremeReferrals — Affiliate Portal Styles
   Design System: Dark glassmorphism (default) + Light neumorphic
   All styles scoped under .xr-portal to avoid theme conflicts.
   ========================================================================== */

/* --- Google Fonts --------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Fira+Code:wght@400;500;600;700&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS — Dark theme (default)
   ========================================================================== */

:root {
    /* Surfaces */
    --xr-surface-0: 6 10 19;
    --xr-surface-1: 12 17 33;
    --xr-surface-2: 17 24 39;
    --xr-surface-3: 26 34 53;
    --xr-surface-4: 36 48 73;

    /* Glass */
    --xr-glass-bg: rgba(255, 255, 255, 0.03);
    --xr-glass-border: rgba(255, 255, 255, 0.08);
    --xr-glass-hover: rgba(255, 255, 255, 0.06);

    /* Text */
    --xr-text-heading: #ffffff;
    --xr-text-primary: #e2e8f0;
    --xr-text-secondary: #94a3b8;
    --xr-text-muted: #6b7280;
    --xr-text-disabled: #4b5563;

    /* Semantic colors */
    --xr-profit: 0 255 136;
    --xr-loss: #ff4466;
    --xr-accent-blue: #3b82f6;
    --xr-accent-amber: #ffaa00;
    --xr-accent-purple: #a855f7;
    --xr-accent-cyan: #06b6d4;

    /* Derived */
    --xr-profit-color: rgb(var(--xr-profit));
    --xr-profit-dim: rgb(var(--xr-profit) / 0.15);
    --xr-profit-glow: rgb(var(--xr-profit) / 0.25);
    --xr-loss-dim: rgba(255, 68, 102, 0.15);

    /* Radius */
    --xr-radius-sm: 8px;
    --xr-radius: 12px;
    --xr-radius-lg: 16px;
    --xr-radius-full: 9999px;

    /* Shadows */
    --xr-shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --xr-shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.4);

    /* Divider */
    --xr-divider: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   2. DESIGN TOKENS — Light / neumorphic theme
   ========================================================================== */

html[data-theme="light"] {
    --xr-surface-0: 224 229 236;
    --xr-surface-1: 228 233 240;
    --xr-surface-2: 232 236 242;
    --xr-surface-3: 218 223 230;
    --xr-surface-4: 210 215 222;

    --xr-glass-bg: rgb(224 229 236);
    --xr-glass-border: rgba(0, 0, 0, 0.04);
    --xr-glass-hover: rgb(218 223 230);

    --xr-text-heading: #1a1d1e;
    --xr-text-primary: #2d3436;
    --xr-text-secondary: #636e72;
    --xr-text-muted: #7f8c8d;
    --xr-text-disabled: #95a5a6;

    --xr-profit: 45 206 137;
    --xr-profit-color: rgb(var(--xr-profit));
    --xr-profit-dim: rgb(var(--xr-profit) / 0.15);
    --xr-profit-glow: rgb(var(--xr-profit) / 0.25);

    --xr-shadow-card: 6px 6px 12px #b8bec7, -6px -6px 12px #ffffff;
    --xr-shadow-sm: 3px 3px 6px #b8bec7, -3px -3px 6px #ffffff;
    --xr-shadow-lg: 8px 8px 20px rgba(163, 177, 198, 0.5), -8px -8px 20px rgba(255, 255, 255, 0.8);
    --xr-neu-raised: 6px 6px 12px #b8bec7, -6px -6px 12px #ffffff;
    --xr-neu-raised-sm: 3px 3px 6px #b8bec7, -3px -3px 6px #ffffff;
    --xr-neu-inset: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff;

    --xr-divider: rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   3. PORTAL CONTAINER
   ========================================================================== */

.xr-portal {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--xr-text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background: #e0e5ec;
    margin: -20px -20px 0;
    padding: 0;
}

.xr-portal *,
.xr-portal *::before,
.xr-portal *::after { box-sizing: border-box; }

/* Headings use Sora */
.xr-portal h1,
.xr-portal h2,
.xr-portal h3 {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--xr-text-heading);
    font-weight: 600;
    margin: 0;
}

/* Currency / numbers always monospace */
.xr-portal .woocommerce-Price-amount,
.xr-portal bdi,
.xr-portal code {
    font-family: "Fira Code", "SF Mono", Consolas, monospace;
}

/* Scrollbar */
.xr-portal ::-webkit-scrollbar { width: 6px; height: 6px; }
.xr-portal ::-webkit-scrollbar-track { background: transparent; }
.xr-portal ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
.xr-portal ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

html[data-theme="light"] .xr-portal ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); }

/* ==========================================================================
   4. PORTAL HEADER
   ========================================================================== */

.xr-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--xr-glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--xr-glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

html[data-theme="light"] .xr-portal-header {
    background: rgb(var(--xr-surface-0));
    backdrop-filter: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.xr-brand-text {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--xr-text-heading);
}

.xr-brand-text span {
    background: linear-gradient(135deg, rgb(var(--xr-profit)), var(--xr-accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.xr-portal-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.xr-portal-username {
    color: var(--xr-text-primary);
    font-weight: 600;
}

.xr-logout-link {
    color: var(--xr-text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}
.xr-logout-link:hover { color: var(--xr-loss); }

/* ==========================================================================
   5. LAYOUT: SIDEBAR + MAIN
   ========================================================================== */

.xr-portal-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 61px);
}

@media (max-width: 768px) {
    .xr-portal-layout { grid-template-columns: 1fr; }
    .xr-portal-nav {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--xr-glass-border);
        padding: 12px 16px;
        gap: 4px;
    }
}

/* ==========================================================================
   6. SIDEBAR NAVIGATION
   ========================================================================== */

.xr-portal-nav {
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    border-right: 1px solid var(--xr-glass-border);
    background: var(--xr-glass-bg);
    gap: 4px;
}

html[data-theme="light"] .xr-portal-nav {
    background: rgb(var(--xr-surface-1));
    box-shadow: inset -1px 0 0 var(--xr-glass-border);
}

.xr-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--xr-radius-sm);
    text-decoration: none;
    color: var(--xr-text-muted);
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.xr-nav-item:hover {
    color: var(--xr-text-primary);
    background: var(--xr-glass-hover);
}

.xr-nav-item.active {
    color: var(--xr-profit-color);
    background: var(--xr-profit-dim);
    border-left: 3px solid var(--xr-profit-color);
}

html[data-theme="light"] .xr-nav-item.active {
    box-shadow: var(--xr-neu-inset);
    background: rgba(0, 0, 0, 0.03);
}

.xr-nav-icon { font-size: 18px; width: 24px; text-align: center; }

/* Coupon card in sidebar */
.xr-nav-coupon {
    margin-top: auto;
    padding: 16px;
    background: rgba(255, 170, 0, 0.08);
    border: 1px solid rgba(255, 170, 0, 0.15);
    border-radius: 10px;
}

html[data-theme="light"] .xr-nav-coupon {
    background: rgba(0, 0, 0, 0.03);
    border: none;
    box-shadow: var(--xr-neu-raised-sm);
}

.xr-nav-coupon-label {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--xr-accent-amber);
    margin-bottom: 8px;
}

.xr-coupon-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.xr-coupon-display code {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 170, 0, 0.2);
    border-radius: 6px;
    padding: 4px 10px;
    color: var(--xr-accent-amber);
    font-family: "Fira Code", monospace;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    flex: 1;
    text-align: center;
}

html[data-theme="light"] .xr-coupon-display code {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    box-shadow: var(--xr-neu-inset);
    color: var(--xr-accent-amber);
}

/* ==========================================================================
   7. MAIN CONTENT
   ========================================================================== */

.xr-portal-main {
    padding: 28px 32px;
    overflow-x: auto;
}

@media (max-width: 768px) { .xr-portal-main { padding: 20px 16px; } }

/* ==========================================================================
   8. TAB HEADER
   ========================================================================== */

.xr-tab-content { max-width: 1000px; }

.xr-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.xr-tab-header h2 {
    font-size: 22px;
    font-weight: 600;
}

/* ==========================================================================
   9. STAT CARDS
   ========================================================================== */

.xr-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 900px) { .xr-stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .xr-stats-grid { grid-template-columns: 1fr; } }

.xr-payout-balance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 700px) { .xr-payout-balance-grid { grid-template-columns: 1fr; } }

.xr-stat-card {
    background: var(--xr-glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--xr-glass-border);
    border-radius: var(--xr-radius);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

html[data-theme="light"] .xr-stat-card {
    background: rgb(var(--xr-surface-0));
    backdrop-filter: none;
    border: none;
    box-shadow: var(--xr-shadow-card);
}

/* Card shine effect (dark only) */
.xr-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}
.xr-stat-card:hover::before { left: 100%; }
html[data-theme="light"] .xr-stat-card::before { display: none; }

.xr-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgb(var(--xr-profit) / 0.12), 0 0 40px rgb(var(--xr-profit) / 0.06);
}

html[data-theme="light"] .xr-stat-card:hover {
    box-shadow: var(--xr-shadow-card), 0 0 16px rgb(var(--xr-profit) / 0.12);
}

.xr-stat-label {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--xr-text-muted);
    margin-bottom: 8px;
}

.xr-stat-value {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--xr-text-heading);
    line-height: 1;
}

.xr-stat-hint {
    font-size: 11px;
    color: var(--xr-text-muted);
    margin-top: 6px;
}

/* Gold variant — unpaid commission */
.xr-stat-gold .xr-stat-value { color: var(--xr-accent-amber); }
.xr-stat-gold {
    border-color: rgba(255, 170, 0, 0.2);
}
html[data-theme="light"] .xr-stat-gold {
    box-shadow: var(--xr-shadow-card), 0 0 16px rgba(255, 170, 0, 0.1);
}

/* Warning variant */
.xr-stat-warning .xr-stat-value { color: var(--xr-accent-amber); }
.xr-stat-warning {
    border-color: rgba(255, 170, 0, 0.2);
}

/* ==========================================================================
   10. PANELS
   ========================================================================== */

.xr-panel {
    background: var(--xr-glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--xr-glass-border);
    border-radius: var(--xr-radius);
    margin-bottom: 20px;
    overflow: hidden;
}

html[data-theme="light"] .xr-panel {
    background: rgb(var(--xr-surface-0));
    backdrop-filter: none;
    border: none;
    box-shadow: var(--xr-shadow-card);
}

.xr-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--xr-divider);
}

.xr-panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--xr-profit-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xr-chart-panel { margin-bottom: 20px; }
.xr-chart-wrap { padding: 20px; }

/* ==========================================================================
   11. REFERRAL LINK
   ========================================================================== */

.xr-ref-link-panel .xr-panel-header + * { padding: 20px; }

.xr-ref-link-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 20px;
    padding-bottom: 8px;
}

.xr-ref-link-wrap input {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--xr-glass-border);
    border-radius: var(--xr-radius-sm);
    padding: 10px 14px;
    color: var(--xr-text-primary);
    font-family: "Fira Code", monospace;
    font-size: 13px;
}

html[data-theme="light"] .xr-ref-link-wrap input {
    background: rgba(0, 0, 0, 0.03);
    border: none;
    box-shadow: var(--xr-neu-inset);
    color: var(--xr-text-primary);
}

.xr-hint {
    padding: 0 20px 20px;
    font-size: 12px;
    color: #7f8c8d;
    margin: 0;
}

/* ==========================================================================
   12. TABLES
   ========================================================================== */

.xr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.xr-table thead tr { background: rgba(0, 0, 0, 0.15); }

html[data-theme="light"] .xr-table thead tr {
    background: rgba(0, 0, 0, 0.03);
}

.xr-table th {
    padding: 10px 16px;
    text-align: left;
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--xr-text-muted);
    border-bottom: 1px solid var(--xr-divider);
}

.xr-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--xr-divider);
    color: var(--xr-text-primary);
    vertical-align: middle;
}

.xr-table tr:last-child td { border-bottom: none; }
.xr-table tbody tr:hover { background: var(--xr-glass-hover); }

.xr-gold {
    color: var(--xr-accent-amber);
    font-family: "Fira Code", monospace;
    font-weight: 600;
}

.xr-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--xr-text-muted);
    font-size: 14px;
}

/* ==========================================================================
   13. BADGES
   ========================================================================== */

.xr-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--xr-radius-full);
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.xr-badge-pending  { background: rgba(255, 170, 0, 0.12);  color: var(--xr-accent-amber); }
.xr-badge-paid     { background: var(--xr-profit-dim);      color: var(--xr-profit-color); }
.xr-badge-voided   { background: var(--xr-loss-dim);        color: var(--xr-loss); }
.xr-badge-rejected { background: var(--xr-loss-dim);        color: var(--xr-loss); }
.xr-badge-source-coupon { background: rgba(59, 130, 246, 0.12); color: var(--xr-accent-blue); }
.xr-badge-source-cookie { background: rgba(255, 170, 0, 0.12); color: var(--xr-accent-amber); }

/* ==========================================================================
   14. BUTTONS
   ========================================================================== */

.xr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--xr-radius);
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--xr-glass-border);
    background: var(--xr-glass-bg);
    color: var(--xr-text-primary);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.xr-btn:hover {
    border-color: var(--xr-profit-color);
    color: var(--xr-profit-color);
    background: var(--xr-glass-hover);
}

html[data-theme="light"] .xr-btn {
    background: rgb(var(--xr-surface-0));
    border: none;
    box-shadow: var(--xr-neu-raised-sm);
}

html[data-theme="light"] .xr-btn:hover {
    color: var(--xr-profit-color);
    box-shadow: var(--xr-neu-raised-sm), 0 0 8px rgb(var(--xr-profit) / 0.15);
}

/* Primary CTA — gradient */
.xr-btn-primary {
    background: linear-gradient(135deg, rgb(var(--xr-profit)), var(--xr-accent-cyan));
    color: rgb(var(--xr-surface-0));
    border: none;
    box-shadow: 0 4px 16px rgb(var(--xr-profit) / 0.3);
}

.xr-btn-primary:hover {
    box-shadow: 0 4px 24px rgb(var(--xr-profit) / 0.45);
    color: rgb(var(--xr-surface-0));
    transform: translateY(-1px);
}

html[data-theme="light"] .xr-btn-primary {
    box-shadow: var(--xr-neu-raised-sm), 0 0 12px rgb(var(--xr-profit) / 0.2);
}

.xr-btn-full { width: 100%; justify-content: center; }
.xr-btn-lg   { padding: 14px 28px; font-size: 15px; border-radius: var(--xr-radius-lg); }

/* Copy buttons */
.xr-copy-btn {
    background: var(--xr-glass-hover);
    border: 1px solid var(--xr-glass-border);
    border-radius: 6px;
    padding: 5px 10px;
    color: var(--xr-text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.xr-copy-btn:hover {
    border-color: var(--xr-profit-color);
    color: var(--xr-profit-color);
}

.xr-copy-btn.copied {
    background: var(--xr-profit-dim);
    border-color: var(--xr-profit-color);
    color: var(--xr-profit-color);
}

.xr-copy-btn-sm {
    background: #e0e5ec;
    border: none;
    box-shadow: 2px 2px 4px #b8bec7, -2px -2px 4px #ffffff;
    border-radius: 6px;
    padding: 3px 10px;
    color: #636e72;
    cursor: pointer;
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.2s;
    margin-left: 8px;
}

.xr-copy-btn-sm:hover {
    color: #2dce89;
    box-shadow: 3px 3px 6px #b8bec7, -3px -3px 6px #ffffff;
}

/* ==========================================================================
   15. FILTER / PERIOD TABS
   ========================================================================== */

.xr-period-tabs, .xr-filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    background: var(--xr-glass-bg);
    border: 1px solid var(--xr-glass-border);
    border-radius: var(--xr-radius);
    padding: 4px;
}

html[data-theme="light"] .xr-period-tabs,
html[data-theme="light"] .xr-filter-tabs {
    background: rgb(var(--xr-surface-0));
    border: none;
    box-shadow: var(--xr-neu-raised-sm);
}

.xr-period-btn, .xr-filter-btn {
    padding: 6px 14px;
    border-radius: var(--xr-radius-sm);
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--xr-text-muted);
    transition: all 0.2s;
}

.xr-period-btn:hover, .xr-filter-btn:hover {
    color: var(--xr-text-primary);
}

.xr-period-btn.active, .xr-filter-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--xr-text-heading);
}

html[data-theme="light"] .xr-period-btn.active,
html[data-theme="light"] .xr-filter-btn.active {
    background: rgba(0, 0, 0, 0.03);
    box-shadow: inset 2px 2px 4px #b8bec7, inset -2px -2px 4px #ffffff;
    color: var(--xr-profit-color);
}

/* ==========================================================================
   16. PAGINATION
   ========================================================================== */

.xr-pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.xr-pagination .xr-btn-sm { padding: 6px 12px; font-size: 12px; }
.xr-pagination .xr-btn-primary {
    background: var(--xr-profit-color);
    color: rgb(var(--xr-surface-0));
}

/* ==========================================================================
   17. NOTICES
   ========================================================================== */

.xr-notice {
    padding: 14px 18px;
    border-radius: var(--xr-radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.xr-notice-error {
    background: var(--xr-loss-dim);
    border: 1px solid rgba(255, 68, 102, 0.2);
    color: var(--xr-loss);
}

.xr-notice-success {
    background: var(--xr-profit-dim);
    border: 1px solid rgb(var(--xr-profit) / 0.2);
    color: var(--xr-profit-color);
}

.xr-notice-info {
    background: rgba(255, 68, 102, 0.08);
    border: 1px solid rgba(255, 68, 102, 0.18);
    color: #cc3355;
}

.xr-notice-warning {
    background: rgba(255, 170, 0, 0.08);
    border: 1px solid rgba(255, 170, 0, 0.15);
    color: var(--xr-accent-amber);
}

/* ==========================================================================
   18. PAYOUT FORM
   ========================================================================== */

.xr-payout-request-panel { margin-bottom: 20px; }
.xr-payout-request-panel .xr-hint { padding: 20px 20px 8px; }

.xr-payout-form {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 20px 20px;
    flex-wrap: wrap;
}

.xr-amount-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--xr-glass-border);
    border-radius: var(--xr-radius-sm);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.xr-amount-input-wrap:focus-within {
    border-color: rgb(var(--xr-profit) / 0.4);
    box-shadow: 0 0 0 3px rgb(var(--xr-profit) / 0.1);
}

html[data-theme="light"] .xr-amount-input-wrap {
    background: rgba(0, 0, 0, 0.03);
    border: none;
    box-shadow: var(--xr-neu-inset);
}

html[data-theme="light"] .xr-amount-input-wrap:focus-within {
    box-shadow: var(--xr-neu-inset), 0 0 0 2px rgb(var(--xr-profit) / 0.25);
}

.xr-currency-symbol {
    padding: 0 12px;
    color: var(--xr-accent-amber);
    font-family: "Fira Code", monospace;
    font-weight: 600;
    font-size: 16px;
    background: rgba(255, 170, 0, 0.06);
    align-self: stretch;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--xr-glass-border);
}

html[data-theme="light"] .xr-currency-symbol {
    border-right-color: var(--xr-divider);
}

.xr-amount-input-wrap input[type="number"] {
    background: transparent;
    border: none;
    padding: 12px 16px;
    color: var(--xr-text-heading);
    font-family: "Fira Code", monospace;
    font-size: 18px;
    font-weight: 600;
    width: 160px;
    outline: none;
}

.xr-payout-msg {
    margin: 0 20px 20px;
    padding: 12px 16px;
    border-radius: var(--xr-radius-sm);
    font-size: 14px;
}

.xr-payout-msg.success {
    background: var(--xr-profit-dim);
    border: 1px solid rgb(var(--xr-profit) / 0.2);
    color: var(--xr-profit-color);
}

.xr-payout-msg.error {
    background: var(--xr-loss-dim);
    border: 1px solid rgba(255, 68, 102, 0.2);
    color: var(--xr-loss);
}

/* ==========================================================================
   19. PORTAL FORMS (Settings tab)
   ========================================================================== */

.xr-portal-form { padding: 20px; }

.xr-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) { .xr-form-grid { grid-template-columns: 1fr; } }

.xr-form-row-full { grid-column: 1 / -1; }

.xr-form-row { display: flex; flex-direction: column; gap: 6px; }

.xr-form-row label {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7f8c8d;
}

.xr-form-row input,
.xr-form-row textarea,
.xr-form-row select {
    background: #e0e5ec;
    border: none;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff;
    border-radius: 10px;
    padding: 12px 16px;
    color: #2d3436;
    font-family: "Manrope", sans-serif;
    font-size: 14px;
    transition: box-shadow 0.2s;
    width: 100%;
    outline: none;
}

.xr-form-row input:focus,
.xr-form-row textarea:focus {
    outline: none;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff, 0 0 0 2px rgba(45, 206, 137, 0.25);
}


.xr-form-actions { margin-top: 20px; }

/* Info grid (settings tab read-only) */
.xr-info-grid { display: flex; flex-direction: column; }

.xr-info-row {
    display: flex;
    align-items: flex-start;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    gap: 20px;
    font-size: 13px;
    color: #2d3436;
}

.xr-info-row:last-child { border-bottom: none; }

.xr-info-label {
    width: 140px;
    flex-shrink: 0;
    color: #7f8c8d;
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding-top: 2px;
}

.xr-ref-link-text {
    font-family: "Fira Code", monospace;
    font-size: 12px;
    word-break: break-all;
    color: #2d3436;
}

.xr-portal code {
    background: #e0e5ec;
    box-shadow: inset 2px 2px 4px #b8bec7, inset -2px -2px 4px #ffffff;
    border: none;
    border-radius: 6px;
    padding: 2px 7px;
    color: var(--xr-accent-blue);
    font-family: "Fira Code", monospace;
    font-size: 13px;
}

/* ==========================================================================
   20. LOADING SPINNER
   ========================================================================== */

.xr-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--xr-text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

.xr-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgb(var(--xr-profit) / 0.2);
    border-top-color: var(--xr-profit-color);
    border-radius: 50%;
    animation: xr-spin 0.7s linear infinite;
}

@keyframes xr-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   21. LOGIN PAGE
   ========================================================================== */

.xr-login-page {
    min-height: auto;
    background: #000000 !important;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0 20px 20px;
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.xr-login-logo {
    height: 80px;
    width: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

.xr-login-card {
    width: 100%;
    max-width: 420px;
    background: #e0e5ec !important;
    backdrop-filter: none;f
    border: none !important;
    border-radius: 20px;
    padding: 40px;
    animation: xr-fade-in 0.4s ease;
}

@keyframes xr-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.xr-login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.xr-login-title {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #1a1d1e !important;
    margin: 0 0 6px;
    text-align: center;
}

.xr-login-subtitle {
    font-size: 14px;
    color: #7f8c8d !important;
    text-align: center;
    margin: 0 0 24px;
}

.xr-login-form .xr-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.xr-login-form label {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--xr-text-muted);
}

.xr-login-form input {
    background: #e0e5ec !important;
    border: none !important;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff;
    border-radius: var(--xr-radius-sm);
    padding: 12px 16px;
    color: var(--xr-text-primary);
    font-family: "Manrope", sans-serif;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    -webkit-appearance: none;
}

.xr-login-form input:focus {
    outline: none;
    border-color: rgb(var(--xr-profit) / 0.4);
    box-shadow: 0 0 0 3px rgb(var(--xr-profit) / 0.15);
}

html[data-theme="light"] .xr-login-form input {
    background: rgba(0, 0, 0, 0.03);
    border: none;
    box-shadow: var(--xr-neu-inset);
    color: var(--xr-text-primary);
}

html[data-theme="light"] .xr-login-form input:focus {
    box-shadow: var(--xr-neu-inset), 0 0 0 2px rgb(var(--xr-profit) / 0.25);
}

.xr-remember-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--xr-text-muted);
    margin-bottom: 20px;
}

/* Toggle switch */
.xr-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.xr-switch input { opacity: 0; width: 0; height: 0; }
.xr-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #b8bec7;
    border-radius: 22px;
    transition: background 0.2s;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1);
}
.xr-switch-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
}
.xr-switch input:checked + .xr-switch-slider {
    background: var(--xr-profit-color);
}
.xr-switch input:checked + .xr-switch-slider::before {
    transform: translateX(18px);
}

.xr-login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}

.xr-login-footer a {
    color: var(--xr-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.xr-login-footer a:hover { color: var(--xr-profit-color); }

/* Login button — neumorphic raised */
.xr-login-submit {
    background: #e0e5ec !important;
    box-shadow: 4px 4px 8px #b8bec7, -4px -4px 8px #ffffff !important;
    color: #2d3436 !important;
    border: none !important;
    font-weight: 600;
}
.xr-login-submit:hover {
    box-shadow: 5px 5px 10px #b0b8c4, -5px -5px 10px #ffffff, 0 0 0 2px rgba(45, 206, 137, 0.2) !important;
    color: #2dce89 !important;
    transform: translateY(-1px);
}

/* Login form labels — always dark */
.xr-login-form label { color: #7f8c8d !important; }
.xr-remember-label { color: #7f8c8d !important; }
.xr-login-footer a { color: #7f8c8d !important; }

/* Login form input text */
.xr-login-form input { color: #2d3436 !important; }
.xr-login-form input::placeholder { color: #95a5a6 !important; }

/* ==========================================================================
   22. LOGIN GATE
   ========================================================================== */

.xr-login-gate {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.xr-portal.xr-login-gate,
.xr-portal:has(.xr-login-gate) {
    min-height: auto;
    background: transparent;
}

.xr-gate-card {
    max-width: 400px;
    width: 100%;
    text-align: center;
    padding: 48px 36px;
    border-radius: 20px;
    background: #f0f3f8;
    box-shadow: 8px 8px 16px #c8cdd5, -8px -8px 16px #ffffff;
}

.xr-gate-logo {
    height: 80px;
    width: auto;
    margin: 0 auto 20px;
    display: block;
    border-radius: 10px;
}

.xr-gate-card h2 {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 10px;
}

.xr-gate-card p {
    font-family: "Manrope", sans-serif;
    font-size: 14px;
    color: #7f8c8d;
    margin: 0 0 28px;
    line-height: 1.6;
}

.xr-gate-btn {
    display: inline-block;
    padding: 12px 40px;
    font-family: "Manrope", sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    text-decoration: none;
    border-radius: 14px;
    background: #f0f3f8;
    box-shadow: 4px 4px 8px #c8cdd5, -4px -4px 8px #ffffff;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.xr-gate-btn:hover {
    box-shadow: 5px 5px 10px #c0c5cd, -5px -5px 10px #ffffff, 0 0 0 2px rgba(0, 255, 136, 0.2);
    color: #00cc6a;
    transform: translateY(-1px);
}

/* ==========================================================================
   23. GRADIENT TEXT UTILITY
   ========================================================================== */

.xr-gradient-text {
    background: linear-gradient(135deg, rgb(var(--xr-profit)), var(--xr-accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   24. GLOW EFFECTS
   ========================================================================== */

.xr-glow-green  { box-shadow: 0 0 20px rgb(var(--xr-profit) / 0.12), 0 0 40px rgb(var(--xr-profit) / 0.06); }
.xr-glow-red    { box-shadow: 0 0 20px rgba(255, 68, 102, 0.12), 0 0 40px rgba(255, 68, 102, 0.06); }
.xr-glow-blue   { box-shadow: 0 0 20px rgba(59, 130, 246, 0.12), 0 0 40px rgba(59, 130, 246, 0.06); }
.xr-glow-amber  { box-shadow: 0 0 20px rgba(255, 170, 0, 0.12), 0 0 40px rgba(255, 170, 0, 0.06); }

/* ==========================================================================
   25. FORCE LIGHT NEUMORPHIC ON ALL PORTAL PAGES
   Always light — no dark mode on the frontend portal.
   ========================================================================== */

/* --- Base surface --- */
.xr-portal {
    background: #e0e5ec !important;
    color: #2d3436 !important;
}

/* --- Portal logo --- */
.xr-portal-logo {
    height: 50px;
    width: auto;
    display: block;
    border-radius: 8px;
}

/* --- Header --- */
.xr-portal-header {
    background: #e0e5ec !important;
    backdrop-filter: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

.xr-portal-username { color: #2d3436 !important; }
.xr-logout-link { color: #7f8c8d !important; }
.xr-logout-link:hover { color: #ff4466 !important; }

/* --- Sidebar nav --- */
.xr-portal-nav {
    background: #dae0e8 !important;
    border-right: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.xr-nav-item {
    color: #636e72 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 10px !important;
}

.xr-nav-item:hover {
    background: #e0e5ec !important;
    box-shadow: 3px 3px 6px #b8bec7, -3px -3px 6px #ffffff !important;
    color: #2d3436 !important;
}

.xr-nav-item.active {
    background: #e0e5ec !important;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff !important;
    color: #2dce89 !important;
    font-weight: 600 !important;
}

.xr-nav-coupon-label { color: #7f8c8d !important; }
.xr-coupon-display code {
    background: #e0e5ec !important;
    box-shadow: inset 2px 2px 4px #b8bec7, inset -2px -2px 4px #ffffff !important;
    color: #2dce89 !important;
    border: none !important;
}
.xr-copy-btn {
    background: #e0e5ec !important;
    box-shadow: 2px 2px 4px #b8bec7, -2px -2px 4px #ffffff !important;
    color: #636e72 !important;
    border: none !important;
}

/* --- Main content area --- */
.xr-portal-main { background: #e0e5ec !important; }

/* --- Headings --- */
.xr-portal h1,
.xr-portal h2,
.xr-portal h3 { color: #1a1d1e !important; }

.xr-tab-header h2 { color: #1a1d1e !important; }

/* --- Stat cards --- */
.xr-stat-card {
    background: #e0e5ec !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: 4px 4px 8px #b8bec7, -4px -4px 8px #ffffff !important;
    border-radius: 14px !important;
}

.xr-stat-label { color: #7f8c8d !important; }
.xr-stat-value { color: #2d3436 !important; }
.xr-stat-gold .xr-stat-value { color: #2dce89 !important; }

/* --- Panels (chart, referral link, etc.) --- */

.xr-portal-logo{
    height: 50px !important;

}
.xr-panel,
.xr-chart-panel,
.xr-ref-link-panel {
    background: #e0e5ec !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: 4px 4px 8px #b8bec7, -4px -4px 8px #ffffff !important;
    border-radius: 14px !important;
}

.xr-panel-header { border-color: rgba(0, 0, 0, 0.06) !important; }
.xr-panel-header h3 { color: #2d3436 !important; }

/* --- Buttons --- */
.xr-portal .xr-btn {
    background: #e0e5ec !important;
    box-shadow: 3px 3px 6px #b8bec7, -3px -3px 6px #ffffff !important;
    color: #636e72 !important;
    border: none !important;
    backdrop-filter: none !important;
}

.xr-portal .xr-btn:hover {
    box-shadow: 4px 4px 8px #b8bec7, -4px -4px 8px #ffffff, 0 0 0 2px rgba(45, 206, 137, 0.2) !important;
    color: #2dce89 !important;
}

.xr-portal .xr-btn-primary {
    background: #e0e5ec !important;
    box-shadow: 3px 3px 6px #b8bec7, -3px -3px 6px #ffffff !important;
    color: #2dce89 !important;
    border: none !important;
}

/* --- Period tabs --- */
.xr-period-btn {
    background: transparent !important;
    box-shadow: none !important;
    color: #7f8c8d !important;
    border: none !important;
}

.xr-period-btn.active,
.xr-period-btn:hover {
    background: #e0e5ec !important;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff !important;
    color: #2dce89 !important;
}

/* --- Tables --- */
.xr-portal .xr-table th { color: #7f8c8d !important; border-color: rgba(0, 0, 0, 0.06) !important; }
.xr-portal .xr-table td { color: #2d3436 !important; border-color: rgba(0, 0, 0, 0.06) !important; }
.xr-portal .xr-table a { color: #2dce89 !important; }

/* --- Inputs --- */
.xr-portal input[type="text"],
.xr-portal input[type="email"],
.xr-portal input[type="number"],
.xr-portal input[type="url"],
.xr-portal textarea,
.xr-portal select {
    background: #e0e5ec !important;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff !important;
    border: none !important;
    color: #2d3436 !important;
    border-radius: 10px !important;
}

/* --- Referral link input --- */
.xr-ref-link-wrap input {
    background: #e0e5ec !important;
    box-shadow: inset 3px 3px 6px #b8bec7, inset -3px -3px 6px #ffffff !important;
    border: none !important;
    color: #2d3436 !important;
}

/* --- Badges --- */
.xr-portal .xr-badge { border: none !important; }

/* --- Filter tabs --- */
.xr-portal .xr-filter-tab {
    color: #636e72 !important;
    background: transparent !important;
}
.xr-portal .xr-filter-tab.active,
.xr-portal .xr-filter-tab:hover {
    color: #2dce89 !important;
    background: #e0e5ec !important;
    box-shadow: inset 2px 2px 4px #b8bec7, inset -2px -2px 4px #ffffff !important;
}

/* --- Misc text --- */
.xr-portal .xr-hint { color: #7f8c8d !important; }
.xr-portal .xr-muted { color: #7f8c8d !important; }
.xr-portal .xr-gold,
.xr-portal .xr-stat-gold .xr-stat-value { color: #2dce89 !important; }

/* --- Scrollbar light --- */
.xr-portal ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12) !important; }

/* --- Loading spinner --- */
.xr-portal .xr-loading { color: #7f8c8d !important; }
.xr-portal .xr-spinner { border-color: rgba(0, 0, 0, 0.1) !important; border-top-color: #2dce89 !important; }

html[data-theme="light"] .xr-glow-green { box-shadow: var(--xr-neu-raised), 0 0 16px rgb(var(--xr-profit) / 0.12); }

/* ==========================================================================
   25. DIVIDERS
   ========================================================================== */

.xr-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--xr-divider), transparent);
}

/* ==========================================================================
   26. ANIMATIONS
   ========================================================================== */

@keyframes xr-pulse-glow {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

@keyframes xr-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@keyframes xr-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================================
   RESPONSIVE — PORTAL MOBILE (<768px)
   ========================================================================== */

@media (max-width: 768px) {
    /* Header */
    .xr-portal-header {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 12px 16px !important;
    }

    .xr-portal-logo { height: 40px; }
    .xr-portal-user { font-size: 12px; gap: 10px; }

    /* Nav: hide icons on very small, tighten spacing */
    .xr-nav-item { padding: 8px 12px !important; font-size: 13px; }
    .xr-nav-icon { display: none; }

    /* Coupon in sidebar */
    .xr-nav-coupon { padding: 10px 12px; }
    .xr-nav-coupon-label { font-size: 9px; }

    /* Main content */
    .xr-portal-main { padding: 16px 12px !important; }

    /* Tab header */
    .xr-tab-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .xr-period-tabs { flex-wrap: wrap; gap: 4px; }
    .xr-period-btn { font-size: 11px; padding: 5px 10px; }

    /* Stat cards */
    .xr-stat-card { padding: 14px 16px !important; }
    .xr-stat-value { font-size: 20px; }

    /* Panels */
    .xr-panel,
    .xr-chart-panel,
    .xr-ref-link-panel { padding: 14px !important; border-radius: 12px !important; }

    .xr-panel-header { padding: 0 0 10px !important; }
    .xr-panel-header h3 { font-size: 13px; }

    /* Referral link */
    .xr-ref-link-wrap {
        flex-direction: column;
        gap: 8px;
    }
    .xr-ref-link-wrap input { font-size: 11px; }

    /* Info rows (settings tab) */
    .xr-info-row {
        flex-direction: column;
        gap: 4px;
        padding: 10px 14px;
    }
    .xr-info-label { width: auto; }

    /* Tables in portal */
    .xr-portal .xr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Login card */
    .xr-login-card { padding: 28px 24px; max-width: 100%; }
    .xr-login-logo { height: 60px; }

    /* Payout form */
    .xr-payout-form { flex-direction: column; }
}

@media (max-width: 480px) {
    .xr-portal-logo { height: 32px; }
    .xr-stat-value { font-size: 18px; }
    .xr-nav-item { padding: 6px 10px !important; font-size: 12px; }
    .xr-period-btn { font-size: 10px; padding: 4px 8px; }
}
