        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Fira+Code:wght@400;500&display=swap');

        :root {
            --bg-base: #050505;
            --bg-surface: #0a0a0c;
            --panel: rgba(255, 255, 255, 0.03);
            --panel-hover: rgba(255, 255, 255, 0.06);
            --border: rgba(255, 255, 255, 0.08);
            --border-light: rgba(255, 255, 255, 0.15);
            --accent: #2563eb;
            --accent-hover: #3b82f6;
            --discord: #5865F2;
            --danger: #ef4444;
            --success: #10b981;
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-base);
            background-image: radial-gradient(circle at 50% 0%, #172033 0%, transparent 40%);
            color: var(--text-main);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            line-height: 1.6;
        }

        ::-webkit-scrollbar { width: 8px; height: 8px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }

        /* =========================================
           LAYOUT & CONTAINERS
        ========================================= */
        .container {
            width: 95%; max-width: 1200px;
            margin: clamp(20px, 4vw, 40px) auto;
            padding: clamp(20px, 4vw, 40px);
        }

        .login-container { 
            width: 100%; 
            max-width: 1100px; 
            margin: auto; 
            padding: clamp(20px, 5vw, 40px);
            display: flex; 
            flex-direction: column; 
            justify-content: center; 
            flex: 1; 
        }

        .container, .login-card, .login-instructions, .card, .setup-panel {
            background: var(--bg-surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: var(--shadow-lg);
        }

        /* =========================================
           LOGIN LAYOUT
        ========================================= */
        .login-header-wrapper { text-align: center; margin-bottom: 30px; } /* Reduced gap under main title */
        .main-title { font-size: clamp(36px, 6vw, 52px); font-weight: 900; letter-spacing: -0.04em; margin-bottom: 8px; }
        .sub-title { color: var(--accent-hover); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 4px; }

        .login-wrapper { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 450px), 1fr)); gap: 30px; align-items: stretch; }
        
        .login-card { padding: clamp(30px, 5vw, 50px); display: flex; flex-direction: column; justify-content: center; }
        
        /* Changed justify-content to flex-start to pin the text to the top edge */
        .login-instructions { 
            padding: clamp(30px, 5vw, 50px); 
            display: flex; 
            flex-direction: column; 
            justify-content: flex-start; 
            background: linear-gradient(180deg, var(--panel) 0%, transparent 100%); 
        }

        .instruction-title { font-size: clamp(20px, 3vw, 24px); font-weight: 800; margin-bottom: 16px; color: #fff; display: block; }
        .instruction-step { color: var(--text-muted); margin-bottom: 12px; font-size: clamp(14px, 2vw, 16px); line-height: 1.7; }
        
        .global-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
            margin-top: 35px;
            padding-top: 30px;
            border-top: 1px dashed var(--border-light);
        }
        .g-stat-card { background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; padding: 16px 10px; text-align: center; }
        .g-stat-card h4 { margin: 0 0 6px 0; font-size: clamp(20px, 2.5vw, 28px); font-weight: 900; color: var(--accent-hover); }
        .g-stat-card p { margin: 0; font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 1px; }

        .login-title-small { font-size: 24px; font-weight: 800; margin-bottom: 30px; letter-spacing: -0.5px; text-align: center; }

        /* =========================================
           INPUTS & BUTTONS
        ========================================= */
        form { display: flex; flex-direction: column; width: 100%; margin: 0; }

        input[type="text"], input[type="password"] { 
            width: 100%; padding: 16px 20px; margin-bottom: 16px; 
            background: rgba(0,0,0,0.4); border: 1px solid var(--border); 
            border-radius: 12px; color: #fff; font-size: 15px; outline: none; transition: 0.2s;
        }
        input:focus { border-color: var(--accent); background: rgba(0,0,0,0.6); }

        .btn-login, .btn-download, .btn-discord, .btn-delete, .btn-save, .btn-purge {
            display: inline-flex; align-items: center; justify-content: center;
            border-radius: 12px; font-weight: 600; font-size: 15px;
            cursor: pointer; transition: 0.2s; border: none; text-decoration: none;
        }

        .btn-login { width: 100%; padding: 16px; background: var(--text-main); color: var(--bg-base); margin-top: 8px; }
        .btn-login:hover { background: #fff; transform: translateY(-2px); }

        .btn-discord { width: 100%; padding: 16px; background: var(--discord); color: #fff; gap: 10px; margin-bottom: 20px; }
        .btn-discord:hover { background: #4752C4; transform: translateY(-2px); }

        .inline-group { display: flex; gap: 12px; width: 100%; margin-top: 8px; }
        .inline-group input { margin-bottom: 0; flex: 1; font-family: 'Fira Code', monospace; }
        .inline-btn { display: flex; align-items: center; justify-content: center; width: 56px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; color: var(--text-main); flex-shrink: 0; cursor: pointer; transition: 0.2s; }
        .inline-btn:hover { background: var(--border-light); color: #fff; }

        .divider-text { display: flex; align-items: center; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 1px; margin: 24px 0; }
        .divider-text::before, .divider-text::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
        .divider-text:not(:empty)::before { margin-right: 15px; }
        .divider-text:not(:empty)::after { margin-left: 15px; }
        
        .switch-auth { margin-top: 30px; font-size: 14px; text-align: center; color: var(--text-muted); }
        .switch-auth a { color: var(--text-main); text-decoration: none; font-weight: 600; transition: 0.2s; }
        .switch-auth a:hover { color: var(--accent-hover); }

        .alert { padding: 14px 16px; border-radius: 12px; margin-bottom: 24px; font-size: 14px; font-weight: 500; border: 1px solid; }
        .alert-error { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); color: #f87171; }
        .alert-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); color: #34d399; }

        /* =========================================
           DASHBOARD TOP NAV
        ========================================= */
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: clamp(24px, 4vw, 40px); flex-wrap: wrap; gap: 16px; }
        .header-title { font-weight: 800; font-size: clamp(24px, 4vw, 32px); letter-spacing: -1px; display: flex; align-items: center; gap: 12px; margin: 0; }

        .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
        .nav-links a { text-decoration: none; color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 10px 16px; border-radius: 8px; transition: 0.2s; }
        .nav-links a:hover { color: var(--text-main); background: var(--panel); }
        .nav-links a.active { background: var(--text-main); color: var(--bg-base); }
        .nav-links a.logout { color: var(--danger); }
        .nav-links a.logout:hover { background: rgba(239, 68, 68, 0.1); }

        .badge-admin { background: rgba(239, 68, 68, 0.15); color: #fca5a5; padding: 4px 8px; border-radius: 6px; font-size: 11px; text-transform: uppercase; border: 1px solid rgba(239, 68, 68, 0.3); }

        /* =========================================
           DASHBOARD COMPONENTS
        ========================================= */
        .setup-panel { padding: 24px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);}
        .setup-info h3 { margin: 0 0 6px 0; font-size: 18px; font-weight: 700; }
        .setup-info p { margin: 0; font-size: 14px; color: var(--text-muted); }

        .btn-download-sm { padding: 12px 20px; background: var(--panel); border: 1px solid var(--border); color: var(--text-main); width: auto; text-decoration: none; border-radius: 10px; font-weight: 600; transition: 0.2s;}
        .btn-download-sm:hover { background: var(--border-light); }

        .auth-key-wrapper { background: rgba(0,0,0,0.5); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); font-family: 'Fira Code', monospace; font-size: 13px; color: var(--success); margin-top: 12px; display: inline-flex; align-items: center; gap: 12px; }
        .auth-key-blurred { filter: blur(5px); cursor: pointer; color: var(--text-main); transition: 0.2s; }
        .auth-key-wrapper:hover .auth-key-blurred { filter: blur(0); }
        .btn-copy { background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: flex; outline: none; }
        .btn-copy:hover { color: #fff; }

        .upload-zone { border: 2px dashed var(--border-light); border-radius: 16px; padding: 40px 20px; text-align: center; background: var(--panel); cursor: pointer; margin-bottom: 30px; position: relative; overflow: hidden; transition: 0.2s; box-shadow: var(--shadow-lg);}
        .upload-zone:hover { border-color: var(--accent); background: rgba(37, 99, 235, 0.05); }
        .upload-zone svg { margin-bottom: 16px; color: var(--text-muted); transition: 0.2s; }
        .upload-zone:hover svg { color: var(--accent); transform: translateY(-4px); }
        .upload-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; background: rgba(0,0,0,0.5); display: none; }
        .upload-progress-bar { height: 100%; width: 0%; background: var(--success); transition: 0.2s ease; }

        /* GRIDS & CARDS */
        .stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 30px; }
        .stat-card { background: var(--panel); border: 1px solid var(--border); padding: 20px; border-radius: 16px; box-shadow: var(--shadow-lg);}
        .stat-card h3 { margin: 0; font-size: 28px; font-weight: 800; color: var(--text-main); }
        .stat-card p { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }

        .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
        .card { background: var(--panel); display: flex; flex-direction: column; transition: 0.2s; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-lg);}
        .card:hover { transform: translateY(-4px); border-color: var(--border-light); }
        .card-body { padding: 16px; flex-grow: 1; font-size: 13px; }

        .preview { height: 160px; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--border); }
        .preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
        .preview pre { margin: 0; padding: 16px; width: 100%; height: 100%; font-size: 12px; background: transparent !important; border: none; overflow: hidden; }

        .meta-line { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--text-muted); font-size: 12px; }
        .badge-user { background: rgba(255,255,255,0.05); border: 1px solid var(--border); padding: 4px 8px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 600; text-transform: uppercase; }

        .btn-delete { width: 100%; padding: 14px; background: transparent; color: var(--danger); border-top: 1px solid var(--border); border-radius: 0 0 16px 16px; font-size: 12px; letter-spacing: 1px; transition: 0.2s; border-left: none; border-right: none; border-bottom: none; cursor: pointer;}
        .btn-delete:hover { background: rgba(239, 68, 68, 0.1); }

        /* =========================================
           PROFILE PAGE STYLES
        ========================================= */
        .profile-wrapper { display: flex; flex-direction: column; gap: 24px; width: 100%; }
        .profile-header { margin-bottom: 10px; }
        .profile-header h3 { font-size: 26px; font-weight: 800; margin-bottom: 6px; color: #fff; }
        .profile-header p { color: var(--text-muted); font-size: 15px; margin: 0; }

        .profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
        .profile-card { padding: 32px; display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);}

        .card-header { margin: 0 0 24px 0; color: #fff; font-size: 18px; border-bottom: 1px solid var(--border); padding-bottom: 12px; font-weight: 700; }
        .card-header-sm { margin: 0 0 16px 0; color: #fff; font-size: 18px; font-weight: 700; }

        .profile-row { margin-bottom: 14px; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
        .profile-label { color: var(--text-muted); width: 120px; font-weight: 600; }

        .text-white { color: #fff; }
        .text-success { color: var(--success); font-weight: 700; }
        .text-danger { color: var(--danger); font-weight: 700; }
        .text-accent { color: var(--accent-hover); font-weight: 700; }

        .btn-save { width: 100%; background: var(--accent); color: #fff; padding: 16px; margin-top: auto; font-size: 15px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; border: none;}
        .btn-save:hover { background: var(--accent-hover); }

        .danger-card { padding: 32px; background: rgba(239, 68, 68, 0.05); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; box-shadow: var(--shadow-lg);}
        .danger-title { margin: 0 0 8px 0; color: var(--danger); font-size: 18px; font-weight: 700; }
        .danger-desc { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.5; }
        .btn-purge { width: auto; background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); padding: 14px 28px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.2s;}
        .btn-purge:hover { background: var(--danger); color: #fff; }

        /* =========================================
           TABLES & UTILITIES
        ========================================= */
        .table-container { width: 100%; overflow-x: auto; margin-bottom: 40px; }
        table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-surface); border-radius: 16px; border: 1px solid var(--border); min-width: 600px; box-shadow: var(--shadow-lg);}
        th, td { text-align: left; padding: 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
        th { background: rgba(255,255,255,0.02); font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
        tr:last-child td { border-bottom: none; }
        tbody tr:hover { background: var(--panel-hover); }

        .table-username { font-weight: 600; color: var(--text-main); }
        .table-role { text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
        .role-admin, .type-security { color: var(--success); }
        .role-user { color: var(--text-muted); }
        .type-upload { color: var(--danger); }
        .table-action-delete, .table-action-revoke { text-decoration: none; font-weight: 600; transition: 0.2s; }
        .table-action-delete { color: var(--danger); }
        .table-action-delete:hover { color: #f87171; }
        .table-action-revoke { color: var(--accent); }
        .table-action-revoke:hover { color: var(--accent-hover); }
        .table-action-muted { opacity: 0.5; font-family: 'Fira Code', monospace; font-size: 13px; }

        /* File Preview Elements */
        .file-preview-container { background: var(--bg-surface) !important; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-lg); }
        .img-center { text-align: center; padding: clamp(20px, 4vw, 40px) !important; }
        .preview-img { max-width: 100%; border-radius: 8px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5); }
        .code-preview { margin: 0 !important; padding: 24px !important; background: transparent !important; border: none; font-size: 14px; overflow-x: auto; line-height: 1.6; }

        @media (max-width: 900px) {
            .login-wrapper { grid-template-columns: 1fr; }
            .login-card, .login-instructions { height: auto; } 
            .global-stats { margin-top: 40px; }
        }

        @media (max-width: 768px) {
            .header { flex-direction: column; align-items: flex-start; gap: 20px; }
            .nav-links { width: 100%; overflow-x: auto; padding-bottom: 5px; }
            .setup-panel { flex-direction: column; align-items: flex-start; }
            .danger-card { flex-direction: column; align-items: flex-start; }
            .global-stats { grid-template-columns: repeat(1, 1fr); }
        }

        @media (max-width: 480px) {
            .global-stats { gap: 8px; }
            .g-stat-card { padding: 12px 6px; }
            .g-stat-card h4 { font-size: 18px; }
            .g-stat-card p { font-size: 9px; }
        }

.btn-download, .btn-download-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}


.btn-download {
    padding: 12px 24px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
}

.btn-download-sm {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
}

.btn-download:hover, .btn-download-sm:hover {
    background-color: #1d4ed8; /* Slightly darker blue */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
    color: #ffffff;
}

.btn-download:active, .btn-download-sm:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}


.danger-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap; 
}

.danger-actions .btn-download,
.danger-actions .btn-purge {
    flex: 1; 
    margin: 0;
    max-width: none; 
    text-align: center;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #1e1e2e;
    border: 1px solid #333;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a3b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #ff4757;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s;
}

.modal-close:hover { color: #fff; }

.modal-body {
    padding: 20px;
    color: #cbd5e1;
    line-height: 1.5;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #fff;
    border-radius: 8px;
    box-sizing: border-box;
}

.modal-body input:focus {
    border-color: #ff4757;
    outline: none;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #2a2a3b;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: #334155;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-secondary:hover { background: #475569; }

.table-action-muted, 
.table-action-revoke, 
.table-action-delete {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
    cursor: pointer;
}

.table-action-muted {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.table-action-muted:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.table-action-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.table-action-delete:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.table-action-revoke {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.table-action-revoke:hover {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}