:root{
    /* =========================================
       CORES
    ========================================= */
    --primary:#d4af37;
    --primary-dark:#b8860b;
    --bg:#f8fafc;
    --surface:#ffffff;
    --surface-soft:#f1f5f9;
    --text:#0f172a;
    --muted:#64748b;
    --border:#dbe2ea;
    --success:#16a34a;
    --error:#dc2626;
    --radius:14px;
    --shadow:0 8px 25px rgba(15,23,42,.07);
}

/* =========================================
   RESET + BASE
========================================= */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}
html,body{
    width:100%;
    min-height:100vh;
    overflow-x:hidden;
}
body{
    font-family:'Segoe UI',system-ui,sans-serif;
    background:linear-gradient(180deg,#f8fafc 0%,#eef2f7 100%);
    color:var(--text);
    line-height:1.5;
}

/* =========================================
   LINKS + TEXTOS
========================================= */
a{
    text-decoration:none;
    color:var(--primary-dark);
    transition:.25s ease;
}
a:hover{
    color:var(--primary);
}
.text-muted{
    color:var(--muted);
    font-size:0.9rem;
}

/* =========================================
   LAYOUT
========================================= */
.app-layout{
    display:flex;
    min-height:100vh;
}
.main-content{
    width:100%;
    margin-left:260px;
    padding:80px 20px 20px;
    display:flex;
    flex-direction:column;
    gap:1.25rem;
}

/* =========================================
   SIDEBAR
========================================= */
.sidebar{
    position:fixed;
    top:0;
    left:0;
    width:260px;
    height:100vh;
    background:#ffffff;
    border-right:1px solid var(--border);
    padding:20px 14px;
    overflow-y:auto;
    z-index:1000;
    box-shadow:var(--shadow);
    transition:left .3s cubic-bezier(0.4,0,0.2,1);
}

/* =========================================
   TOP HEADER
========================================= */
.top-header{
    position:fixed;
    top:0;
    left:260px;
    right:0;
    height:68px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 24px;
    z-index:998;
    background:linear-gradient(90deg,rgba(2,8,23,.96),rgba(15,23,42,.96));
    backdrop-filter:blur(14px);
    border-bottom:1px solid rgba(255,255,255,.06);
    box-shadow:0 4px 20px rgba(0,0,0,.18);
    transition:left .3s cubic-bezier(0.4,0,0.2,1);
}

/* =========================================
   HEADER LEFT + RIGHT
========================================= */
.top-header-left h2{
    margin:0;
    font-size:22px;
    font-weight:700;
    color:#ffffff;
}
.top-header-left p{
    margin-top:2px;
    color:#94a3b8;
    font-size:13.5px;
}
.top-header-right{
    display:flex;
    align-items:center;
    gap:12px;
}

/* =========================================
   BADGE + PROFILE
========================================= */
.badge{
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.1);
    padding:6px 12px;
    border-radius:999px;
    color:#fff;
    font-size:11.5px;
    font-weight:700;
    letter-spacing:.5px;
    text-transform:uppercase;
}
.profile-button{
    width:40px;
    height:40px;
    border-radius:50%;
    background:linear-gradient(135deg,#d4af37,#f5d76e);
    color:#111827;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:15px;
    box-shadow:0 4px 15px rgba(212,175,55,.25);
    transition:.25s ease;
}

/* =========================================
   CARDS
========================================= */
.card{
    background:rgba(255,255,255,.95);
    border:1px solid var(--border);
    border-radius:16px;
    padding:20px;
    box-shadow:var(--shadow);
}

/* =========================================
   DASHBOARD
========================================= */
.dashboard-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:1rem;
}
.stat-card .stat{
    font-size:1.85rem;
    font-weight:700;
    color:#c69214;
}
.card h3{
    margin-bottom:0.85rem;
    font-size:1rem;
    font-weight:600;
    color:#1f2937;
}

/* =========================================
   TABLES
========================================= */
.table-wrap{
    overflow-x:auto;
    border-radius:14px;
    border:1px solid var(--border);
}
.data-table{
    width:100%;
    border-collapse:collapse;
    min-width:580px;
}
.data-table thead th{
    background:#f8f9fb;
    color:#6b7280;
    font-size:0.82rem;
    font-weight:600;
    text-transform:uppercase;
    padding:12px 10px;
    border-bottom:1px solid #e5e7eb;
}
.data-table tbody td{
    padding:12px 10px;
    border-bottom:1px solid #f1f1f1;
    color:#374151;
}
.data-table tbody tr:hover{
    background:#fafafa;
}

/* =========================================
   BUTTONS & INPUTS
========================================= */
input,textarea,select{
    width:100%;
    background:#ffffff;
    border:1px solid var(--border);
    border-radius:12px;
    padding:12px 14px;
    font-size:15.5px;
}
input:focus,textarea:focus,select:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 3px rgba(212,175,55,.15);
}
.btn{
    border:none;
    border-radius:12px;
    padding:12px 20px;
    cursor:pointer;
    font-weight:600;
    font-size:15px;
}
.btn-primary{
    background:linear-gradient(135deg,var(--primary),#f5d76e);
    color:#111827;
}
.btn-primary:hover{
    transform:translateY(-1px);
    box-shadow:0 8px 20px rgba(212,175,55,.22);
}
.btn-secondary{
    background:#f4f4f5;
    border:1px solid #e5e7eb;
    color:#111827;
    border-radius:12px;
    padding:11px 18px;
    font-weight:600;
}

/* =========================================
   AFFILIATE NAV
========================================= */
.affiliate-nav-links{
    display:flex;
    gap:12px;
    margin-top:1.25rem;
    flex-wrap:wrap;
}

/* =========================================
   ACTIONS
========================================= */
.actions{
    display:flex;
    align-items:center;
    gap:6px;
    white-space:nowrap;
}
.actions .btn{
    padding:5px 10px;
    height:32px;
    font-size:13px;
    min-width:70px;
}

/* =========================================
   SCROLLBAR
========================================= */
::-webkit-scrollbar{
    width:5px;
}
::-webkit-scrollbar-thumb{
    background:rgba(148,163,184,.45);
    border-radius:10px;
}

/* =========================================
   MODAL SAQUE
========================================= */
.modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.6);
    backdrop-filter:blur(8px);
    display:none;
    justify-content:center;
    align-items:center;
    padding:16px;
    z-index:99999;
}
.modal-overlay.active{
    display:flex;
}
.modal{
    width:100%;
    max-width:500px;
    background:#fff;
    border-radius:18px;
    box-shadow:0 25px 70px rgba(15,23,42,.22);
    overflow:hidden;
}
.modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:18px 22px;
    border-bottom:1px solid var(--border);
}

.modal-header h3{
    margin:0;
    font-size:19px;
    font-weight:700;
}

.modal-close{
    width:36px;
    height:36px;
    border:none;
    background:transparent;
    color:#64748b;
    font-size:28px;
    line-height:1;
    cursor:pointer;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    transition:.2s;
}

.modal-close:hover{
    background:#f1f5f9;
    color:#111827;
}
.modal form{
    padding:22px;
}
.modal .form-group{
    margin-bottom:18px;
}

/* =========================================
   RESPONSIVIDADE (Melhorada)
========================================= */
@media(max-width:992px){
    .sidebar{
        left:-260px;
        top:68px;
        height:calc(100vh - 68px);
        border-radius:0 16px 16px 0;
    }
    .sidebar.active{
        left:0;
    }
    .top-header{
        left:0;
        height:68px;
    }
    .main-content{
        margin-left:0;
        padding:88px 16px 20px;
    }
}

@media(max-width:768px){
    .top-header{
        height:82px;
        padding:10px 16px 10px 68px;
        align-items:flex-start;
    }
    .top-header-left h2{
        font-size:17px;
    }
    .main-content{
        padding:100px 14px 20px;
    }
    .card{
        padding:16px;
    }
    .dashboard-grid{
        grid-template-columns:1fr;
        gap:0.9rem;
    }
    .affiliate-nav-links{
        flex-direction:column;
        gap:10px;
    }
    .affiliate-nav-links .btn{
        width:100%;
    }
}

@media(max-width:480px){
    .main-content{
        padding:92px 12px 16px;
    }
    .card{
        padding:14px;
    }
    .stat-card .stat{
        font-size:1.7rem;
    }
}

@media(max-width:360px){
    .main-content{
        padding:88px 10px 16px;
    }
}
.alert-error{
    display:inline-block;
    width:fit-content;
    max-width:100%;

    padding:12px 16px;
    margin-bottom:20px;

    background:#fff7e6;
    color:#8a6100;

    border:1px solid #f3d37a;
    border-radius:12px;

    font-size:15px;
    font-weight:500;
}
.alert-success{
    display:inline-block;
    width:fit-content;
    max-width:100%;

    padding:12px 16px;
    margin-bottom:20px;

    background:#ecfdf3;
    color:#166534;

    border:1px solid #bbf7d0;
    border-radius:12px;

    font-size:15px;
    font-weight:500;
}