:root {
    --primary: #4417f7;
    --primary-dark: #3210c8;
    --sidebar: #111827;
    --sidebar-soft: #1f2937;
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --border: #e6e9f0;
    --success: #129447;
    --warning: #c98300;
    --danger: #d83a4b;
    --info: #1677d2;
    --radius: 15px;
    --shadow: 0 8px 30px rgba(23, 32, 51, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

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

.sidebar {
    width: 272px;
    background: linear-gradient(180deg, #101827 0%, #111827 70%, #0b1220 100%);
    color: #d9e0ec;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,.05);
}

.brand {
    height: 78px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6c4cff, var(--primary));
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #fff;
    letter-spacing: -.5px;
    box-shadow: 0 8px 20px rgba(68,23,247,.35);
}
.brand strong { display:block; color:#fff; font-size:15px; }
.brand span { display:block; font-size:12px; color:#98a4b7; margin-top:2px; }

.nav { padding: 14px 10px 24px; overflow-y: auto; }
.nav > a, .nav-group-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #cbd3df;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 10px;
    cursor: pointer;
    margin: 2px 0;
    text-align: left;
}
.nav > a { justify-content: flex-start; }
.nav > a:hover, .nav-group-btn:hover, .nav > a.active {
    background: rgba(108,76,255,.13);
    color: #fff;
}
.nav > a.active { box-shadow: inset 3px 0 0 var(--primary); }
.nav-ico {
    width: 23px;
    display: inline-grid;
    place-items: center;
    color: #9fa9bb;
    margin-right: 5px;
}
.nav-group-btn > span:first-child { display:flex; align-items:center; }
.nav-sub {
    display: none;
    padding: 2px 0 6px 41px;
}
.nav-group.expanded .nav-sub { display: block; }
.nav-sub a {
    display: block;
    color: #9fa9bb;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}
.nav-sub a:hover { color:#fff; background:rgba(255,255,255,.04); }

.sidebar-footer {
    margin-top: auto;
    padding: 15px 20px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer strong, .sidebar-footer span { display:block; }
.sidebar-footer strong { color:#fff; font-size:12px; }
.sidebar-footer span { color:#7f8a9d; font-size:11px; margin-top:3px; }

.main-shell { margin-left:272px; min-width:0; width:calc(100% - 272px); }
.topbar {
    min-height:78px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding: 12px 26px;
    background:#fff;
    border-bottom:1px solid var(--border);
    position:sticky;
    top:0;
    z-index:30;
}
.topbar-left { display:flex; align-items:center; gap:12px; }
.topbar h1 { margin:0; font-size:21px; letter-spacing:-.3px; }
.eyebrow { font-size:11px; text-transform:uppercase; letter-spacing:.11em; color:var(--primary); font-weight:800; margin-bottom:2px; }
.topbar-actions { display:flex; align-items:center; gap:12px; }
.wallet-pill {
    background:#f5f2ff;
    border:1px solid #e6ddff;
    color:var(--primary-dark);
    border-radius:12px;
    padding:8px 12px;
    min-width:155px;
}
.wallet-label { display:block; font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:#7b6bb5; }
.wallet-pill strong { font-size:14px; }
.icon-btn {
    width:42px; height:42px; border:1px solid var(--border); border-radius:12px;
    display:grid; place-items:center; background:#fff; position:relative;
}
.icon-btn b {
    position:absolute; right:-5px; top:-5px; min-width:18px; height:18px; border-radius:9px;
    padding:0 5px; background:var(--danger); color:#fff; font-size:10px; display:grid; place-items:center;
}
.profile-menu { display:flex; align-items:center; gap:9px; padding-left:5px; }
.profile-avatar {
    width:40px; height:40px; border-radius:12px; background:var(--primary); color:#fff;
    display:grid; place-items:center; font-weight:900;
}
.profile-copy strong, .profile-copy small { display:block; }
.profile-copy strong { font-size:13px; }
.profile-copy small { font-size:11px; color:var(--muted); margin-top:1px; }
.logout-link { font-size:12px; color:var(--danger); font-weight:700; margin-left:6px; }

.content { padding:26px; min-height:calc(100vh - 130px); }
.page-intro { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:20px; }
.page-intro h2 { margin:0 0 4px; font-size:22px; }
.page-intro p { margin:0; color:var(--muted); font-size:13px; }

.grid-stats {
    display:grid;
    grid-template-columns:repeat(4, minmax(0,1fr));
    gap:16px;
    margin-bottom:20px;
}
.stat-card, .panel {
    background:var(--card);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
}
.stat-card { padding:18px; }
.stat-card .label { color:var(--muted); font-size:12px; font-weight:700; }
.stat-card .value { display:block; margin-top:8px; font-size:24px; font-weight:850; letter-spacing:-.6px; }
.stat-card .meta { margin-top:7px; color:var(--muted); font-size:11px; }
.stat-card.primary { border-top:3px solid var(--primary); }
.stat-card.success { border-top:3px solid var(--success); }
.stat-card.warning { border-top:3px solid var(--warning); }
.stat-card.danger { border-top:3px solid var(--danger); }

.dashboard-grid {
    display:grid;
    grid-template-columns:minmax(0, 1.6fr) minmax(300px, .8fr);
    gap:18px;
}
.panel { overflow:hidden; }
.panel-head {
    padding:16px 18px;
    border-bottom:1px solid var(--border);
    display:flex;
    justify-content:space-between;
    align-items:center;
}
.panel-head h3 { margin:0; font-size:15px; }
.panel-head span { font-size:11px; color:var(--muted); }
.panel-body { padding:18px; }

.quick-actions {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:12px;
}
.quick-action {
    border:1px solid var(--border);
    border-radius:12px;
    padding:15px;
    background:#fff;
}
.quick-action strong { display:block; font-size:13px; }
.quick-action span { display:block; color:var(--muted); font-size:11px; margin-top:4px; }
.quick-action:hover { border-color:#cfc3ff; box-shadow:0 6px 18px rgba(68,23,247,.08); }

.status-list { display:grid; gap:10px; }
.status-row {
    display:flex; align-items:center; justify-content:space-between;
    padding:11px 12px; border:1px solid var(--border); border-radius:11px;
}
.status-left { display:flex; align-items:center; gap:9px; }
.dot { width:9px; height:9px; border-radius:50%; background:#bbb; }
.dot.success { background:var(--success); }
.dot.warning { background:var(--warning); }
.dot.danger { background:var(--danger); }
.dot.primary { background:var(--primary); }

.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th, td { padding:12px 14px; border-bottom:1px solid var(--border); text-align:left; font-size:12px; white-space:nowrap; }
th { color:var(--muted); background:#fafbfe; text-transform:uppercase; letter-spacing:.04em; font-size:10px; }
tbody tr:hover { background:#fbfbff; }

.badge {
    display:inline-flex; align-items:center; min-height:24px; padding:4px 8px; border-radius:999px;
    font-size:10px; font-weight:800;
}
.badge-success { color:#087336; background:#e9f8ef; }
.badge-warning { color:#946000; background:#fff5d9; }
.badge-danger { color:#a7192b; background:#ffe8eb; }
.badge-muted { color:#566074; background:#eef1f6; }

.alert { padding:12px 14px; border-radius:10px; margin-bottom:16px; font-size:13px; border:1px solid transparent; }
.alert-success { background:#eaf8ef; color:#0b6932; border-color:#c9eed8; }
.alert-warning { background:#fff7df; color:#815400; border-color:#f4e1a5; }
.alert-danger { background:#ffecef; color:#9c2030; border-color:#f2c4cb; }

.btn {
    display:inline-flex; align-items:center; justify-content:center; border:0; border-radius:10px;
    padding:10px 14px; font-weight:800; cursor:pointer; font-size:12px;
}
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-light { background:#fff; color:var(--text); border:1px solid var(--border); }

.footer {
    display:flex; justify-content:space-between; color:var(--muted); font-size:11px;
    padding:14px 26px 20px;
}
.mobile-menu-btn { display:none; border:0; background:#f3f4f8; border-radius:10px; width:40px; height:40px; }
.sidebar-overlay { display:none; }

.login-page {
    min-height:100vh;
    display:grid;
    grid-template-columns:minmax(400px, .85fr) minmax(480px, 1.15fr);
    background:#fff;
}
.login-panel { padding:48px; display:flex; flex-direction:column; justify-content:center; max-width:560px; width:100%; margin:auto; }
.login-brand { display:flex; align-items:center; gap:12px; margin-bottom:42px; }
.login-brand .brand-mark { flex:none; }
.login-brand strong { display:block; font-size:16px; }
.login-brand span { display:block; font-size:12px; color:var(--muted); margin-top:2px; }
.login-panel h1 { margin:0; font-size:30px; letter-spacing:-.7px; }
.login-panel .lead { color:var(--muted); margin:8px 0 24px; line-height:1.6; font-size:13px; }

.form-group { margin-bottom:15px; }
.form-group label { display:block; margin-bottom:7px; font-size:12px; font-weight:800; }
.form-control {
    width:100%; height:46px; border:1px solid var(--border); border-radius:10px; padding:0 13px;
    outline:none; color:var(--text); background:#fff;
}
.form-control:focus { border-color:#a996ff; box-shadow:0 0 0 3px rgba(68,23,247,.08); }
.login-btn { width:100%; height:46px; margin-top:5px; }
.login-help { margin-top:18px; text-align:center; color:var(--muted); font-size:11px; }

.login-visual {
    margin:18px;
    border-radius:24px;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,.17), transparent 28%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,.12), transparent 30%),
        linear-gradient(145deg, #2e0bb7, #4417f7 55%, #7354ff);
    color:#fff;
    padding:70px;
    display:flex;
    flex-direction:column;
    justify-content:flex-end;
    overflow:hidden;
    position:relative;
}
.login-visual::before, .login-visual::after {
    content:""; position:absolute; border:1px solid rgba(255,255,255,.15); border-radius:26px; transform:rotate(-8deg);
}
.login-visual::before { width:330px; height:220px; right:-50px; top:60px; }
.login-visual::after { width:260px; height:170px; right:90px; top:170px; }
.login-visual h2 { font-size:34px; max-width:600px; margin:0; line-height:1.15; letter-spacing:-.8px; }
.login-visual p { max-width:560px; line-height:1.65; opacity:.82; font-size:13px; margin:16px 0 0; }

.setup-card { max-width:720px; margin:40px auto; background:#fff; border:1px solid var(--border); border-radius:18px; box-shadow:var(--shadow); padding:24px; }

@media (max-width: 1100px) {
    .grid-stats { grid-template-columns:repeat(2,1fr); }
    .dashboard-grid { grid-template-columns:1fr; }
    .login-visual { padding:45px; }
}
@media (max-width: 820px) {
    .sidebar { transform:translateX(-100%); transition:.2s ease; }
    .sidebar.open { transform:translateX(0); }
    .sidebar-overlay.show { display:block; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:40; }
    .main-shell { margin-left:0; width:100%; }
    .mobile-menu-btn { display:block; }
    .profile-copy, .logout-link { display:none; }
    .wallet-pill { min-width:auto; }
    .content { padding:18px; }
    .login-page { grid-template-columns:1fr; }
    .login-visual { display:none; }
}
@media (max-width: 560px) {
    .grid-stats { grid-template-columns:1fr; }
    .quick-actions { grid-template-columns:1fr; }
    .wallet-pill { display:none; }
    .topbar { padding:11px 14px; }
    .topbar h1 { font-size:17px; }
    .login-panel { padding:28px 22px; }
    .footer { padding-left:18px; padding-right:18px; }
}
