:root {
    --bg: #0b0e14;
    --bg-alt: #10131c;
    --surface: #151925;
    --surface-2: #1b2030;
    --border: #262c3d;
    --text: #eef0f6;
    --muted: #8b93a7;
    --accent: #6d8dff;
    --accent-2: #9b6dff;
    --success: #34d399;
    --pending: #fbbf24;
    --failed: #f87171;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 10% -10%, #1a2038 0%, transparent 60%),
                radial-gradient(1000px 500px at 100% 0%, #241a38 0%, transparent 55%),
                var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
}

a { color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 4px 16px rgba(109,141,255,0.35);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { background: #232939; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn-approve { background: rgba(52,211,153,0.15); color: var(--success); border-color: rgba(52,211,153,0.3); }
.btn-reject { background: rgba(248,113,113,0.15); color: var(--failed); border-color: rgba(248,113,113,0.3); }
.btn-edit { background: rgba(109,141,255,0.15); color: var(--accent); border-color: rgba(109,141,255,0.3); }

/* ---------- Auth pages ---------- */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { margin: 12px 0 4px; font-size: 1.5rem; }
.auth-logo p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-size: 1.5rem;
    margin: 0 auto;
}
.auth-form label { display: block; margin: 14px 0 6px; font-size: 0.85rem; color: var(--muted); }
.auth-form input, .form input, .form select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
}
.auth-form input:focus, .form input:focus, .form select:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-form button { margin-top: 22px; }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.alert-error { background: rgba(248,113,113,0.12); color: var(--failed); border: 1px solid rgba(248,113,113,0.3); }
.alert-success { background: rgba(52,211,153,0.12); color: var(--success); border: 1px solid rgba(52,211,153,0.3); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    margin-bottom: 36px;
    padding: 0 6px;
}
.brand .logo-badge { width: 36px; height: 36px; font-size: 1.1rem; border-radius: 10px; }

.nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.92rem;
}
.nav-item.active, .nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
}
.nav-ico { font-size: 1rem; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.main { flex: 1; padding: 32px 40px; max-width: 100%; overflow-x: hidden; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.topbar h2 { margin: 0 0 4px; font-size: 1.4rem; }
.topbar p { margin: 0; }
.avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.admin-avatar { background: linear-gradient(135deg, #ff9d6d, #ff6d9d); }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stat-card.accent { border-color: rgba(109,141,255,0.4); background: linear-gradient(160deg, rgba(109,141,255,0.08), var(--surface)); }
.stat-label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.stat-value { font-size: 1.7rem; font-weight: 800; }

/* ---------- Panels ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 24px;
}
.panel h3 { margin: 0 0 6px; font-size: 1.05rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }

.form { margin-top: 14px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }

.empty-state { text-align: center; color: var(--muted); padding: 24px !important; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.badge-pending { background: rgba(251,191,36,0.14); color: var(--pending); }
.badge-success { background: rgba(52,211,153,0.14); color: var(--success); }
.badge-failed { background: rgba(248,113,113,0.14); color: var(--failed); }
.badge-unknown { background: var(--surface-2); color: var(--muted); }

/* ---------- Log list ---------- */
.log-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 260px; overflow-y: auto; }
.log-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.log-amount { color: var(--success); font-weight: 700; }
.log-time { color: var(--muted); }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,7,12,0.6);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.modal-close {
    background: none; border: none; color: var(--muted);
    font-size: 1.4rem; cursor: pointer; line-height: 1;
}

/* ---------- Toast ---------- */
.toast {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 14px;
}
.toast-success { background: rgba(52,211,153,0.12); color: var(--success); border: 1px solid rgba(52,211,153,0.3); }
.toast-error { background: rgba(248,113,113,0.12); color: var(--failed); border: 1px solid rgba(248,113,113,0.3); }
