/*
 * Sanchi — Premium Futuristic Dark UI
 * ====================================
 * Professional Forex Trading Platform Design System
 *
 * Design Tokens:
 * - Colors: Deep slate/violet palette with neon accents
 * - Typography: Inter (UI), JetBrains Mono (numbers/data)
 * - Animations: Smooth micro-interactions throughout
 * - Glass: Frosted glassmorphism on cards and panels
 */

/* ============================================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================ */
:root {
    /* Primary Palette */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;

    /* Accent */
    --accent-400: #a78bfa;
    --accent-500: #8b5cf6;
    --accent-600: #7c3aed;

    /* Success / Profit */
    --success-400: #34d399;
    --success-500: #10b981;
    --success-600: #059669;

    /* Danger / Loss */
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    /* Warning */
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;

    /* Neutral (Dark Mode Base) */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1e293b;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(30, 41, 59, 0.5);
    --bg-hover: rgba(99, 102, 241, 0.08);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #a5b4fc;

    --border-color: rgba(148, 163, 184, 0.1);
    --border-active: rgba(99, 102, 241, 0.4);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --shadow-glow-success: 0 0 20px rgba(16, 185, 129, 0.15);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

[x-cloak] { display: none !important; }

a { color: var(--text-accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-400); }

/* ============================================================
   ANIMATED MESH BACKGROUND
   ============================================================ */
.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.mesh-gradient {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    animation: meshFloat 20s ease-in-out infinite;
}

.mesh-1 {
    width: 600px; height: 600px;
    background: var(--primary-500);
    top: -10%; left: -5%;
    animation-delay: 0s;
}

.mesh-2 {
    width: 500px; height: 500px;
    background: var(--accent-500);
    top: 50%; right: -10%;
    animation-delay: -7s;
    animation-duration: 25s;
}

.mesh-3 {
    width: 400px; height: 400px;
    background: var(--success-500);
    bottom: -5%; left: 30%;
    animation-delay: -14s;
    animation-duration: 30s;
}

@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -50px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(10px, 40px) scale(1.05); }
}

/* ============================================================
   APP WRAPPER
   ============================================================ */
.app-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transition: width var(--transition-smooth);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo-mark {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px; height: 36px;
    flex-shrink: 0;
}

.logo-icon svg { width: 100%; height: 100%; }

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-300), var(--accent-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.sidebar-toggle i { width: 18px; height: 18px; }

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
}

.nav-section { margin-bottom: 20px; }

.nav-section-title {
    display: block;
    padding: 4px 12px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 0;
    background: var(--primary-500);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-base);
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--primary-300);
    background: rgba(99, 102, 241, 0.12);
}

.nav-item.active::before { height: 60%; }

.nav-item i { width: 20px; height: 20px; flex-shrink: 0; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { display: block; font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.logout-btn {
    background: none; border: none; color: var(--text-muted);
    padding: 6px; border-radius: var(--radius-sm); cursor: pointer;
    transition: all var(--transition-fast);
}
.logout-btn:hover { color: var(--danger-400); background: rgba(239, 68, 68, 0.1); }
.logout-btn i { width: 18px; height: 18px; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-smooth);
    min-height: 100vh;
}

.main-expanded { margin-left: var(--sidebar-collapsed); }

/* Top Bar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.mobile-menu-btn {
    display: none;
    background: none; border: none; color: var(--text-secondary);
    padding: 8px; cursor: pointer;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.ib-code-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.ib-code-badge i { width: 14px; height: 14px; }
.ib-code-badge strong { color: var(--primary-300); font-family: 'JetBrains Mono', monospace; }

.status-badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-fresh { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.status-active { background: rgba(16, 185, 129, 0.15); color: var(--success-400); }
.status-black_id { background: rgba(239, 68, 68, 0.15); color: var(--danger-400); }

.page-content { padding: 24px; }

/* ============================================================
   ALERT MESSAGES
   ============================================================ */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 0 24px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

.alert i:first-child { width: 18px; height: 18px; flex-shrink: 0; }
.alert span { flex: 1; }
.alert button { background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6; padding: 4px; }
.alert button:hover { opacity: 1; }
.alert button i { width: 16px; height: 16px; }

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--success-400);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger-400);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   GLASS CARD
   ============================================================ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

.glass-card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
}

.glass-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.glass-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--stat-accent, var(--primary-500)), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::after { opacity: 1; }

.stat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.stat-label i { width: 16px; height: 16px; }

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-value.positive { color: var(--success-400); }
.stat-value.negative { color: var(--danger-400); }

.stat-sub {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Colored accent lines */
.stat-card.accent-primary { --stat-accent: var(--primary-500); }
.stat-card.accent-success { --stat-accent: var(--success-500); }
.stat-card.accent-accent { --stat-accent: var(--accent-500); }
.stat-card.accent-warning { --stat-accent: var(--warning-500); }
.stat-card.accent-danger { --stat-accent: var(--danger-500); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn i { width: 16px; height: 16px; }

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after { opacity: 1; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--accent-600));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4); transform: translateY(-1px); }

.btn-success {
    background: linear-gradient(135deg, var(--success-500), #047857);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-500), #b91c1c);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover { border-color: var(--border-active); color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ============================================================
   FORM INPUTS
   ============================================================ */
.form-group { margin-bottom: 16px; }

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

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input.mono {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}

.form-error {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--danger-400);
}

/* ---- Toggle switch -------------------------------------------------------
   For settings that are switches rather than values. The native checkbox is
   kept in the DOM (opacity 0, not display:none) so it stays focusable and
   reachable by keyboard and screen readers — the track and thumb are only
   paint. Its :checked state drives everything below it. */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 6px 0;
}

.toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-track {
    background: rgba(99, 102, 241, 0.35);
    border-color: var(--primary-500);
}

.toggle input:checked + .toggle-track .toggle-thumb {
    left: 22px;
    background: var(--primary-300);
}

.toggle input:focus-visible + .toggle-track {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.toggle-state {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.toggle input:checked ~ .toggle-state {
    color: var(--primary-300);
    font-weight: 600;
}

/* Only one of the two words is ever visible, and which one follows the switch
   itself — so the label cannot disagree with the control it describes. */
.toggle .toggle-on { display: none; }
.toggle .toggle-off { display: inline; }
.toggle input:checked ~ .toggle-state .toggle-on { display: inline; }
.toggle input:checked ~ .toggle-state .toggle-off { display: none; }

/* ============================================================
   TABLE
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover td {
    background: var(--bg-hover);
}

.data-table .mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}

/* ============================================================
   BADGE
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-pending { background: rgba(251, 191, 36, 0.15); color: var(--warning-400); }
.badge-approved { background: rgba(16, 185, 129, 0.15); color: var(--success-400); }
.badge-rejected { background: rgba(239, 68, 68, 0.15); color: var(--danger-400); }
.badge-open { background: rgba(99, 102, 241, 0.15); color: var(--primary-400); }
.badge-closed { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
/* A cancelled trade rendered as an unstyled, colourless pill because this class
   was used in the views and never written. Muted like `closed` -- both are ended
   states -- but with a visible border, since "cancelled" and "closed" mean
   different things to a member looking at their history. */
.badge-cancelled {
    background: rgba(148, 163, 184, 0.10);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.35);
}
/* The escrow states (BUSINESS_RULES §10c). A transfer that expired unaccepted is
   not a rejection and should not read as one. */
.badge-expired { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ============================================================
   ACCOUNT CARDS
   ============================================================ */
.account-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.account-card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

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

.account-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-300);
}

.account-multiplier {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    color: white;
}

.account-balances {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.balance-item {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.balance-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.balance-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    font-weight: 600;
}

.balance-value.real { color: var(--success-400); }
.balance-value.bonus { color: var(--accent-400); }
.balance-value.profit { color: var(--primary-300); }
.balance-value.total { color: var(--text-primary); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 48px; height: 48px;
}

.auth-logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-300), var(--accent-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar[style*="display: flex"],
    .sidebar:not([x-show]) {
        transform: translateX(0);
    }

    .main-content { margin-left: 0; }
    .main-expanded { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
    .auth-card { padding: 28px; }
    .account-balances { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MOBILE — the two things that broke every member screen
   ============================================================

   1. INLINE GRIDS BEAT THE BREAKPOINTS.

   Dozens of blade templates set `style="display:grid;grid-template-columns:1fr 1fr"`
   and similar directly on the element. An inline style outranks any class rule,
   so the breakpoints above were being silently overruled and a two-column form
   stayed two columns at 360px wide — fields squeezed to nothing, labels wrapping
   mid-word.

   The attribute selector is what makes this fixable in one place: it matches on
   the presence of the inline declaration itself, so every current and future
   inline grid collapses on a phone without editing a single template. It is the
   one case where `!important` is not a smell — outranking an inline style is
   precisely the job, and it is scoped to small screens only.

   Grids written as `repeat(auto-fit, minmax(...))` already collapse on their own;
   forcing them to one column here costs nothing, because at this width they had
   reached one column anyway. */
@media (max-width: 640px) {
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* 2. TABLES HAD NOWHERE TO SCROLL.

       Not one table sat in an overflow container, so a wide row simply pushed the
       page sideways and the whole layout scrolled — the reader loses the nav, the
       header, everything, to read one number. `display:block` gives the table its
       own scroll box, which keeps the page still and the table readable. */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* The page itself must never scroll sideways, whatever a child does. */
    body { overflow-x: hidden; }

    /* Long unbroken strings — wallet addresses, transaction hashes — are the
       other thing that widens a phone screen. */
    .mono { word-break: break-all; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.35); }

/* ============================================================
   PULSE ANIMATION (for live indicators)
   ============================================================ */
.pulse-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success-400);
    position: relative;
}
.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--success-400);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0; transform: scale(1.5); }
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(148, 163, 184, 0.08) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   IMAGE UPLOADER
   ============================================================ */
.upload-dropzone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-tertiary);
    overflow: hidden;
}

.upload-dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(139,92,246,0.04));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.05);
}

.upload-dropzone:hover::before,
.upload-dropzone.dragover::before { opacity: 1; }

.upload-dropzone-icon {
    width: 48px; height: 48px;
    margin: 0 auto 12px;
    color: var(--text-muted);
    transition: all var(--transition-base);
}

.upload-dropzone:hover .upload-dropzone-icon {
    color: var(--primary-400);
    transform: translateY(-4px);
}

.upload-dropzone-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-dropzone-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Preview */
.upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    margin-top: 16px;
}

.upload-preview.has-preview { min-height: auto; }

.preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    object-fit: cover;
}

.preview-image.preview-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 3px solid var(--primary-500);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow-glow);
    object-fit: cover;
}

/* File Info */
.upload-status {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}

.file-info-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.file-info-label { color: var(--text-muted); }
.file-info-value { color: var(--text-primary); font-weight: 500; }

.file-info-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    color: var(--primary-300);
    font-size: 0.75rem;
}

/* Compression Stats */
.upload-stats { display: none; margin-top: 10px; }

.compression-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.stat-pill-success { background: rgba(16, 185, 129, 0.1); color: var(--success-400); border-color: rgba(16, 185, 129, 0.25); }

.upload-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger-400);
    font-size: 0.82rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ============================================================
   PROFILE PHOTO CIRCLE
   ============================================================ */
.profile-photo-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.profile-photo-ring {
    position: relative;
    width: 180px; height: 180px;
    border-radius: 50%;
    padding: 4px;
    background: conic-gradient(var(--primary-500), var(--accent-500), var(--success-500), var(--primary-500));
    animation: ringRotate 6s linear infinite;
    cursor: pointer;
}

.profile-photo-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--primary-500), var(--accent-500), var(--success-500), var(--primary-500));
    filter: blur(12px);
    opacity: 0.4;
    animation: ringRotate 6s linear infinite reverse;
}

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.profile-photo-inner {
    position: relative;
    z-index: 1;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--bg-secondary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-photo-inner img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.profile-photo-ring:hover .profile-photo-inner img {
    transform: scale(1.05);
}

.profile-photo-placeholder {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-400), var(--accent-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-photo-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: 2;
    cursor: pointer;
}

.profile-photo-ring:hover .profile-photo-overlay { opacity: 1; }

.profile-photo-overlay i { width: 28px; height: 28px; color: white; }

.profile-photo-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.pagination-wrapper nav { display: flex; gap: 4px; }

.pagination-wrapper a,
.pagination-wrapper span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.pagination-wrapper a:hover {
    color: var(--text-primary);
    border-color: var(--primary-500);
    background: var(--bg-hover);
}

.pagination-wrapper .active span {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
    background: none; border: none; color: var(--text-muted);
    padding: 6px; border-radius: var(--radius-sm); cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ============================================================
   ADMIN LAYOUT — GUEST (AUTH PAGES)
   ============================================================ */
.guest-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}
