:root {
    --bg: #0b0b11;
    --surface: #12121a;
    --surface-hover: #1a1a26;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #e4e4e7;
    --text-muted: #71717a;
    --text-dim: #52525b;
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.15);
    --green: #22c55e;
    --red: #ef4444;
    --purple: #8b5cf6;
    --blue: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────── */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: rgba(11, 11, 17, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--accent);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.navbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.network-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9999px;
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.network-badge select {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.8125rem;
    cursor: pointer;
    outline: none;
}

.network-badge select option {
    background: var(--surface);
    color: var(--text);
}

/* ── Buttons ────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-connected {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-connected:hover {
    border-color: var(--border-hover);
}

/* ── Demo Banner ────────────────────────────────────── */

.demo-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.625rem 2rem;
    background: var(--accent-glow);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.demo-banner a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.demo-banner a:hover {
    text-decoration: underline;
}

.demo-dismiss {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

/* ── Layout ─────────────────────────────────────────── */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

/* ── Stats Grid ─────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--border-hover);
}

.stat-card--highlight {
    border-color: rgba(139, 92, 246, 0.2);
    background: linear-gradient(135deg, var(--surface), rgba(139, 92, 246, 0.05));
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-change {
    font-size: 0.8125rem;
    font-weight: 500;
}

.stat-change.positive { color: var(--green); }
.stat-change.negative { color: var(--red); }

.stat-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ── Dashboard Grid ─────────────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
}

.chart-card  { grid-column: 1 / -1; }
.tokens-card { grid-column: 1; grid-row: 2 / 4; }
.tx-card     { grid-column: 2; grid-row: 2; }
.alloc-card  { grid-column: 2; grid-row: 3; }

/* ── Cards ──────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.125rem;
    display: block;
}

/* ── Time Filters ───────────────────────────────────── */

.time-filters {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.time-btn {
    padding: 0.375rem 0.75rem;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.time-btn:hover { color: var(--text); }

.time-btn.active {
    background: var(--accent);
    color: #fff;
}

/* ── Chart ──────────────────────────────────────────── */

.chart-wrap {
    padding: 1rem 1.25rem;
    height: 300px;
}

/* ── Search Input ───────────────────────────────────── */

.search-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.75rem;
    font-family: var(--font);
    font-size: 0.8125rem;
    color: var(--text);
    outline: none;
    width: 160px;
    transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--accent); }

/* ── Token List ─────────────────────────────────────── */

.tokens-head {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 0.75fr;
    padding: 0.5rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.token-list {
    max-height: 420px;
    overflow-y: auto;
}

.token-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 0.75fr;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.token-row:last-child { border-bottom: none; }
.token-row:hover { background: var(--surface-hover); }

.token-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.token-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.token-symbol {
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
}

.token-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

/* ── Transactions ───────────────────────────────────── */

.tx-list {
    padding: 0.25rem 0;
}

.tx-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    transition: background 0.15s;
}

.tx-row:hover { background: var(--surface-hover); }

.tx-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.tx-details {
    flex: 1;
    min-width: 0;
}

.tx-desc {
    font-size: 0.8125rem;
    font-weight: 500;
    display: block;
}

.tx-time {
    font-size: 0.6875rem;
    color: var(--text-dim);
}

.tx-amount {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Allocation ─────────────────────────────────────── */

.alloc-chart-wrap {
    padding: 1.25rem;
    height: 180px;
}

.alloc-legend {
    padding: 0 1.25rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-pct {
    color: var(--text-dim);
}

/* ── Links ──────────────────────────────────────────── */

.link-muted {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s;
}

.link-muted:hover { color: var(--accent); }

/* ── Utilities ──────────────────────────────────────── */

.text-right  { text-align: right; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-purple { color: var(--purple); }
.text-blue   { color: var(--blue); }

.empty-state {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem;
    font-size: 0.8125rem;
}

/* ── Toast Notifications ────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast-visible { transform: translateX(0); }
.toast-success { border-color: rgba(34, 197, 94, 0.3); }
.toast-error   { border-color: rgba(239, 68, 68, 0.3); }
.toast-info    { border-color: rgba(139, 92, 246, 0.3); }

/* ── Scrollbar ──────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    .tokens-card {
        grid-column: 1 / -1;
        grid-row: auto;
    }
    .tx-card,
    .alloc-card {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .container { padding: 1rem; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chart-card,
    .tokens-card,
    .tx-card,
    .alloc-card {
        grid-column: 1;
        grid-row: auto;
    }

    .chart-wrap { height: 220px; }
    .search-input { width: 120px; }
}

@media (max-width: 480px) {
    .navbar-center { display: none; }
    .stat-value { font-size: 1.25rem; }

    .tokens-head,
    .token-row {
        grid-template-columns: 2fr 1fr 1fr;
    }

    .tokens-head span:last-child,
    .token-row > span:last-child {
        display: none;
    }
}
