:root {
    --primary: #6C3CE1;
    --primary-dark: #5428c5;
    --secondary: #FF6B35;
    --success: #28a745;
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #2d2d2d;
    --muted: #6c757d;
    --border: #e0e0e0;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ── AUTH ── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.auth-card {
    background: var(--card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .coin { font-size: 48px; }

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 8px;
}

.auth-logo p {
    color: var(--muted);
    font-size: 14px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: border .2s;
    background: #fafafa;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .2s, transform .1s;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.97); }
.btn:hover  { opacity: .9; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-danger    { background: #dc3545; color: #fff; }
.btn-sm        { padding: 8px 14px; font-size: 12px; }
.btn-block     { width: 100%; text-align: center; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 900;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 68px;
}

.sidebar-logo span { font-size: 14px; font-weight: 700; }
.sidebar-logo small { display: block; font-size: 11px; opacity: .7; }

.sidebar nav { flex: 1; padding: 12px 0; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .18s, color .18s;
    -webkit-tap-highlight-color: transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.sidebar nav a .icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: 13px;
}

.sidebar-footer a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
}

/* ── OVERLAY ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 850;
}

.sidebar-overlay.active { display: block; }

/* ── HAMBURGER ── */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    line-height: 1;
    margin-right: 10px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ── MAIN CONTENT ── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--card);
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h2 {
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .user-info {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    margin-left: 12px;
}

.topbar .user-info strong { color: var(--text); }

.content { padding: 24px; }

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple { background: #ede9fc; }
.stat-icon.orange { background: #fff0ea; }
.stat-icon.green  { background: #e6f9ee; }
.stat-icon.blue   { background: #e8f2ff; }

.stat-info p  { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-info h3 { font-size: 20px; font-weight: 700; }

/* ── CARD / TABLE ── */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 20px;
}

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

.card-header h3 { font-size: 15px; font-weight: 700; }

/* Tabelas com scroll horizontal em mobile */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 480px;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    border-bottom: 1.5px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #e6f9ee; color: #1a7a3c; }
.badge-warning { background: #fff8e1; color: #b07b00; }
.badge-danger  { background: #fde8e8; color: #c0392b; }
.badge-info    { background: #e8f2ff; color: #1565c0; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 18px;
    line-height: 1.5;
}

.alert-success { background: #e6f9ee; color: #1a7a3c; border-left: 4px solid #28a745; }
.alert-danger  { background: #fde8e8; color: #c0392b; border-left: 4px solid #dc3545; }
.alert-info    { background: #e8f2ff; color: #1565c0; border-left: 4px solid #1976d2; }

/* ── CASHBACK HIGHLIGHT ── */
.cashback-valor {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.cashback-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ─────────────────────────────────────────────
   RESPONSIVE — Tablet  (≤ 900px)
───────────────────────────────────────────── */
@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — Mobile  (≤ 768px)
───────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Sidebar vira drawer */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w);
        box-shadow: 4px 0 20px rgba(0,0,0,.18);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Conteúdo ocupa tela toda */
    .main {
        margin-left: 0;
    }

    /* Topbar */
    .topbar {
        padding: 12px 16px;
    }

    .topbar h2 {
        font-size: 15px;
    }

    /* Hamburger visível */
    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Content */
    .content {
        padding: 16px;
    }

    /* Stats: 2 colunas no mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 14px 12px;
        gap: 10px;
    }

    .stat-icon {
        width: 42px; height: 42px;
        font-size: 18px;
        border-radius: 10px;
    }

    .stat-info h3 { font-size: 17px; }
    .stat-info p  { font-size: 11px; }

    /* Cards */
    .card {
        padding: 14px;
        border-radius: 10px;
        margin-bottom: 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Auth */
    .auth-card {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .auth-logo h1 { font-size: 20px; }
    .cashback-valor { font-size: 28px; }

    /* Botões full-width em formulários mobile */
    .btn-block-mobile {
        width: 100%;
        text-align: center;
    }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — Phones  (≤ 480px)
───────────────────────────────────────────── */
@media (max-width: 480px) {

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px;
    }

    .topbar .user-info {
        display: none; /* esconde "Olá, Nome" em telas muito pequenas */
    }

    .auth-wrap { padding: 12px; }

    .auth-card { padding: 24px 16px; }
}
