:root {
    --primary: #1e3a5f;
    --primary-light: #2c5282;
    --primary-dark: #142a45;
    --accent: #2f80ed;
    --success: #1a9f5c;
    --danger: #d64545;
    --warning: #d99a1b;
    --gray-50: #f7f9fc;
    --gray-100: #eef1f6;
    --gray-200: #dde3ec;
    --gray-400: #9aa6b8;
    --gray-500: #6b7688;
    --gray-700: #3a4459;
    --white: #ffffff;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(30, 58, 95, 0.08);
    --shadow-lg: 0 8px 30px rgba(30, 58, 95, 0.14);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --primary: #2c5282;
    --gray-50: #10151f;
    --gray-100: #171e2b;
    --gray-200: #232c3d;
    --gray-400: #5b6a85;
    --gray-500: #8794ac;
    --gray-700: #d4dbe8;
    --white: #1a2233;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--white); color: var(--primary); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 0.4rem; color: var(--gray-700); }
.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.95rem;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.15); }
.form-control.is-invalid { border-color: var(--danger); }
select.form-control { appearance: auto; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.card-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 1rem; color: var(--primary); }

/* Alerts */
.alert { position: relative; padding: 0.9rem 2.5rem 0.9rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.92rem; }
.alert-success { background: #e6f7ee; color: var(--success); border: 1px solid #b7e8cd; }
.alert-error { background: #fbe9e9; color: var(--danger); border: 1px solid #f3c2c2; }
.alert-info { background: #e8f1fd; color: var(--accent); border: 1px solid #bcd8fb; }
.alert-close { position: absolute; right: 0.75rem; top: 0.6rem; background: none; border: none; cursor: pointer; font-size: 1rem; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 2rem 1rem; }
.auth-card { background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2.5rem; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; font-weight: 800; font-size: 1.4rem; color: var(--primary); }
.auth-logo i { color: var(--accent); margin-right: 0.4rem; }
.auth-footer { text-align: center; margin-top: 1.2rem; font-size: 0.9rem; color: var(--gray-500); }

/* Dashboard shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: var(--primary-dark);
    color: var(--white);
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    transition: transform 0.2s ease;
    z-index: 100;
}
.sidebar-brand { padding: 1.4rem 1.25rem; font-weight: 800; font-size: 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand i { color: var(--accent); margin-right: 0.5rem; }
.sidebar-nav { list-style: none; margin: 0; padding: 0.75rem 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.25rem; color: rgba(255,255,255,0.75); font-size: 0.92rem; font-weight: 500;
}
.sidebar-nav a i { width: 18px; text-align: center; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.08); color: var(--white); }
.sidebar-section { padding: 1rem 1.25rem 0.4rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255,255,255,0.4); }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 90; }
.sidebar-overlay.show { display: block; }

.main-content { flex: 1; margin-left: 250px; min-width: 0; }
.topbar {
    background: var(--white); box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.5rem; position: sticky; top: 0; z-index: 50;
}
.topbar-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--gray-700); }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.wallet-pill { background: var(--gray-100); border-radius: 999px; padding: 0.45rem 1rem; font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.icon-btn { background: none; border: none; font-size: 1.1rem; color: var(--gray-500); cursor: pointer; position: relative; }
.badge-dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }

.page-body { padding: 1.5rem; max-width: 1100px; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 8px);
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 220px; padding: 0.5rem; z-index: 60;
}
.dropdown-menu.show { display: block; }
.dropdown-item { display: block; padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.9rem; color: var(--gray-700); }
.dropdown-item:hover { background: var(--gray-100); }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.stat-card .label { font-size: 0.82rem; color: var(--gray-500); font-weight: 600; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-top: 0.3rem; }

/* Quick services */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.9rem; }
.service-tile { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 0.8rem; text-align: center; color: var(--gray-700); }
.service-tile i { font-size: 1.5rem; color: var(--accent); margin-bottom: 0.5rem; display: block; }
.service-tile:hover { box-shadow: var(--shadow-lg); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th { text-align: left; padding: 0.7rem 0.9rem; background: var(--gray-100); color: var(--gray-500); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; }
table.data-table td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--gray-100); }

.badge { display: inline-block; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge-pending { background: #fdf3d9; color: var(--warning); }
.badge-success, .badge-completed, .badge-approved { background: #e6f7ee; color: var(--success); }
.badge-failed, .badge-rejected { background: #fbe9e9; color: var(--danger); }
.badge-in_progress, .badge-processing { background: #e8f1fd; color: var(--accent); }

/* Fund Wallet — virtual account card */
.fund-wallet-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; align-items: start; }
.va-card { background: linear-gradient(160deg, var(--white) 0%, var(--gray-50) 100%); border: 1px solid var(--gray-100); }
.va-card-header { display: flex; align-items: flex-start; gap: 0.9rem; margin-bottom: 1.25rem; }
.va-card-icon {
    width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px;
    background: var(--primary); color: var(--white);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.va-detail-list { display: flex; flex-direction: column; gap: 0.9rem; }
.va-detail-row {
    display: flex; flex-direction: column; gap: 0.25rem;
    padding: 0.85rem 1rem; background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: var(--radius);
}
.va-detail-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.va-detail-value { font-size: 1rem; font-weight: 700; color: var(--primary); word-break: break-word; }
.va-account-digits { font-size: 1.3rem; letter-spacing: 0.03em; }
.va-account-number { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.va-copy-btn { flex-shrink: 0; }
.va-copy-btn.copied { background: var(--success); color: var(--white); border-color: var(--success); }

/* Quick amounts */
.quick-amounts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.quick-amount-btn { padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid var(--gray-200); background: var(--white); cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--gray-700); }
.quick-amount-btn.active, .quick-amount-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Loader */
.page-loader { position: fixed; inset: 0; background: rgba(255,255,255,0.85); display: none; align-items: center; justify-content: center; z-index: 999; }
.page-loader.show { display: flex; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--gray-200); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-card { border: 1px dashed var(--gray-200); border-radius: var(--radius); padding: 1.25rem; margin-top: 1rem; background: var(--gray-50); }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar-toggle { display: inline-block; }
    .fund-wallet-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .va-account-number { flex-direction: column; align-items: stretch; }
    .va-copy-btn { width: 100%; justify-content: center; }
    .va-account-digits { font-size: 1.1rem; }
}
